Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2 uname output: Linux dirac.s-z.org 2.6.26-1-openvz-686 #1 SMP Wed Sep 10 19:04:44 UTC 2008 i686 GNU/Linux Machine Type: i686-pc-linux-gnu
Bash Version: 4.0 Patch Level: 33 Release Status: release Description: The expansion "${@:0:n}" should be $0 followed by the first n-1 positional parameters, but is instead $0 followed by the first n-2 positional parameters. This behavior is different from ksh93 and seems nonsensical and unintentional. Repeat-By: set -- a b c d echo "${@:0:3}" # prints "bash a"; should be "bash a b" Fix: Apply the following patch. The important effects are on the behaviour of the following loop (params && i < end), which without the patch is iterating one time too few. diff -ur bash-4.0/subst.c bash-4.0-fixed/subst.c --- ../bash-4.0/subst.c 2009-07-22 19:15:52.472737094 -0400 +++ subst.c 2009-07-22 19:13:48.316733546 -0400 @@ -2739,7 +2739,7 @@ save = params = t; } - for (i = 1; params && i < start; i++) + for (i = start ? 1 : 0; params && i < start; i++) params = params->next; if (params == 0) return ((char *)NULL);