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

Re: Want to replace bash w zsh as system shell on Ubuntu



rj wrote:
> In the couple of months I've been using Ubuntu at home, I've discovered
> I need to use the "sudo" command almost daily for administrative changes
> and systemwide, non-user-specific tasks and so on.
>
> I've already set up zsh as my user shell, but the system default shell is
> bash, and whenever I do a "sudo" I'm wrenched out of my familiar customized
> zsh environment into a raw, minimally-config'd bash.

You need to differentiate between default interactive shells and /bin/sh
here. I suspect what you mean are interactive shells here. But just in
case you do mean changing the /bin/sh symbolic link to zsh, a word of
warning:

With the grml live-cd (http://grml.org) we actually had zsh a /bin/sh
for a number of releases. And - contrary to what others may believe - it
worked well enough. Until it broke one day. Bugs were filed but went
generally ignored. That resulted in grml backing off from using zsh as
/bin/sh, documented even in our FAQ: <http://grml.org/faq/#zsh_binsh>

Looking back we probably should have reported bugs against zsh to
improve its `sh' mode.

One of the problems (which was worked around after four years in debian)
was a script defining a function called `repeat'. That's also a shell
reserved word in zsh, leading to a parsing error. If zsh would disable
`repeat' in sh mode, which would also be correct, that problem would be
gone.

The other problem mentioned in grml's FAQ is #329288[1], where the
problem is a script using `ulimit'. In sh mode, zsh does not make
`ulimit' available as a builtin command. The guy responding to the bug
report closed the bug, stating that zsh in sh mode is not a POSIX
compatible shell and therefore not supported. I guess strictly speaking,
you cannot dispute that - although sh mode is trying as hard as possible
to be compatible. Demanding POSIX here is kind of a two sided sword,
though. If you look at the actual standard for ulimit[2] you'll find
that `ulimit' is only an extension to the standard.

Granted, ksh93, pdksh, mksh, bash and dash all implement that extension.

But debian's posh, which in it's manual declares it covers SUSv3
compliance with the exceptions: echo -n, binary -a and -o to test, local
scoping. And in fact, it does *not* implement `ulimit'.

For compatibility with the other shells listed above, zsh could just
expose `ulimit' in sh mode and be done with it.


Anyway, if you do change /bin/sh to be zsh, you should prepare for
problems. And for what it's worth, I think ubuntu's choice of `dash' as
/bin/sh is rather adequate. Stick with it.


If this whole question is about the interactive shell that you're
getting dropped into by `sudo' (which I suspect), I'd change root's
shell to zsh by chsh(1) and use `sudo -i' instead of `sudo -s'.

Regards, Frank

[1] <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=329288>
[2] <http://www.opengroup.org/onlinepubs/9699919799/utilities/ulimit.html>

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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