Why is the file /bin/false so large?
Rashkae
ubuntu at tigershaunt.com
Tue Feb 9 17:58:01 UTC 2010
Sandy Harris wrote:
>
> I tested by writing a C one-liner that just does exit(~0) ;
>
> Whether or not I #include <stdio.h>, it comes out just
> under 10 K bytes.
>
> This is for Xubuntu 9.10 on an Intel Core 2 box,
> with the default install of gcc, and no special
> optimisation options.
>
> /bin/false and /bin/true are each 35216 bytes.
>
All that trouble and speculation, and you forget that this is an open
source system? I'll admit, for no reasonably good reason, my curiosity
has been peaked by this inane question.
false.c:
#define EXIT_STATUS EXIT_FAILURE
#include "true.c"
So obviously, the one code that counts is true.c, which contains:
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include "system.h"
/* Act like "true" by default; false.c overrides this. */
#ifndef EXIT_STATUS
# define EXIT_STATUS EXIT_SUCCESS
#endif
#if EXIT_STATUS == EXIT_SUCCESS
# define PROGRAM_NAME "true"
#else
# define PROGRAM_NAME "false"
#endif
#define AUTHORS proper_name ("Jim Meyering")
void
usage (int status)
{
printf (_("\
Usage: %s [ignored command line arguments]\n\
or: %s OPTION\n\
"),
program_name, program_name);
printf ("%s\n\n",
_(EXIT_STATUS == EXIT_SUCCESS
? N_("Exit with a status code indicating success.")
: N_("Exit with a status code indicating failure.")));
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME);
emit_bug_reporting_address ();
exit (status);
}
int
main (int argc, char **argv)
{
initialize_main (&argc, &argv);
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
/* Recognize --help or --version only if it's the only command-line
argument. */
if (argc == 2)
{
if (STREQ (argv[1], "--help"))
usage (EXIT_STATUS);
if (STREQ (argv[1], "--version"))
version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,
(char *) NULL);
}
exit (EXIT_STATUS);
}
More information about the ubuntu-users
mailing list