|
|
Subscribe / Log in / New account

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!


to post comments

Infinite bloat

Posted Jul 25, 2006 1:00 UTC (Tue) by jonabbey (guest, #2736) [Link] (2 responses)

But invoking a complete /bin/sh process to evaluate the empty shell script file would have been worse, surely?

Infinite bloat

Posted Jul 25, 2006 1:11 UTC (Tue) by zlynx (guest, #2285) [Link]

Not mine, but I remembered seeing it before.

Here you go :)
http://www.muppetlabs.com/~breadbox/software/tiny/true.as...

Infinite bloat

Posted Aug 9, 2006 1:28 UTC (Wed) by barrygould (guest, #4774) [Link]

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).

Barry

Infinite bloat

Posted Jul 25, 2006 1:40 UTC (Tue) by joey (guest, #328) [Link] (1 responses)

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.

(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.

Infinite bloat

Posted Jul 25, 2006 12:05 UTC (Tue) by nix (subscriber, #2304) [Link]

That is all GNU libc-version-dependent, and happens before main() is entered.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds