Coreutils binary locations

Matthew Burgess matthew at linuxfromscratch.org
Sun Aug 14 12:07:07 PDT 2005


Hi folks,

In chapter06/coreutils.html we state:  "Move programs to the proper 
locations:

mv /usr/bin/{[,basename,cat,chgrp,chmod,chown,cp,dd,df} /bin
mv /usr/bin/{date,echo,false,head,hostname,install,ln} /bin
mv /usr/bin/{ls,mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin
mv /usr/bin/{sleep,stty,test,touch,true,uname} /bin
mv /usr/bin/chroot /usr/sbin"

Firstly, I think we could expand on what we mean by "proper locations" - 
i.e. what makes us use /bin instead of /usr/bin?  I can think of 2 
reasons: i) FHS and ii) Bootscript requirements for scripts run before 
/usr is mounted

So, I think we could do with splitting those binary moves to make the 2 
reasons clearer:

"Move programs to the locations specified by the FHS:

mv /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
mv /usr/bin/{false,hostname,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
mv /usr/bin/{rmdir,stty,sync,true,uname} /bin

Move programs that the bootscripts require to /bin:

mv /usr/bin/{head,sleep} /bin"

That then leaves us with the following binaries that I can't see a need 
to move from /usr/bin:

[, basename, install, test, touch

Does anyone know why we do so?  The movement of 'install' even forces us 
to symlink it back to /usr/bin for so called FHS compliance.  Searching 
the FHS I can't see where it mandates the location of 'install'.

Now to get to the real crux of what caused all this in the first place!

The udev testsuite assumes that 'test' appears in /usr/bin, not in 
'/bin', causing one of the tests to fail.  I committed a change to the 
book today that simply replaced /usr/bin/test with /bin/test, then sent 
a query upstream.

Kay Sievers explained that udev uses execv() to invoke the PROGRAM 
argument specified in its rules.  This means that a 'real binary', 
rather than the shell builtin, will be run.  Additionally, it means that 
$PATH won't be respected, so unfortunately just running 'test' won't 
work.  The ideal solution would be to figure out a way of getting the 
test/udev-test.pl script to figure out whether it should call 
/usr/bin/test or /bin/test.  However, I'm only going to invest time in 
this if someone can convince me of why we *need* to move 'test' and '[' 
to /bin.

Regards,

Matt.



More information about the lfs-dev mailing list