Package: dash
Version: 0.5.5.1-7.4
Severity: normal

Hi.

IMHO the shift built-in behaves incorrectly.
Take an example shell script like this:
#!/bin/sh
echo foo
shift 99999
echo bar

In case 99999 > $# the shell scripts aborts.
POSIX' definition of shift 
(http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#shift)
however does not say that the shell should abort.
It only says that the exit status (of the built-in) is > 0 in that case
and that stderr might be used for diagnostic messagses.

This bugs makes it impossible to e.g. process the positional parameters
like this:
while shift 1 2> /dev/null ; do
        domeSomethingWith $1
done


Cheers,
Chris.




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

Kernel: Linux 2.6.39-heisenberg (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_DE.utf8, LC_CTYPE=en_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dash depends on:
ii  debianutils                   4          Miscellaneous utilities specific t
ii  dpkg                          1.16.0.3   Debian package management system
ii  libc6                         2.13-4     Embedded GNU C Library: Shared lib

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true



-- 
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