Package: command-not-found
Version: 0.2.38-1
Severity: normal

Julian,

I've found a little issue when using command-not-found with ZSH and set -o
nounset (set -u): when $? is false, the function cnf_precmd in
/etc/zsh_command_not_found is trying to use an undefined variable each time I
validate the prompt without issuing any command, example :

11:29PM home:~% set -u
11:30PM home:~% false
[1] 11:30PM home:~% 
cnf_precmd:1: cnf_command: parameter not set 
[1] 11:30PM home:~% 
cnf_precmd:1: cnf_command: parameter not set 
[1] 11:30PM home:~% 
cnf_precmd:1: cnf_command: parameter not set 
[1] 11:30PM home:~% 
cnf_precmd:1: cnf_command: parameter not set 
[1] 11:30PM home:~% 
cnf_precmd:1: cnf_command: parameter not set 
[1] 11:30PM home:~% 

But when $? goes back to true, everything works fine again:

[1] 11:33PM home:~% true
11:33PM home:~% 
11:33PM home:~% 
11:33PM home:~% 
11:33PM home:~% 

I have 'set -u' in my ~/.zshrc to avoid errors like "rm -rf /$undef" so this
behaviour happens quite often to me.

Would it be possible to check if $cnf_command is defined before using it?

Regards,

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages command-not-found depends on:
ii  apt-file        2.5.1
ii  lsb-release     4.1+Debian9
ii  python          2.7.3-4
ii  python-gdbm     2.7.3-1
ii  python-support  1.0.15

command-not-found recommends no packages.

command-not-found suggests no packages.

-- no debconf information
-- 
 ,''`.
: :' :      Cyril Bouthors
`. `'         Debian.org
  `-


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to