Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!caesar.cs.montana.edu!milton!uw-beaver!sumax!quick!srg From: srg@quick.COM (Spencer Garrett) Newsgroups: comp.unix.questions Subject: Re: #! troubles Keywords: exec, kernel, environment Message-ID: <7661@quick.COM> Date: 17 Jan 90 04:43:45 GMT References: <2047@uvaarpa.virginia.edu> <1990Jan15.215617.9659@i88.isc.com> Organization: Quicksilver Engineering, Seattle Lines: 15 In article <1990Jan15.215617.9659@i88.isc.com>, daveb@i88.isc.com (Dave Burton) writes: > In article <2047@uvaarpa.virginia.edu> worley@compass.com writes: > >> Assuming the kernel gets your $PATH (which it doesn't, but pretend) - > > > The kernel does not get _any_ environment variables. Sure, it passes an > environment pointer to the exec'd process, but this does not imply the > environment is scanned. That would be _very_ expensive. Au contraire. The environment strings are *copied* to the child process in the same manner as the argv strings. The kernel could easily scan for a PATH variable. The main argument against this is that it's the sort of feeping creaturism for which Berkeley has been long and loudly chastized, though given that #! interpretation got moved in I don't see this as an inappropriate adjunct. I think it got left out mostly because coding this sort of thing at the kernel level is a mess.