Subject: bug#29886: tests/rm/rm-readdir-fail is failing with SIGBUS on Gentoo sparc

From: Thomas Deutschmann <[email-masked]>
Date: Fri, 29 Dec 2017 03:39:47 +0100

Hi,

a Gentoo SPARC user is reporting that tests/rm/rm-readdir-fail is failing with SIGBUS
in coreutils-8.28 and coreutils-8.29:

> FAIL: tests/rm/rm-readdir-fail
> ==============================
> 
> ++ initial_cwd_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29
> +++ testdir_prefix_
> +++ printf gt
> ++ pfx_=gt
> +++ mktempd_ /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29 gt-rm-readdir-fail.sh.XXXX
> +++ case $# in
> +++ destdir_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29
> +++ template_=gt-rm-readdir-fail.sh.XXXX
> +++ MAX_TRIES_=4
> +++ case $destdir_ in
> +++ destdir_slash_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/
> +++ case $template_ in
> ++++ unset TMPDIR
> +++ d=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> +++ case $d in
> +++ :
> +++ test -d /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> ++++ ls -dgo /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> +++ perms='drwx------ 2 4096 Dec 28 10:54 /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN'
> +++ case $perms in
> +++ :
> +++ echo /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> +++ return
> ++ test_dir_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> ++ cd /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> ++ gl_init_sh_nl_='
> '
> ++ IFS=' 	
> '
> ++ for sig_ in 1 2 3 13 15
> +++ expr 1 + 128
> ++ eval 'trap '\''Exit 129'\'' 1'
> +++ trap 'Exit 129' 1
> ++ for sig_ in 1 2 3 13 15
> +++ expr 2 + 128
> ++ eval 'trap '\''Exit 130'\'' 2'
> +++ trap 'Exit 130' 2
> ++ for sig_ in 1 2 3 13 15
> +++ expr 3 + 128
> ++ eval 'trap '\''Exit 131'\'' 3'
> +++ trap 'Exit 131' 3
> ++ for sig_ in 1 2 3 13 15
> +++ expr 13 + 128
> ++ eval 'trap '\''Exit 141'\'' 13'
> +++ trap 'Exit 141' 13
> ++ for sig_ in 1 2 3 13 15
> +++ expr 15 + 128
> ++ eval 'trap '\''Exit 143'\'' 15'
> +++ trap 'Exit 143' 15
> ++ trap remove_tmp_ 0
> + path_prepend_ ./src
> + test 1 '!=' 0
> + path_dir_=./src
> + case $path_dir_ in
> + abs_path_dir_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/./src
> + case $abs_path_dir_ in
> + PATH=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/./src:/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/src:/var/tmp/portage/sys-apps/coreutils-8.29/temp/mount-wrappers:/var/tmp/portage/sys-apps/coreutils-8.29/temp/python3.5/bin:/usr/lib/portage/python3.5/ebuild-helpers/xattr:/usr/lib/portage/python3.5/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/sparc-unknown-linux-gnu/gcc-bin/6.4.0
> + create_exe_shims_ /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/./src
> + case $EXEEXT in
> + return 0
> + shift
> + test 0 '!=' 0
> + export PATH
> + print_ver_ rm
> + require_built_ rm
> + skip_=no
> + for i in '"$@"'
> + case " $built_programs " in
> + test no = yes
> + test yes = yes
> + local i
> + for i in '$*'
> + env rm --version
> rm (GNU coreutils) 8.29
> Packaged by Gentoo (8.29 (p1.0))
> Copyright (C) 2017 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
> and Jim Meyering.
> + require_gcc_shared_
> + gcc_shared_ - d.so -xc
> + local in=-
> + local out=d.so
> + shift 2
> + sparc-unknown-linux-gnu-gcc -Wall -shared --std=gnu99 -fPIC -O2 -xc - -o d.so -ldl
> + rm -f d.so
> + mkdir -p dir/notempty
> + cat
> + gcc_shared_ k.c k.so
> + local in=k.c
> + local out=k.so
> + shift 2
> + sparc-unknown-linux-gnu-gcc -Wall -shared --std=gnu99 -fPIC -O2 k.c -o k.so -ldl
> + export READDIR_PARTIAL
> + for READDIR_PARTIAL in ''\'''\''' ''\''1'\'''
> + rm -f preloaded
> + export LD_PRELOAD=libsandbox.so:./k.so
> + LD_PRELOAD=libsandbox.so:./k.so
> + returns_ 1 rm -Rf dir
> + test -f preloaded
> + for READDIR_PARTIAL in ''\'''\''' ''\''1'\'''
> + rm -f preloaded
> + export LD_PRELOAD=libsandbox.so:./k.so
> + LD_PRELOAD=libsandbox.so:./k.so
> + returns_ 1 rm -Rf dir
> + fail=1
> + test -f preloaded
> + cat
> + sed 's/\(rm:.*\):.*/\1/' errt
> + compare exp err
> + compare_dev_null_ exp err
> + test 2 = 2
> + test xexp = x/dev/null
> + test xerr = x/dev/null
> + return 2
> + case $? in
> + compare_ exp err
> + diff -u exp err
> --- exp	2017-12-28 10:54:33.403337960 +0100
> +++ err	2017-12-28 10:54:33.423337960 +0100
> @@ -1,2 +1,2 @@
>  rm: cannot remove 'dir'
> -rm: traversal failed: dir
> +./tests/init.sh: line 118:  9012 Bus error               "$@"
> + fail=1
> + Exit 1
> + set +e
> + exit 1
> + exit 1
> + remove_tmp_
> + __st=1
> + cleanup_
> + :
> + test '' = yes
> + cd /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29
> + chmod -R u+rwx /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> + rm -rf /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> + exit 1
> FAIL tests/rm/rm-readdir-fail.sh (exit status: 1)

System details:

> Portage 2.3.13 (python 3.5.4-final-0, default/linux/sparc/17.0, gcc-6.4.0, glibc-2.25-r9, 4.14.8-gentoo-r1 sparc64)
> =================================================================
>                          System Settings
> =================================================================
> System uname: Linux-4.14.8-gentoo-r1-sparc64-sun4v-with-gentoo-2.3
> KiB Mem:    33133552 total,  21139472 free
> KiB Swap:          0 total,         0 free
> Timestamp of repository gentoo: Thu, 28 Dec 2017 01:15:01 +0000
> Head commit of repository gentoo: dbbcaa80af14ec02c8eba29c56f946886b192845
> sh bash 4.3_p48-r1
> ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
> app-shells/bash:          4.3_p48-r1::gentoo
> dev-lang/perl:            5.24.3::gentoo
> dev-lang/python:          2.7.14-r1::gentoo, 3.4.5::gentoo, 3.5.4-r1::gentoo
> dev-util/cmake:           3.8.2::gentoo
> dev-util/pkgconfig:       0.29.2::gentoo
> sys-apps/baselayout:      2.3::gentoo
> sys-apps/openrc:          0.34.11::gentoo
> sys-apps/sandbox:         2.10-r4::gentoo
> sys-devel/autoconf:       2.69::gentoo
> sys-devel/automake:       1.15.1-r1::gentoo
> sys-devel/binutils:       2.29.1-r1::gentoo
> sys-devel/gcc:            6.4.0::gentoo
> sys-devel/gcc-config:     1.8-r1::gentoo
> sys-devel/libtool:        2.4.6-r3::gentoo
> sys-devel/make:           4.2.1::gentoo
> sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
> sys-libs/glibc:           2.25-r9::gentoo

Bug: https://bugs.gentoo.org/642492

-- 
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5