ash: fail if 'shift' operand is out of range
authorIngo van Lil <inguin@gmx.de>
Fri, 5 Jan 2018 14:04:23 +0000 (15:04 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 7 Jan 2018 13:22:38 +0000 (14:22 +0100)
commit9c8e94bc0a3836dd6b8acbcf1fa88283a0a3c148
tree9f07ea59974e3863edef50f1a01047de729b2e3d
parent6f4a785bd1bd0e6973b5c27b34b86655b1d7a602
ash: fail if 'shift' operand is out of range

If the numeric argument passed to ash's 'shift' built-in is greater than
'$#' the command performs no operation and exits successfully. It should
return a non-zero exit code instead:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#shift

This is consistent with bash and hush.

function                                             old     new   delta
shiftcmd                                             122     120      -2

Signed-off-by: Ingo van Lil <inguin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c