PATH=/usr/local/bin:/bin:/usr/bin considered harmful

Michael Schwendt mschwendt at gmail.com
Fri Jun 22 13:40:01 UTC 2012


On Fri, 22 Jun 2012 06:53:09 -0400, Sam Varshavchik wrote:

> Michael Schwendt writes:
> 
> > On Fri, 22 Jun 2012 09:50:25 +0100, Mary Ellen Foster wrote:
> >
> > > I assume this error is also an instance of the same problem:
> > >
> > >  Error: Package: 2:samba-common-3.6.5-89.fc17.1.x86_64 (@updates-testing)
> > >            Requires: /usr/sbin/ldconfig
> > >            Removing: glibc-2.15-37.fc17.i686 (@fedora)
> > >                Not found
> > >            Updated By: glibc-2.15-48.fc17.i686 (updates-testing)
> > >                Not found
> > > Error: Package: 2:libsmbclient-3.6.5-89.fc17.1.x86_64 (@updates-testing)
> > >            Requires: /usr/sbin/ldconfig
> > >            Removing: glibc-2.15-37.fc17.i686 (@fedora)
> > >                Not found
> > >            Updated By: glibc-2.15-48.fc17.i686 (updates-testing)
> > >                Not found
> > >
> > > ?
> >
> > No, that was due to hardcoded /usr/sbin/ldconfig paths:
> 
> Oh, yes it is the same problem, but in reverse.
>
> Anyone who searches PATH will find /usr/sbin/ldconfig.

# whereis ldconfig
ldconfig: /sbin/ldconfig /usr/sbin/ldconfig /usr/share/man/man8/ldconfig.8.gz

/sbin is before /usr/sbin in $PATH. Even if the packager really ran "which
ldconfig" or similar, having forgotten that it's /sbin/ldconfig for years,
the result on Fedora 17 would have been "/sbin/ldconfig".

The following commit "Fix usrmove paths." (also see bug 829197)

  http://pkgs.fedoraproject.org/gitweb/?p=samba.git;a=commitdiff;h=3638a0bfcbbf10e73017dd271e683cce7c13a202

assumed that lots of executables had moved from /bin and /sbin to
/usr/bin and /usr/sbin, which is not true for glibc's ldconfig yet.

> glibc rpm installs /sbin/ldconfig.
> 
> Anything that uses PATH to find ldconfig, and uses it in any way that gets  
> sniffed out by find-requires, is going to cause a conflict with the next  
> glibc update. The package will install fine, but everything will come  
> crashing down, as soon as a mid-release glibc update shows up.

By definition, a "conflict" is something entirely different. What you
describe is a dependency issue, a weak/unsafe dependency, not a conflict.

> The only reason everything hasn't come apart, by now, is because everyone's  
> been hardcoding /sbin/ldconfig in their %post-s and %postun-s.

This is about Fedora 17, not Rawhide. 

Admittedly, 

  # ll /usr/sbin/ldconfig 
  -rwxr-xr-x. 1 root root 948296 May 11 05:28 /usr/sbin/ldconfig

can be misleading, but that is due to the /sbin -> usr/sbin symlink,
not $PATH.

-- 
Fedora release 17 (Beefy Miracle) - Linux 3.4.3-1.fc17.x86_64
loadavg: 0.39 0.66 0.71


More information about the devel mailing list