/bin/true


Rob Pike ha abierto un hilo de Twitter para recordar la historia de /bin/true en los Bell Labs. Debo reconocer que no la conocía y me ha impresionado porque sintetiza de una forma muy satírica el problema principal del sobredesarrollo de software que domina el mercado. Dejo a continuación el contenido del hilo, formateado, para un mayor disfrute. 

/bin/true used to be an empty file. The shell would open it, do nothing, and exit with a true status code.
When the Unix Support Group (development organization at Bell Labs) formalized everything, they gave it a long SCCS header, as they did every other file, and then needed to add exit 0 at the end. The file was therefore infinitely larger than before. At some point, somewhere (not sure where) it was decided this was poor engineering, probably because the shell spends time reading that big SCCS header as a comment one byte at a time. (It probably became a shell builtin somewhere along the line too, but that's for someone else to study.) The command moved to /usr/bin/true. I don't know when, where and especially why.
Eventually to avoid the unbearable overhead of executing a comment that shouldn't be there at all, someone rewrote true as a C program. What was once an empty file is now a non-portable executable binary compiled from C.
This is why we can't have good software. This program could literally have been an empty file, a nothing at all, a name capturing the essence perfectly. But the inexorable forces of improvement dictate we can't accept that, so here we are:
% file /usr/bin/true
/usr/bin/true: Mach-O 64-bit executable x86_64

Instead of:
% file true
true: empty
% true
% echo $?
0
%

Sólo un par de aclaraciones. En Linux, al menos en Ubuntu, true sigue en su localización original /bin/true pero si ejecutamos file sobre sí, nos devuelve lo siguiente, 
/bin/true: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d4e71e09ee6d28ee19cc885cd4f18d2187f013cb, stripped

También debo reconocer que entiendo la preferencia por el binario. Si un root incompetente sobreescribiera /bin/true, se produciría un fallo lógico masivo, pero no hay nada que justifique un programa más extenso que el /bin/true de OpenBSD, sistema caracterizado por la calidad, brevedad, seguridad y transparencia de su código.