Path: utzoo!utgpu!watmath!att!bellcore!rutgers!iuvax!mailrus!cornell!uw-beaver!fluke!foot From: foot@tc.fluke.COM (Andrew Proudfoot) Newsgroups: comp.bugs.sys5 Subject: Re: ksh bugs Keywords: ksh Message-ID: <10450@fluke.COM> Date: 17 Aug 89 15:27:51 GMT References: <10166@fluke.COM> Distribution: na Organization: John Fluke Mfg. Co., Inc., Everett, WA Lines: 80 The three problems I reported recently are all resolved. My thanks to everyone who replied. Here's the deal: > >1. When no result variable is explicitly provided, the "read" > command is supposed to store the line it reads in the REPLY > variable. But a "read" call without an explicit result variable > dumps core on our Suns (works OK on a Vax). Dave Korn says this is fixed in the "point" release, which should be available from the Toolchest soon if it isn't already. My understanding is that these minor releases are relatively cheap if you've already bought the most recent major release, but I haven't confirmed this. >2. the "read" command does filename expansion on its input! ... This was not a bug, just misinterpretation of normal behavior. Sorry! >3. One large ksh script, when run by certain users on certain input, > reports that it can't create new files in a writable directory, > can't find commands that are in the search path, and can't even find > commands for which correct full pathnames (like /bin/cp) are > specified... I've narrowed this problem down since the initial posting. It only occurs when PWD is not set in the environment of the user running the ksh script. Csh users here don't generally have PWD set, so they're the ones that get burned. A simple test script shows the problem: (running csh) % cat toy.ksh Contents of script #!/usr/local/ksh -x tdir=tdir$$ mkdir $tdir cd $tdir cd .. echo hello > $tdir/xx rm -rf $tdir % setenv PWD `pwd` Show PWD is set % echo $PWD /pandora/usr2/rhody/792A/bom/xxx % toy.ksh Script runs OK + tdir=tdir5238 + mkdir tdir5238 + cd tdir5238 + cd .. + echo hello + 1> tdir5238/xx + rm -rf tdir5238 % unsetenv PWD Unset PWD % echo $PWD PWD: Undefined variable. % toy.ksh Script breaks + tdir=tdir5255 + mkdir tdir5255 + cd tdir5255 + cd .. + echo hello + toy.ksh[7]: tdir5255/xx: cannot create + rm -rf tdir5255 toy.ksh[8]: rm: not found A workaround is to start your scripts with something like: if [ -z "$PWD" ]; then PWD=`/bin/pwd`; export PWD; fi Korn says the point release includes repairs to the PWD initialization code that he made to cure other symptoms, and that he *believes* this will fix my bug as well. Andy Proudfoot || domain: foot@tc.fluke.COM John Fluke Mfg. Co., M/S 223B || uucp: {uw-beaver,microsof,sun}!fluke!foot PO Box C9090 || Everett, WA 98206 || phone: (206) 356-5446