Package: posh
Version: 0.12.5
Severity: normal

Dear Maintainer,

In:

[ "$a" -eq "$b" ] or any other numerical comparison operator,
the values of $a and $b are treated as octal if they begin with
0 or hexadecimal if they begin with 0x or 0X (and leading blanks
are ignored)

As per POSIX (see point 6 at
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_01)
those numbers should be treated as decimal

The behaviour would be unspecified for values like 0x123, or
" 123" since those are not decimal integer numbers, so posh
behaviour is not incorrect there. But as per posh's mission to
help write portable scripts it would be useful to report an
error for those (0x123 causes an error in most other shells and
is considered as 0 in AT&T ksh. " 123" causes an error in
FreeBSD sh).

In the case of

[ 010 -eq 10 ] though, the behaviour of posh is incorrect since
010 is a valid decimal number that is equal to 10, so that test
should return true, not false as it currently does.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'stable-updates'), (500, 
'testing'), (500, 'stable'), (500, 'oldstable'), (50, 'unstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.1.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages posh depends on:
ii  debconf [debconf-2.0]  1.5.57
ii  libc6                  2.19-20

posh recommends no packages.

posh suggests no packages.

-- debconf information:
* posh/sh: false

Reply via email to