Infinite bloat
Infinite bloat
Posted Jul 24, 2006 21:01 UTC (Mon) by aegl (subscriber, #37581)Parent article: OLS: On how user space sucks
A long time ago in a Unix version far, far away /bin/true was an empty shell script (since it was executable, the shell would run it as a shell script when the kernel failed the exec(2), with nothing in the script, the shell returned a 0 exit code).
$ ls -l /bin/true
-rwxr-xr-x 1 root root 21969 2004-04-05 21:32 /bin/true
Infinite bloat!
But it is worse. Run strace on /bin/true, and you'll see it open and mmap a dozen locale files (and try and fail to open a dozen more).
The problems here seem to have arisen because someone decided to add "--version" and "--help" arguments. Aaargggghhhh!
Posted Jul 25, 2006 1:00 UTC (Tue)
by jonabbey (guest, #2736)
[Link] (2 responses)
Posted Jul 25, 2006 1:11 UTC (Tue)
by zlynx (guest, #2285)
[Link]
Here you go :)
Posted Aug 9, 2006 1:28 UTC (Wed)
by barrygould (guest, #4774)
[Link]
Barry
Posted Jul 25, 2006 1:40 UTC (Tue)
by joey (guest, #328)
[Link] (1 responses)
(true is also a builtin in bash and dash, but I prefer ":" for space-efficiency also.)
However, your version of gnu true doesn't seem to match mine, which opens only /usr/lib/locale/locale-archive, and which is faster than the zero-byte version.
Posted Jul 25, 2006 12:05 UTC (Tue)
by nix (subscriber, #2304)
[Link]
But invoking a complete /bin/sh process to evaluate the empty shell script file would have been worse, surely?Infinite bloat
Not mine, but I remembered seeing it before.Infinite bloat
http://www.muppetlabs.com/~breadbox/software/tiny/true.as...
True was changed from a shell script to an executable due to the fact that running a shell for a user that wasn't supposed to be able to login (e.g. an ftp-only user) created a security hole (ctrl-c could get you a shell).Infinite bloat
Shell coders who are really interested in being efficient don't use external commands like /bin/true anyway, when the shell builtin ":" will do the same thing.Infinite bloat
That is all GNU libc-version-dependent, and happens before main() is entered.Infinite bloat