[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: That '[' file in /usr/bin
From:       Eric Blake <eblake () redhat ! com>
Date:       2013-02-23 20:56:20
Message-ID: 51292CF4.1090706 () redhat ! com
[Download RAW message or body]


On 02/23/2013 10:25 AM, Salvador Girbau wrote:
> Hi all,
> would it be possible to replace /usr/bin/[ with a symlink to /usr/bin/test ?

Not really.  Although [ and test are compiled from the same sources,
they are compiled with different macro definitions, and have different
behavior (namely, whether --help is supported, and whether a ] must
appear as the last command line argument).  GNU Coding Standards
recommend that programs never inspect argv[0] as a means of dynamically
changing their behavior, and coreutils follows this rule by compiling
two separate binaries with the two different behaviors, regardless of
what the resulting binary finally gets named.

If you want to go for minimal binary size, then busybox is a better
project - that project has intentionally decided to base behavior on the
name of argv[0], and hence can symlink both [ and test to the same
busybox binary (along with a host of other utilties all crammed into one
super-binary).  But coreutils will not be adopting that approach.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic