Re: bin/12578: `` subshell taints PWD

1999-07-14 Thread Oliver Fromme
Niall Smart wrote in list.freebsd-hackers: > > > I'm not sure if XPG4v2 requires command substitution to behave > > like that. At least, both Solaris' and DEC UNIX... oops... > > True64 UNIX do execute all command substitutions in a subshell > > (`pwd` does not affect the surrounding shell),

Re: bin/12578: `` subshell taints PWD

1999-07-14 Thread Oliver Fromme
Niall Smart wrote in list.freebsd-hackers: > > > I'm not sure if XPG4v2 requires command substitution to behave > > like that. At least, both Solaris' and DEC UNIX... oops... > > True64 UNIX do execute all command substitutions in a subshell > > (`pwd` does not affect the surrounding shell)

Re: bin/12578: `` subshell taints PWD

1999-07-14 Thread Niall Smart
> I'm not sure if XPG4v2 requires command substitution to behave > like that. At least, both Solaris' and DEC UNIX... oops... > True64 UNIX do execute all command substitutions in a subshell > (`pwd` does not affect the surrounding shell), and both claim > XPG4 compliance. They only execute a su

Re: bin/12578: `` subshell taints PWD

1999-07-14 Thread Niall Smart
> I'm not sure if XPG4v2 requires command substitution to behave > like that. At least, both Solaris' and DEC UNIX... oops... > True64 UNIX do execute all command substitutions in a subshell > (`pwd` does not affect the surrounding shell), and both claim > XPG4 compliance. They only execute a s

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Doug
On Tue, 13 Jul 1999, Oliver Fromme wrote: > > But isn't that exactly what's happening here, where PWD is being tainted > > by the commands evaluated within the substitution? > > Yes, I'd call that a bug which should be fixed. > The manpage clearly says: > > "The shell expands the command s

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Oliver Fromme
Sheldon Hearn wrote in list.freebsd-hackers: > On Tue, 13 Jul 1999 18:13:42 +0200, Oliver Fromme wrote: > > > Command substitution certainly has to spawn a subshell, even > > for built-in commands, because otherwise you could modify > > parent shell variables within command substitutions. >

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Doug
On Tue, 13 Jul 1999, Oliver Fromme wrote: > > But isn't that exactly what's happening here, where PWD is being tainted > > by the commands evaluated within the substitution? > > Yes, I'd call that a bug which should be fixed. > The manpage clearly says: > > "The shell expands the command

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Oliver Fromme
Sheldon Hearn wrote in list.freebsd-hackers: > On Tue, 13 Jul 1999 18:13:42 +0200, Oliver Fromme wrote: > > > Command substitution certainly has to spawn a subshell, even > > for built-in commands, because otherwise you could modify > > parent shell variables within command substitutions. >

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Sheldon Hearn
On Tue, 13 Jul 1999 18:13:42 +0200, Oliver Fromme wrote: > Command substitution certainly has to spawn a subshell, even > for built-in commands, because otherwise you could modify > parent shell variables within command substitutions. But isn't that exactly what's happening here, where PWD is b

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Oliver Fromme
Niall Smart wrote in list.freebsd-hackers: > As I understand it most builtins will not spawn a new shell > when they are used in command substitution: > > niall% echo `echo $$` $$ > 20354 20354 > niall% Actually, that example doesn't prove anything. :-) $ echo `echo $$` $$ 8376 8376 $ ec

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Sheldon Hearn
On Tue, 13 Jul 1999 18:13:42 +0200, Oliver Fromme wrote: > Command substitution certainly has to spawn a subshell, even > for built-in commands, because otherwise you could modify > parent shell variables within command substitutions. But isn't that exactly what's happening here, where PWD is

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Oliver Fromme
Niall Smart wrote in list.freebsd-hackers: > As I understand it most builtins will not spawn a new shell > when they are used in command substitution: > > niall% echo `echo $$` $$ > 20354 20354 > niall% Actually, that example doesn't prove anything. :-) $ echo `echo $$` $$ 8376 8376 $ e

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Niall Smart
Sheldon Hearn wrote: > > On Mon, 12 Jul 1999 18:37:13 GMT, Niall Smart wrote: > > > The patch appended seems to fix this, I'd like someone familiar > > with sh to review it though, since this may be symptomatic of > > a general problem with command substitution. > > As I understand your patch, y

Re: bin/12578: `` subshell taints PWD

1999-07-13 Thread Niall Smart
Sheldon Hearn wrote: > > On Mon, 12 Jul 1999 18:37:13 GMT, Niall Smart wrote: > > > The patch appended seems to fix this, I'd like someone familiar > > with sh to review it though, since this may be symptomatic of > > a general problem with command substitution. > > As I understand your patch,

Re: bin/12578: `` subshell taints PWD

1999-07-12 Thread Sheldon Hearn
On Mon, 12 Jul 1999 18:37:13 GMT, Niall Smart wrote: > The patch appended seems to fix this, I'd like someone familiar > with sh to review it though, since this may be symptomatic of > a general problem with command substitution. As I understand your patch, you're saying "we should fork off a c

Re: bin/12578: `` subshell taints PWD

1999-07-12 Thread Niall Smart
Sheldon Hearn wrote: > cd /tmp > echo .`cd /`. > pwd > > Any takers? The patch appended seems to fix this, I'd like someone familiar with sh to review it though, since this may be symptomatic of a general problem with command substitution. > PS: And no, this is not an invitation to chat about t

Re: bin/12578: `` subshell taints PWD

1999-07-12 Thread Sheldon Hearn
On Mon, 12 Jul 1999 18:37:13 GMT, Niall Smart wrote: > The patch appended seems to fix this, I'd like someone familiar > with sh to review it though, since this may be symptomatic of > a general problem with command substitution. As I understand your patch, you're saying "we should fork off a

Re: bin/12578: `` subshell taints PWD

1999-07-12 Thread Niall Smart
Sheldon Hearn wrote: > cd /tmp > echo .`cd /`. > pwd > > Any takers? The patch appended seems to fix this, I'd like someone familiar with sh to review it though, since this may be symptomatic of a general problem with command substitution. > PS: And no, this is not an invitation to chat about

Re: bin/12578: `` subshell taints PWD

1999-07-12 Thread Sheldon Hearn
Hi folks, I'm hoping someone here is interested in tracking down a bug in our /bin/sh . Changing directory within a backtick (``) subshell in sh taints the parent's working directory. The following sample code gives the expected result for /bin/csh, but breaks for /bin/sh cd /tmp echo .`cd /`. p

Re: bin/12578: `` subshell taints PWD

1999-07-12 Thread Sheldon Hearn
Hi folks, I'm hoping someone here is interested in tracking down a bug in our /bin/sh . Changing directory within a backtick (``) subshell in sh taints the parent's working directory. The following sample code gives the expected result for /bin/csh, but breaks for /bin/sh cd /tmp echo .`cd /`.