![]() ![]() The true utility got indeed more cruft code over the years, most notably the standard support for -version and -help. The real distribution of the sections of /bin/true is as these charts shows the main code+data amounts to roughly 3KB out of a 26KB binary, which amounts to 12% of the size of /bin/true. ![]() Space is not at premium for the typical server/desktop anymore, and they do not even bother anymore to use the same binary for false and true, as it is just deployed twice in distributions using coreutils.įocusing, however, in the real spirit of the question, why something that should be so simple and small, gets so large? Similar comments apply to their size, 26KB for the kind of hardware we have nowadays is insignificant. They are not essential to bash performance, not being used anymore by bash (scripting). #define EXIT_STATUS EXIT_FAILUREĪs it also can be confirmed by both executables having the same size: $ ls -l /bin/true /bin/falseĪlas, the direct answer to the question "why are true and false so large?" could be, because there are not anymore so pressing reasons to care about their top performance. RedHat and Debian use both the coreutils package, analysed the compiled version of the latter having it more at hand).Īs it can be seen in the source file false.c, /bin/false is compiled with (almost) the same source code as /bin/true, just returning EXIT_FAILURE (1) instead, so this answer can be applied for both binaries. So it can be said with a high degree of certainty the trueand false executable files exist mainly for being called from other programs.įrom now on, the answer will focus on the /bin/true binary from the coreutilspackage in Debian 9 / 64 bits. ![]() "kill", "newgrp", "pwd", "read", " true", "umask", "unalias", "wait",Īlso per comments: $ command -V true false Thus no executable binary files are invoked by default, both when using the false and true directives in the bash command line and inside shell scripts.įrom the bashsource, builtins/mkbuiltins.c: char *posix_builtins = Nowadays, at least in bash, the trueand false commands are implemented as shell built-in commands. In the past, /bin/true and /bin/false in the shell were actually scripts.įor instance, in a PDP/11 Unix System 7: $ ls -la /bin/true /bin/false So my question is: Why are they so big? What's in the executable other than the return code? However I found to my surprise that both files are over 28KB in size. I expected them to be only a few bytes each, as true is basically just exit 0 and false is exit 1. However, what I found most surprising was their size. usr/bin/false: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID=b160fa513fcc13 usr/bin/true: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID=2697339d3c19235 After finding out that several common commands (such as read) are actually Bash builtins (and when running them at the prompt I'm actually running a two-line shell script which just forwards to the builtin), I was looking to see if the same is true for true and false. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |