Package: posh
Version: 0.13.2
Severity: normal

If a posh script uses the nounset option (set -o nounset or set -u)
posh can not handle "$@" if no args are given ($# = 0)


To show the problem a test script t1 can be prepared:

bs@sid:~$ cat <<'END' >t1
> set -u
> f1() { echo "number of args $#"; }
> f1 "$@"
> END
bs@sid:~$ chmod 755 t1


In the following tests every shell will output as expected: number of args 2

bs@sid:~$ posh ./t1 "one two" three
number of args 2
bs@sid:~$ bash ./t1 "one two" three
number of args 2
bs@sid:~$ dash ./t1 "one two" three
number of args 2
bs@sid:~$ busybox sh ./t1 "one two" three
number of args 2
bs@sid:~$ mksh ./t1 "one two" three
number of args 2


In the following tests posh will output: ./t1:3: @: parameter not set
instead of the expected: number of args 0

bs@sid:~$ posh ./t1
./t1:3: @: parameter not set
bs@sid:~$ bash ./t1
number of args 0
bs@sid:~$ dash ./t1
number of args 0
bs@sid:~$ busybox sh ./t1
number of args 0
bs@sid:~$ mksh ./t1
number of args 0


-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages posh depends on:
ii  debconf [debconf-2.0]  1.5.69
ii  libc6                  2.27-8

posh recommends no packages.

posh suggests no packages.

-- debconf information:
  posh/sh: false

Reply via email to