[Pkg-zsh-devel] Bug#622806: zsh: unset SHLVL not propertly propagated over exec

Andrew Pimlott andrew at pimlott.net
Thu Apr 14 18:50:55 UTC 2011


Package: zsh
Version: 4.3.11-4
Severity: normal

It seems that if you unset the SHLVL environment variable, the SHLVL is
not properly propagated over exec:

    % zsh
    % echo $SHLVL
    2
    % unset SHLVL
    % echo $SHLVL

    % perl -e 'print "$ENV{SHLVL}\n"'

    % exec perl -e 'print "$ENV{SHLVL}\n"'
    1

The last line is unexpeced.  In bash, it is 0.  zsh must be caching
SHLVL for some special handling during exec; but the cache is not
updated by unset.  If you set SHLVL explicitly, things are as expected
(at least this is the same as bash):

    % zsh
    % SHLVL=9
    % echo $SHLVL
    9
    % perl -e 'print "$ENV{SHLVL}\n"'
    9
    % exec perl -e 'print "$ENV{SHLVL}\n"'
    8

Andrew

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.38-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages zsh depends on:
ii  libc6                         2.11.2-11  Embedded GNU C Library: Shared lib
ii  libcap2                       1:2.20-1   support for getting/setting POSIX.
ii  libncursesw5                  5.9-1      shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libc6                         2.11.2-11  Embedded GNU C Library: Shared lib
ii  libpcre3                      8.12-3     Perl 5 Compatible Regular Expressi

Versions of packages zsh suggests:
ii  zsh-doc                       4.3.11-4   zsh documentation - info/HTML form

-- debconf information:
  zsh/rcmove:





More information about the Pkg-zsh-devel mailing list