Bug in install applet

Rob Landley rob at landley.net
Mon Feb 22 00:13:29 UTC 2010


On Sunday 21 February 2010 04:35:48 Harald Becker wrote:
> Hi!
>
> There seems to be a bug in the install applet. Possibly long standing.
>
> If you install a file with -s (strip symbols) and -p (preserve date/time
> etc.), it does first copy the file (preserving the date and time
> correctly) and afterwards strip is called, just as the last step. But
> stripping always changes the date and time of the file to the current
> date and time, and not only the time gets tampered, strip clears suid or
> sgid bits which may have been set with -m.

Worse, the gcc 4.4 "strip" command was broken last I checked (december).  It 
came up in an email exchange I had with Natanel Copa:

>Wow, the alpine Linux "strip" implementation is broken:
>
>  strip /bin/busybox -o walrus
>  ls -l walrus
>  -rw-r--r--    1 root     root       773276 Dec 12 01:55 walrus
>
>It removed the executable bit from the file.  I take it this is a gcc 4.4
> bug? (Ahem, not a bug, a "random new unannounced behavior change".)
>
>  http://www.opengroup.org/onlinepubs/9699919799/utilities/strip.html
>
>  The effect of strip on object and executable files shall be similar to the
> use of the -s option to c99
>
>  http://www.opengroup.org/onlinepubs/9699919799/utilities/c99.html
>
>  The executable file shall be created as specified in File Read, Write, and
>  Creation, except that the file permission bits shall be set to: S_IRWXO |
>  S_IRWXG | S_IRWXU
>
>So yeah, it looks like gcc 4.4 is in violation of susv4 by not setting the
>executable bit on its output files.

So what install really needs to do is call "strip -o" to write the new file, 
_then_ set the timestamp and permission bits on the new file afterwards.

Oh, other fun bug I hit was that I was cross compiling and "install" called 
the host strip rather than the prefixed one, but that's just another one off the 
JOYS of cross compiling.  (Don't use the x86 strip on sh4 binaries.  The 
symbol escape prefixes differ and get "corrected", and tracking down the bugs 
that result when _init and _fini get magically turned into .init and .fini is 
NOT AT ALL FUN.)

But I don't expect you to fix that one. :)

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds


More information about the busybox mailing list