From: James B. <jk...@mr...> - 2002-03-01 14:44:18
|
On Thu, Feb 28, 2002 at 11:33:08AM -0800, Jim Ingham wrote: > James, > > I did notice this when I was playing around just yesterday. It is odd, > because it mostly works just fine, and then every so often you will get > the "can't read..." error, or it will just silently fail to set the > environment. Then one or two commands later it will work again. Please > file a bug on this, and if you want to have a whack at it, that would be > great. It is a pretty annoying bug. I've tracked down the cause of the bug and a possible solution, although I need to experiment further. TclSetupEnv has: environ = *_NSGetEnviron(); When adding an environment variable we need to extend environ, which is done using ckalloc and memcpy. However an array names or similar function will recall TclSetupEnv and so throws away our extended copy. Even if it didn't call TclSetupEnv we'd still have problems for subprocesses as we haven't actually changed the environment, we've just made a copy. So just after the reallocate I added: char ***e = _NSGetEnviron(); *e = environ; and lo the problem has vanished! I'm guessing that this has nothing at all to do with MacOS X, but to do with the earlier mac versions too. I admit that I was a little suprised I could change the environment just like that, but I'm happy I can. I'll produce a patch and submit this to sourceforge. James -- James Bonfield (jk...@mr...) Fax: (+44) 01223 213556 Medical Research Council - Laboratory of Molecular Biology, Hills Road, Cambridge, CB2 2QH, England. Also see Staden Package WWW site at http://www.mrc-lmb.cam.ac.uk/pubseq/ |