Jove bug

Bill.Stewart.<ho95c> wcs at skep2.ATT.COM
Tue May 17 08:45:55 AEST 1988


[ Summary of the bug - if the PWD variable is present, Jove 4.9 assumes
[ that ksh is keeping it up to date, and uses it instead of getcwd().  
[ This is a problem if you aren't using ksh, but have PWD in your
[ environment from a parent process, because it's presumably wrong.

In article <4071 at killer.UUCP> elg at killer.UUCP (Eric Green) writes:
} I "solved" the problem simply by commenting out the getenv("CWD") and
} getenv("PWD") calls, and falling through into the getcwd() call.  But
} that's no permanent solution.  [..]
} It's not a bug in csh. csh doesn't need fixing (though Sys V does :-).  csh
} isn't supposed to maintain the "PWD" environment variable.  If csh was my
} login shell, that would be no problem -- there would be no "PWD" environment
} variable, and Jove would fall through into the getcwd().

If you think ksh maintaining $PWD is a bug, better excise $cwd from csh :-).

As a workaround, in your .login (if applicable) or .cshrc, do
	unsetenv PWD
	setenv SHELL=/bin/csh	## whatever the syntax is?

The general problem is how to detect when an environment variable has
a reliable meaning - at minimum, you should only use $PWD if it's non-null
and $SHELL is ksh, but even that's unreliable.  Better to just let Jove getcwd().

In a shell script, you can distinguish between 
Bourne sh and ksh reliably by checking
	if [ "$RANDOM" = "$RANDOM" ]
but that's no help from an executable.

-- 
#				Thanks;
# Bill Stewart, AT&T Bell Labs 2G218, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs
# skep2 is a local machine I'm trying to turn into a server.  Please send
# mail to ho95c or ho95e instead.  Thanks.



More information about the Comp.sources.bugs mailing list