Debian Bug report logs - #204975
cdbs: postrm and postinst have useless call to ldconfig

Package: debhelper; Maintainer for debhelper is Debhelper Maintainers <debhelper@packages.debian.org>; Source for debhelper is src:debhelper (PTS, buildd, popcon).

Reported by: Sebastien Bacher <seb128@debian.org>

Date: Mon, 11 Aug 2003 16:48:01 UTC

Severity: normal

Tags: patch

Merged with 205142, 364436

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, CDBS Hackers <build-common-hackers@lists.alioth.debian.org>:
Bug#204975; Package cdbs. (full text, mbox, link).


Acknowledgement sent to Sebastien Bacher <seb128@debian.org>:
New Bug report received and forwarded. Copy sent to CDBS Hackers <build-common-hackers@lists.alioth.debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Sebastien Bacher <seb128@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: cdbs: postrm and postinst have useless call to ldconfig
Date: Mon, 11 Aug 2003 18:34:35 +0200
Package: cdbs
Version: 0.4.5.2
Severity: normal


I've switched to cdbs for file-roller debian package.  But after building I've these two warnings :

W: file-roller: postinst-has-useless-call-to-ldconfig
W: file-roller: postrm-has-useless-call-to-ldconfig


file-roller has a so file "/usr/lib/bonobo/libfile-roller-component.so", but according to lintian :

"The postinst script calls ldconfig even though no shared libraries are
installed in a directory controlled by the dynamic library loader."


/usr/lib/bonobo is not "controlled by the dynamic library loader", so the call is useless.





Bug reassigned from package `cdbs' to `debhelper'. Request was from Colin Walters <walters@verbum.org> to control@bugs.debian.org. (full text, mbox, link).


Merged 204975 205142. Request was from Colin Walters <walters@verbum.org> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#204975; Package debhelper. (full text, mbox, link).


Acknowledgement sent to Loïc Minier <lool@dooz.org>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>. (full text, mbox, link).


Message #14 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Loïc Minier <lool@dooz.org>
To: Sebastien Bacher <seb128@debian.org>, 204975@bugs.debian.org, Colin Walters <walters@verbum.org>, Robert McQueen <robot101@debian.org>, control@bugs.debian.org
Subject: Re: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Mon, 11 Oct 2004 19:34:01 +0200
[Message part 1 (text/plain, inline)]
tags 204975 +patch
thanks

 Feel free to test this attempt at implementing the recommendations of
 the Policy.

   Regards,

-- 
Loïc Minier <lool@dooz.org>
[debhelper-4.2.20_dh-makeshlibs-ldconfig.patch (text/plain, attachment)]

Tags added: patch Request was from Loïc Minier <lool@dooz.org> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#204975; Package debhelper. (full text, mbox, link).


Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. (full text, mbox, link).


Message #21 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Joey Hess <joeyh@debian.org>
To: Loïc Minier <lool@dooz.org>, 204975@bugs.debian.org
Subject: Re: Bug#204975: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Mon, 11 Oct 2004 14:25:30 -0400
[Message part 1 (text/plain, inline)]
I do not like this approach, because it makes the package build
dependant on the contents of ld.so.conf. Since various packages modify
that file, there's no canonical list of what directories are used, and
changing behavior based on the contents of the file is asking for
trouble. The other alternative, noted in #205142, of hard-coding the
list of directories from policy into debhelper, is better, but still not
appealing.

Loïc Minier wrote:
> tags 204975 +patch
> thanks
> 
>  Feel free to test this attempt at implementing the recommendations of
>  the Policy.
> 
>    Regards,
> 
> -- 
> Loïc Minier <lool@dooz.org>

> diff -ur debhelper-4.2.20-orig/dh_makeshlibs debhelper-4.2.20/dh_makeshlibs
> --- debhelper-4.2.20-orig/dh_makeshlibs	2004-02-09 05:23:52.000000000 +0100
> +++ debhelper-4.2.20/dh_makeshlibs	2004-10-11 18:09:46.000000000 +0200
> @@ -95,6 +95,17 @@
>  
>  	doit("rm", "-f", "$tmp/DEBIAN/shlibs");
>  
> +	# prepare list of directories seen by ldconfig
> +	my @ld_config_dirnames;
> +	my $ld_conf_fd;
> +	if (open($ld_conf_fd, "/etc/ld.so.conf")) {
> +		@ld_config_dirnames = <$ld_conf_fd>;
> +	} else {
> +		@ld_config_dirnames = ();
> +	}
> +	@ld_config_dirnames = ('/usr/lib', '/lib', @ld_config_dirnames);
> +
> +
>  	# So, we look for files or links to existing files with names that
>  	# match "*.so*". Matching *.so.* is not good enough because of
>  	# broken crap like db3. And we only look at real files not
> @@ -108,6 +119,12 @@
>  	}
>  	open (FIND, "find $tmp -type f \\( -name '*.so' -or -name '*.so.*' \\) $exclude |");
>  	while (<FIND>) {
> +		# the above sets target absolute dirname for this file
> +		# first get a relative dirname
> +		my $target_dirname = dirname $_;
> +		# remove the tmp dir part and add a leading /
> +		$target_dirname =~ s#^$tmp#/#;
> +
>  		my ($library, $major);
>  		my $objdump=`objdump -p $_`;
>  		if ($objdump=~m/\s+SONAME\s+(.+)\.so\.(.+)/) {
> @@ -149,7 +166,11 @@
>  		}
>  		if (defined($library) && defined($major) && defined($deps) &&
>  		    $library ne '' && $major ne '' && $deps ne '') {
> -		    	$need_ldconfig=1;
> +			# see if the target installation directory will be seen
> +			# by ldconfig
> +			$need_ldconfig=1 if grep {
> +				$target_dirname =~ /^$_/
> +			} @ld_config_dirnames;
>  		    	# Prevent duplicate lines from entering the file.
>  		    	my $line="$library $major $deps";
>  			if (! $seen{$line}) {

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#204975; Package debhelper. (full text, mbox, link).


Acknowledgement sent to Loïc Minier <lool@dooz.org>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>. (full text, mbox, link).


Message #26 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Loïc Minier <lool@dooz.org>
To: Joey Hess <joeyh@debian.org>
Cc: 204975@bugs.debian.org
Subject: Re: Bug#204975: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Tue, 12 Oct 2004 10:46:50 +0200
Joey Hess <joeyh@debian.org> - Mon, Oct 11, 2004:

> I do not like this approach, because it makes the package build
> dependant on the contents of ld.so.conf. Since various packages modify
> that file, there's no canonical list of what directories are used, and
> changing behavior based on the contents of the file is asking for
> trouble. The other alternative, noted in #205142, of hard-coding the
> list of directories from policy into debhelper, is better, but still not
> appealing.

 A lot of things are build dependents, and I think you believe it could
 cause vicious build-conflicts.
   I think you should look at Policy 8.1.1, because there is no such
 list of directories.  You're guaranteed to have /lib and /usr/lib, but
 you *must* run ldconfig when you add to directories listed in
 /etc/ld.so.conf.

 I believe there's no harm in running ldconfig on systems where the list
 of directories is different.  If you think there is, I suggest you
 change the patch I've sent to hardcode the list instead of loading it
 from /etc/ld.so.conf, and you'll have to make sure you update your
 list.

   Regards,

-- 
Loïc Minier <lool@dooz.org>



Information forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#204975; Package debhelper. (full text, mbox, link).


Acknowledgement sent to Loïc Minier <lool@dooz.org>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>. (full text, mbox, link).


Message #31 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Loïc Minier <lool@dooz.org>
To: 204975@bugs.debian.org
Subject: Re: Bug#204975: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Mon, 25 Oct 2004 14:07:07 +0200
[Message part 1 (text/plain, inline)]
Joey Hess <joeyh@debian.org> - Mon, Oct 11, 2004:

> I do not like this approach, because it makes the package build
> dependant on the contents of ld.so.conf. Since various packages modify
> that file, there's no canonical list of what directories are used, and
> changing behavior based on the contents of the file is asking for
> trouble. The other alternative, noted in #205142, of hard-coding the
> list of directories from policy into debhelper, is better, but still not
> appealing.

 Here's your hardcoded list.

   Regards,

-- 
Loïc Minier <lool@dooz.org>
[debhelper-4.2.20_dh-makeshlibs-ldconfig-2.patch (text/plain, attachment)]

Disconnected #205142 from all other report(s). Request was from Joey Hess <joeyh@debian.org> to control@bugs.debian.org. (full text, mbox, link).


Merged 204975 205142. Request was from Joey Hess <joeyh@debian.org> to control@bugs.debian.org. (full text, mbox, link).


Blocking bugs added: 338219 Request was from Joey Hess <joeyh@debian.org> to control@bugs.debian.org. (full text, mbox, link).


Merged 204975 205142 364436. Request was from Peter Eisentraut <petere@debian.org> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>:
Bug#204975; Package debhelper. (Fri, 30 Sep 2016 01:21:02 GMT) (full text, mbox, link).


Acknowledgement sent to Olly Betts <olly@survex.com>:
Extra info received and forwarded to list. Copy sent to Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>. (Fri, 30 Sep 2016 01:21:02 GMT) (full text, mbox, link).


Message #44 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Olly Betts <olly@survex.com>
To: Joey Hess <joeyh@debian.org>, 204975@bugs.debian.org
Cc: Loïc Minier <lool@dooz.org>
Subject: Re: Bug#204975: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Fri, 30 Sep 2016 13:42:59 +1300
On Mon, Oct 11, 2004 at 02:25:30PM -0400, Joey Hess wrote:
> I do not like this approach, because it makes the package build
> dependant on the contents of ld.so.conf. Since various packages modify
> that file, there's no canonical list of what directories are used, and
> changing behavior based on the contents of the file is asking for
> trouble. The other alternative, noted in #205142, of hard-coding the
> list of directories from policy into debhelper, is better, but still not
> appealing.

Another approach is to find out from ldconfig which directories it is
searching - you can tell it to use a different file instead of
/etc/ld.so.conf (e.g. /dev/null in this example) if you don't want to
change behaviour based on the contents of that file (and files it
includes):

$ /sbin/ldconfig -N -X -v -f /dev/null 2>/dev/null|sed 's,^\(/.*\):\( (.*)\)\?$,\1,p;d'
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/lib
/usr/lib

Cheers,
    Olly



Information forwarded to debian-bugs-dist@lists.debian.org, Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>:
Bug#204975; Package debhelper. (Sun, 02 Oct 2016 12:15:03 GMT) (full text, mbox, link).


Acknowledgement sent to Loïc Minier <loic.minier@dooz.org>:
Extra info received and forwarded to list. Copy sent to Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>. (Sun, 02 Oct 2016 12:15:03 GMT) (full text, mbox, link).


Message #49 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Loïc Minier <loic.minier@dooz.org>
To: Olly Betts <olly@survex.com>
Cc: Joey Hess <joeyh@debian.org>, 204975@bugs.debian.org
Subject: Re: Bug#204975: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Sun, 2 Oct 2016 14:08:35 +0200
[Message part 1 (text/plain, inline)]
Hi,

Re-reading this bug – filed 12 years ago – I have to agree with Joey Hess (and I find my own tone from 12 years ago pretty bad, sorry about that!): it’s not a good idea to rely on the contents of /etc/ld.so.conf.

It’s less big a deal than it used to be because of /etc/ld.so.conf.d/* which is where other packages would change the search path, but it’s still an issue because an admin might have changed the local config and this will affect package builds.

> Le 30 sept. 2016 à 02:42, Olly Betts <olly@survex.com> a écrit :
> $ /sbin/ldconfig -N -X -v -f /dev/null 2>/dev/null|sed 's,^\(/.*\):\( (.*)\)\?$,\1,p;d’

This approach looks very good to me; here’s perhaps a lighter sed:
sed -n '/^\//s#:$##p’
(match lines leading with slash, remove trailing colon and print them)

However it might be worth bringing this discussion to Debian Policy as this currently said that /etc/ld.so.conf contents must be used.
https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-ldconfig <https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-ldconfig>

Another perhaps smarter approach would be to do away with postinst requirements entirely by installing a ldconfig file-based trigger in libc for *.so files under interesting directories. This would let libc define when to run libc’s ldconfig rather than having each shared library package carry a build-time and install time snippet…

Cheers,
- Loïc Minier
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>:
Bug#204975; Package debhelper. (Sun, 02 Oct 2016 12:27:03 GMT) (full text, mbox, link).


Acknowledgement sent to Niels Thykier <niels@thykier.net>:
Extra info received and forwarded to list. Copy sent to Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>. (Sun, 02 Oct 2016 12:27:03 GMT) (full text, mbox, link).


Message #54 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Niels Thykier <niels@thykier.net>
To: Loïc Minier <loic.minier@dooz.org>, 204975@bugs.debian.org, Olly Betts <olly@survex.com>
Cc: Joey Hess <joeyh@debian.org>
Subject: Re: [debhelper-devel] Bug#204975: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Sun, 02 Oct 2016 12:25:00 +0000
Loïc Minier:
> Hi,
> 
> [...]
> Another perhaps smarter approach would be to do away with postinst requirements entirely by installing
> a ldconfig file-based trigger in libc for *.so files under interesting
directories. This would let
> libc define when to run libc’s ldconfig rather than having each shared
library package carry a
> build-time and install time snippet…
> 
> Cheers,
> - Loïc Minier
> 
> [...]

At the current time, we have migrated to activation triggers.  They are
still in each package, but it does avoid the shell snippets (and all the
related prerm+postinst scripts).

As for using a path trigger, I believe that was ruled out as they are
recursive.  The libc-bin package would have to declare an interest in
*all* of /usr/lib, which will generate tons of false-positives.  I
suspect it may also be a bit heavy on the dpkg side.

Thanks,
~Niels





Information forwarded to debian-bugs-dist@lists.debian.org, Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>:
Bug#204975; Package debhelper. (Sun, 02 Oct 2016 12:54:03 GMT) (full text, mbox, link).


Acknowledgement sent to Loïc Minier <loic.minier@dooz.org>:
Extra info received and forwarded to list. Copy sent to Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>. (Sun, 02 Oct 2016 12:54:03 GMT) (full text, mbox, link).


Message #59 received at 204975@bugs.debian.org (full text, mbox, reply):

From: Loïc Minier <loic.minier@dooz.org>
To: Niels Thykier <niels@thykier.net>
Cc: 204975@bugs.debian.org, Olly Betts <olly@survex.com>, Joey Hess <joeyh@debian.org>
Subject: Re: [debhelper-devel] Bug#204975: [Build-common-hackers] Bug#204975: cdbs: postrm and postinst have useless call to ldconfig
Date: Sun, 2 Oct 2016 14:51:53 +0200
[Message part 1 (text/plain, inline)]
> Le 2 oct. 2016 à 14:25, Niels Thykier <niels@thykier.net> a écrit :
> As for using a path trigger, I believe that was ruled out as they are
> recursive.  The libc-bin package would have to declare an interest in
> *all* of /usr/lib, which will generate tons of false-positives.  I
> suspect it may also be a bit heavy on the dpkg side.

Indeed, it seems one has to specify a dir or specific file and one can not use a regexp.

https://anonscm.debian.org/cgit/dpkg/dpkg.git/tree/doc/triggers.txt <https://anonscm.debian.org/cgit/dpkg/dpkg.git/tree/doc/triggers.txt>

- Loïc Minier
[Message part 2 (text/html, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jul 2 12:09:13 2023; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.