Sending Tcsh to packages/ports ...
Paul Mather
freebsd-lists at gromit.dlib.vt.edu
Fri Mar 29 13:36:11 UTC 2019
> Date: Fri, 29 Mar 2019 03:56:38 +0100
> From: Polytropon <freebsd at edvax.de>
> To: Michael Sierchio <kudzu at tenebras.com>
> Cc: mayuresh at kathe.in, FreeBSD Questions
> <freebsd-questions at freebsd.org>
> Subject: Re: Sending Tcsh to packages/ports ...
> Message-ID: <20190329035638.db780898.freebsd at edvax.de>
> Content-Type: text/plain; charset=US-ASCII
>
> On Thu, 28 Mar 2019 19:03:24 -0700, Michael Sierchio wrote:
>> *kudzu at hearst:/bin 130>* ll -i | grep csh
>>
>> 198147 -r-xr-xr-x 2 root wheel 427888 Jun 22 2018 csh*
>>
>> 198147 -r-xr-xr-x 2 root wheel 427888 Jun 22 2018 tcsh*
>>
>
> The csh / tcsh is not the only system component known by
> more than one name:
>
> % hardlinks.sh /bin
> 23621: csh tcsh <--- !
> 23627: ed red
> 23633: link ln
> 23638: pgrep pkill
> 23644: rm unlink
> 24944: [ test
>
> It's important to note that by querying $0 or argv[0], a
> program can change its behaviour depending on the way it
> has been invoked. So a call to "csh" could cause the program
> to do things differently than if it was called by "tcsh".
>
> Of course this also applies to _any_ programs, being part
> of the OS or being installed by ports.
Indeed, this is the mechanism by which the /rescue system works: lots of hard links to a statically-linked /rescue/rescue binary, which behaves differently depending upon with which program name it's being invoked. In the case of /rescue this saves a lot of space over having separate static binaries.
Cheers,
Paul.
More information about the freebsd-questions
mailing list