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

Re: Wrong emulation mode if exec'd by su



On Jun 15,  3:28pm, Zefram wrote:
} Subject: Re: Wrong emulation mode if exec'd by su
}
} The original behaviour is correct.  "su" really should not give the shell
} this weird argv[0] (some versions don't).  But on the older systems where
} it does, it's more likely that the shell being invoked is supposed to
} be sh, so treating a name of "su" as "sh" is the best behaviour.

For plain "su", I mostly agree.  For "su -" it's the user's login shell
that is supposed to be invoked.  (I suspect the reason for the "weird" $0
is so that it will show up in "ps" even after exec()ing the real shell.)

However, the fix in the patch is the wrong one.  Rather than looking for
every possible shell name in argv[0], the right thing would be to look
for "su" in argv[0], before testing the first letter for emulation, and
in that case do the emulation test on the value of $SHELL rather than on
argv[0].

I'm short of time this morning, but if that seems reasonable and no one
else does it first I may make a patch later today.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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