Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ksh Emulation Not Clearing Envariables



[Hmm, I haven't seen Chet's original message, yet.]

[It's almost time to move this to zsh-workers.]

On Tue, 11 May 2004, Chris Jepeway wrote:

> > http://www.opengroup.org/onlinepubs/009695399/utilities/ 
> > xcu_chap02.html#tag_02_09_05
> >
> > Where we see
> >
> > 	When a function is executed, it shall have the syntax-error and
> > 	variable-assignment properties described for special built-in
> > 	utilities in the enumerated list at the beginning of Special Built-In
> > 	Utilities.
> >
> > One of those properties is:
> >
> > 	Variable assignments specified with special built-in utilities remain
> > 	in effect after the built-in completes; this shall not be the case
> > 	with a regular built-in or other utility.
> Well...the variable assignment isn't occurring inside the function.

"Variable assignments specified with" refers to this:

> It's outside, put into the environment before the [built-in] is called.

E.g.

	CDPATH=
	CDPATH=/tmp cd foo
	echo $CDPATH

should output "/tmp", because "cd" is a special built-in.  There is no 
other way to interpret "assignments specified with" because an assignment
cannot occur "inside" cd the way it can occur "inside" a function.

> I don't see how the spec can be read to mean "envariables
> poked into a command shall persist across command invocations
> when that command is a shell function."

(1) envariables poked into the environment of a command shall persist
across command invocations when that command is a special-built in.

(2) functions shall have the behavior of special built-ins.

QED.

Again this need not have anything to do with ksh emulation, but it's 
certainly POSIX emulation.

And I think there are other things controlled by the POSIX_BUILTINS 
option (?) so it may not be as easy as turning that off for ksh.



Messages sorted by: Reverse Date, Date, Thread, Author