[Pkg-zsh-devel] Bug#794967: zsh: please enhance /etc/zshrc

Carsten Hey carsten at debian.org
Mon Aug 10 21:07:51 UTC 2015


Hi,

running zsh -u leads to this warning message:

    /etc/zsh/zshrc:14: DEBIAN_PREVENT_KEYBOARD_CHANGES: parameter not set

(My answer to "Don't do that" is "If this is not allowed, zsh should not
 accept -u for interactive shells".)

The fix is to replace lines 14 and 15 with:

    if [[ -z "${DEBIAN_PREVENT_KEYBOARD_CHANGES-}" ]] &&
       [[ "${TERM-}" != 'emacs' ]]

* Frank Terbeck [2015-08-08 23:46 +0200]:
> Carsten Hey wrote:
> [...]
> >  * (( ${+aliases[run-help]} )) requires the zsh/parameter module.  If,
> >    in rare cases, possibly involving zsh-static, there is a chance that
> >    this module is not loaded successfully, you should consider doing
> >    this instead to remove the alias w/o error message:
> >
> >      alias run-help=
> >      unalias run-help
>
> That's a good point. I think we can do it like this:
>
>     unhash -a -m 'run-help' || true
>
> ...
>
> We could also just do this:
>
>     unalias run-help 2>/dev/null || true
>
> …if that's more straight-forward to read.

We agreed on using unalias -m, not unhash -m.  Whether the argument
should be quoted is in this case just a matter style, personal
preferences and syntax highlighting.

> The '|| true' is to make sure the setup file exits with successful
> status.

If it is sourced with errexit set, or if someone removes the final line
(which might not be that unlikely) and sources this file, appending '||
:' or '|| true' (the former is a POSIX special builtin, but zsh seems to
ignore this difference) actually makes a difference, and for the errexit
case it would not be sufficient to make the final command return 0.

During shell startup errexit is ignored in /etc/zsh/zshrc.  I don't
know whether the exit status of /etc/zsh/zshrc could matter.
I also don't know why anybody would source /etc/zsh/zshenv, but
appending '|| :' just in case someone does seems to be sensible.

Could anybody with commit access please replace the old unalias line
with one of lines below?

    unalias -m 'run-help' || :
    unalias -m 'run-help' || true
    unalias -m run-help || :
    unalias -m run-help || true

This bug actually is about the bindkey stuff we don't agree on, and
I don't consider this robustness fixes to sufficient to close the bug
(YMMV and you are free close this bug anyway).  Maybe it could be tagged
as wontfix to document that we don't agree currently.


Carsten



More information about the Pkg-zsh-devel mailing list