[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#879935: lintian: Please strongly discourage cross-unsafe getconf(1) interface



Package: lintian
Version: 2.5.55
Severity: wishlist

Hi!

As I've mentioned on
<https://lists.debian.org/debian-cross/2017/10/msg00002.html>, the
getconf(1) interface is completely broken when it comes to cross-building.

So we should first, stop advertising it as something to use in the LFS
tag (patch attached). And start emitting a tag when it is being used
for any of the cases where it is clearly not correct to do so. The
only cases I think are correct are to get the current number of online
processors, or perhaps to get the default PATH:

  PATH
  _NPROCESSORS_CONF
  _NPROCESSORS_ONLN

Anything else is very specific to the build (not host/target) arch,
and as such means any cross build will be broken. There are cases
where it might even produce broken native builds, as the values can
change between systems of the same architecture.

Here's a sample of some of the current offenders:

  <https://codesearch.debian.net/search?q=path%3Adebian%2Frules+getconf&page=7>

We might need to check beyond debian/rules, in cases there are other
files being included or similar.

Thanks,
Guillem
From b7d6174968078e12bf4af34b90192a1dc99341c4 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Fri, 27 Oct 2017 13:53:36 +0200
Subject: [PATCH] c/binaries.desc: Improve LFS description

Recommend against using getconf LFS_CFLAGS which is broken on
cross-builds. Instead recommend the new dpkg-buildflags lfs feature
from the future feature area. And reorder Ref links in order of
relevance.

Signed-off-by: Guillem Jover <guillem@debian.org>
---
 checks/binaries.desc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/checks/binaries.desc b/checks/binaries.desc
index 708ad263a..4e58220c7 100644
--- a/checks/binaries.desc
+++ b/checks/binaries.desc
@@ -446,9 +446,11 @@ Info: The listed ELF binary appears to be (partially) built without
  were the ABI has LFS enabled by default, setting <tt>_FILE_OFFSET_BITS</tt>
  to 64 will be a no-op, and as such optional).  This can be done by using
  the <tt>AC_SYS_LARGEFILE</tt> macro with autoconf which will set any
- macro required to enable LFS when necessary, or by appending the output
- of <tt>getconf LFS_CFLAGS</tt> and <tt>getconf LFS_LDFLAGS</tt> to
- <tt>CFLAGS</tt> and <tt>LDFLAGS</tt> respectively.  Using
+ macro required to enable LFS when necessary, or by enabling the
+ <tt>lfs</tt> feature from the <tt>future</tt> dpkg-buildflags feature
+ area which sets the <tt>CPPFLAGS</tt> variable (since dpkg-dev 1.19.0).
+ Note though, that <tt>getconf LFS_CFLAGS</tt> must <b>not</b> be used,
+ as it does  not support cross-building.  Using
  <tt>_FILE_OFFSET_BITS</tt> should require no system function renames (eg.
  from open(2) to open64(2)), and if this tag is still emitted, the most
  probable cause is because the macro is not seen by the system code being
@@ -464,5 +466,5 @@ Info: The listed ELF binary appears to be (partially) built without
  systems with an ABI without LFS, defining <tt>_LARGEFILE64_SOURCE</tt>
  and exporting both 32 and 64-bit variants of the interfaces can avoid
  the SOVERSION bump, at the cost of more complex maintenance.
-Ref: https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html,
- http://www.unix.org/version2/whatsnew/lfs20mar.html
+Ref: http://www.unix.org/version2/whatsnew/lfs20mar.html,
+ https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
-- 
2.15.0.rc2


Reply to: