[Toybox] Fix paths to avoid confusing update-alternatives

Rob Landley rob at landley.net
Sat Apr 4 19:11:47 PDT 2015


On 04/04/2015 02:08 PM, Isaac Dunham wrote:
> Looking over landley.net/hg/toybox, I noticed this commit:
> changeset 1775:57f2a26fa92c
>  To ensure that toybox can be installed alongside busybox without 
>  confusing update-alternatives, the paths of the links installed by
>  toybox should match those installed by busybox. This is accomplished
>  by changing the flags of a few tools within toybox.
> 
> Most of these are correct, but a few are the result of busybox being
> plainly wrong:
> readlink, df, and cut all belong in /bin (as per `which` on Debian).

This is an OpenEmbedded patch, which Khem Raj pointed me at on irc:
https://github.com/kraj/meta-musl/blob/master/recipes-core/toybox/toybox/0001-Match-paths-with-busybox.patch

The reason behind it seems to be so that OpenEmbedded's package
management system can cleanly drop in toybox to replace busybox; if
things install in different places the package manager's dependency
stuff gets confused.

Why this doesn't kick in when busybox replaces other df implementations
and such that live in a different place, I couldn't tell you.

I don't personally have a strong opinion about where these things go
because I've been symlinking /bin to /usr/bin in my systems since 2001,
for the reasons I explained in:

http://landley.net/writing/hackermonthly-issue022-pg33.pdf

(I typed that up on the busybox list off the top of my head one night
back in ~2010, but got a couple details wrong and hadn't added citations
to primary sources. When a magazine asked if they could reprint my old
post as an article a few  years later, I took the opportunity to
confirm/correct the details.)

> df should certainly not be installed in /usr/sbin, since it is a user
> tool rather than a purely administrative one; cut is frequently used
> in boot scripts, which means it should go in the prefix "/", rather 
> than "/usr"; and /etc/init.d/udev uses readlink specifically because
> it's in /bin rather than /usr/bin.
> 
> These should be fixed in busybox.

Yay fixing them. My concern is that openembedded's package management
system can actually package busybox so we can go into openembedded, and
from there into yocto and tizen.

(The tizen guys have a git branch at
https://git.tizen.org/cgit/platform/upstream/toybox adding support for
"smack", which is their alternative to selinux. Examining and merging
that is on my todo list.)

> I'll send a patch to fix them in toybox once the git mirror updates.
> 
> Thanks,
> Isaac Dunham

Please work out the details with Khem?

Thanks,

Rob

P.S. in my toybox talk last week I linked to
http://lkml.iu.edu/hypermail/linux/kernel/1306.3/04204.html which got
merged in 2013 and makes the "/usr mounted after /" bit even _less_
relevant than it used to be. But I'd still like the locations to be
correct...

 1428199907.0


More information about the Toybox mailing list