Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Iconitis Message-ID: <1466@auspex.auspex.com> Date: 19 Apr 89 07:10:56 GMT References: <1930@dataio.Data-IO.COM> <11555@lanl.gov> <17376@cisunx.UUCP> <28558@apple.Apple.COM> <7898@pyr.gatech.EDU> <28679@apple.Apple.COM> <7910@pyr.gatech.EDU> <2132@pur-phy> <1752@skinner.nprdc.arpa> <28836@apple.Apple.COM> <10040@smoke.BRL.MIL> <29126@apple. Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 28 >>That's rather odd, as you can't change environment variables from a >>unix command or shell script. The spawned process only sees a copy of >>the environment. Are you sure it wasn't MSDOS? > >You can do the same thing in MSDOS as you can in UNIX -- find the original >copy of the environment table and modify it. It isn't too hard to do for >UNIX programs, especially shell scripts. It isn't difficult for shell scripts to modify the environment of the shell that's running the script. It is *quite* difficult for shell scripts to modify the environment of the shell that read the command to run the script, since that shell isn't running in the same process as the one running the script, and it is quite difficult for one process to find the environment in another process - for one thing, it needs read/write permission on "/dev/mem" and the swap device, or a "/proc" implementation and read/write access on that process, or the ability to "ptrace" that other process, or the active cooperation of that other process. The same applies to commands implemented as executable images rather than shell scripts. So, if you claim that you ran some ordinary program or shell script and it modified the environment *of the shell at which you typed the command* without the active cooperation of that shell (e.g., some combination of "eval" and backquotes), you didn't see what you think you saw - try again.