* Eric G. Miller (egm2@jps.net) [020508 01:28]: > On Wed, May 08, 2002 at 12:41:28AM -0400, Andy Saxena wrote: > > On Mon, May 06, 2002 at 12:40:26AM -0700, Vineet Kumar wrote: > [snip] > > > It is on some levels; the symlink is dereferenced to get to the actual > > > code of the executable. A program can tell how it was called by looking > > > at argv[0], though. You should get the same result if you copy (instead > > > of symlinking) to a different name and running the copy. With the > > > symlink, the execution is identical, but the environment (containing the > > > command line) is different. > > > > > Could OP explain how the "environment" is different? "argv[0]" is > not the environment and shouldn't effect execution unless the program > takes explicit actions based on the name it was invoked with (usually > a bad idea). Okay, so "environment" isn't exactly precise (though I think it was good enough for this explanation). Really, the arguments to a process are passed right next to, but not "inside" the environment. It would have been more accurate for me to have said "the execution is identical, but the context (containing the command line arguments) is different. I think the point is the same, for the purposes of this explanation. As for taking different actions based on the command by which a program was called, look at the fsck family, bzless and bzmore, mh's show, next, and prev, and a lot of other things that show up in find / -type f | -links 1 =). Oh, and this case we were just looking at, about xterm changing the resources it loads based on the name by which it was called. My point is, though it may be considered bad practice, because it violates the principle of least surprise (e.g. when a symlink doesn't work as expected), but it's out there, and it's being used, so don't be /too/ surprised when you get bitten by it. good times, Vineet -- Currently seeking opportunities in the SF Bay Area Please see http://www.doorstop.net/resume.shtml
Attachment:
pgpZ1IVWe1aZs.pgp
Description: PGP signature