Created attachment 8741 [details] related build .config Notice scripts execution failures after upgrading busybox from 1.31 to 1.32 on an armv7a router device e.g. running "try.sh" as example: #!/bin/sh # write what u want as params... func() { echo '$#': $# echo '$*': $* echo \"'$@'\": \"$@\" } echo '$#': $# echo '$*': $* echo \"'$@'\": \"$@\" func "$@" exit $? invoking above: ./try.sh one two three four five obtaining: $#: 5 $*: onetwothreefourfive "$@": "onetwothreefourfive" $#: 1 $*: onetwothreefourfive "$@": "onetwothreefourfive" busybox 1.30.1 --> above working busybox 1.31.1 --> above working busybox 1.32.0 --> above NOT working busybox 1.32.1 --> above NOT working removed all external code patches .config attached
Created attachment 8746 [details] .config
Created attachment 8751 [details] tryout script test
Further investigations reveal that: The issue also affects busybox 1.33.0 ; The issue is confirmed to be related to ./shell/ash.c (regressing to old 1.31.1 ash.c only, code issue is not present); The issue seems to affect $* and $@ positional parameters only: $#, $0, $1, $2 ... are correct.
Created attachment 8766 [details] ash_all_arguments_patch Found a possible solution: probably an unary operator on memtodest() caused to skip blank separator.
Can't reproduce on 1.32.0 Tried in i386 with only this chage to your config: -CONFIG_CROSS_COMPILER_PREFIX="arm-unknown-linux-uclibcgnueabi-" +CONFIG_CROSS_COMPILER_PREFIX="i486-linux-uclibc-" CONFIG_SYSROOT="" -CONFIG_EXTRA_CFLAGS="-marm -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -pipe -funit-at-a-time -fomit-frame-pointer -ffixed-r8 -fno-common -mno-thumb-interwork -mabi=aapcs-linux -mfloat-abi=soft" +CONFIG_EXTRA_CFLAGS="" CONFIG_EXTRA_LDFLAGS="" CONFIG_EXTRA_LDLIBS="" # CONFIG_USE_PORTABLE_CODE is not set -# CONFIG_STACK_OPTIMIZATION_386 is not set +CONFIG_STACK_OPTIMIZATION_386=y and the bug does not reproduce. Can you reproduce it on a x86 machine, or does it seem to be armv7-a specific?
The bug has been discovered into arm machine (crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL) while the same config applied on x86_64 config doesn't reveal any issue, with or without the patch proposed.
I don't have armv7 cross-compiler handy. With CONFIG_EXTRA_CFLAGS="-marm -march=armv5 -pipe -funit-at-a-time -fomit-frame-pointer -ffixed-r8 -fno-common -mno-thumb-interwork -mabi=aapcs-linux -mfloat-abi=soft" compiled with $ gcc -v ccwrap: /usr Using built-in specs. Target: armv5l-unknown-linux-gnueabi Configured with: /home/landley/aboriginal/aboriginal/build/temp-armv5l/gcc-core/configure --target=armv5l-unknown-linux-gnueabi --prefix=/home/landley/aboriginal/aboriginal/build/native-compiler-armv5l/usr --disable-multilib --disable-nls --enable-c99 --enable-long-long --enable-__cxa_atexit --enable-languages=c,c++ --disable-libstdcxx-pch --program-prefix= --enable-threads=posix --enable-shared --build=x86_64-walrus-linux --host=armv5l-unknown-linux-gnueabi --with-march=armv5 --with-mfloat-abi=soft --with-mfp=vfp Thread model: posix gcc version 4.2.1 your testcase works for me under qemu.
These are the gcc info: negan07@Debian:~/Desktop$ arm-linux-gcc -v Using built-in specs. COLLECT_GCC=arm-linux-gcc COLLECT_LTO_WRAPPER=/opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL/usr/libexec/gcc/arm-unknown-linux-uclibcgnueabi/4.6.2/lto-wrapper Target: arm-unknown-linux-uclibcgnueabi Configured with: /home/negan07/Desktop/test/crosstools-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-sources/src/buildroot-2011.11/output/toolchain/gcc-4.6.2/configure --prefix=/opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL/usr --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-unknown-linux-uclibcgnueabi --enable-languages=c,c++ --with-sysroot=/opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL/usr/arm-unknown-linux-uclibcgnueabi/sysroot --with-build-time-tools=/opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL/usr/arm-unknown-linux-uclibcgnueabi/bin --disable-__cxa_atexit --enable-target-optspace --disable-libgomp --with-gnu-ld --disable-libssp --disable-multilib --enable-tls --enable-shared --with-gmp=/opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL/usr --with-mpfr=/opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL/usr --with-mpc=/opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL/usr --enable-threads --disable-decimal-float --with-float=soft --with-abi=aapcs-linux --with-arch=armv7-a --with-tune=cortex-a9 --with-pkgversion='Buildroot 2011.11-g1be5af0-dirty' --with-bugurl=http://bugs.buildroot.net/ Thread model: posix gcc version 4.6.2 (Buildroot 2011.11-g1be5af0-dirty) There are some differences: no atexit no mfp in my case but mainly uclibc usage Here's the toolchain's sources if helpful: https://easyupload.io/8qnavi Here's the patches applied https://easyupload.io/mxw2oh
Does it still happen if you replace -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 with -march=armv5 ?
tried same thing, same bug for armv5 in place of -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9