bug#78509: Coreutils' mv and cp 9.5 do not work properly on old PPC Mac OS X 10.4.11, Tiger

Peter Dyballa via GNU coreutils Bug Reports <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
Hello Pádraig!

Yesterday coreutils did not build because of use of -O0 instead of -Os before. This morning I am using simply -O, and the tests stop at the test after existing-perm-dir.sh (last line in build log), which is existing-perm-race.sh.

coreutils-9.7/tests/cp has:

	-rw-r--r-- 1 macports admin  6687 23. Mai 09:03 existing-perm-race.log
	-rw-r--r-- 1 macports admin  6194 23. Mai 09:03 existing-perm-dir.log
	-rw-r--r-- 1 macports admin    82 23. Mai 09:03 existing-perm-dir.trs
	-rw-r--r-- 1 macports admin  6004 23. Mai 09:03 dir-vs-file.log
	-rw-r--r-- 1 macports admin    82 23. Mai 09:03 dir-vs-file.trs
	...
	-rw-r--r-- 1 macports admin  7745 23. Mai 08:40 link-heap.log
	-rw-r--r-- 1 macports admin    83 23. Mai 08:40 link-heap.trs
	-rwxr-xr-x 1 macports admin  2882 23. Mai 08:21 existing-perm-race.sh
	-rwxr-xr-x 1 macports admin  1736 23. Mai 08:21 file-perm-race.sh
	-rwxr-xr-x 1 macports admin  1406 20. Jan 16:16 symlink-slash.sh
	-rwxr-xr-x 1 macports admin  3477  7. Jan 18:31 cp-i.sh
	-rwxr-xr-x 1 macports admin  1639  7. Jan 13:36 abuse.sh

which indicates that existing-perm-race.sh and file-perm-race.sh have been patched, as the compile log also indicates:

	patch phase started at Fri May 23 08:21:43 CEST 2025
	Executing org.macports.patch (coreutils-devel)
	--->  Applying patches to coreutils-devel
	--->  Applying patch-tests_cp_existing-perm-race.sh.diff



I observed an unpleasant behaviour of 'make check': When it's killed coreutils-9.7/tests/cp/existing-perm-race.log just vanishes. Is there a way to keep that "unfinished" log file, in order to find in it a possible clue for some misbehaviour?

The test log contains a complaint (?) about not knowing the local file systems – they are:

	Filesystem     Type  1K-blocks     Used Available Use% Mounted on
	/dev/disk0s7   hfs    53515952 42970824  10289128  81% /
	devfs          devfs         1        1         0 100% /dev
	fdesc          fdesc         1        1         0 100% /dev
	<volfs>        volfs       512      512         0 100% /.vol
	/dev/disk0s3   hfs    18852212 14069028   4783184  75% /Volumes/BSD-Linux
	/dev/disk0s5   hfs    65678668 57482724   8195944  88% /Volumes/Leopard
	/dev/disk0s9   hfs    17719744 15903256   1816488  90% /Volumes/Halde

See attached existing-perm-race.log and patched existing-perm-race.sh!

--

Greetings

  Pete

"When you breathe, you inspire. When you do not breathe, you expire."
existing-perm-race.log (application/octet-stream, 6.5 KB)
++ initial_cwd_=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7 gt-existing-perm-race.sh.XXXX
+++ destdir_=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7
+++ template_=gt-existing-perm-race.sh.XXXX
+++ MAX_TRIES_=4
+++ destdir_slash_=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/
++++ unset TMPDIR
+++ d=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/gt-existing-perm-race.sh.qwri
+++ :
+++ test -d /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/gt-existing-perm-race.sh.qwri
++++ ls -dgo /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/gt-existing-perm-race.sh.qwri
+++ perms=drwx------ 2 68 May 23 09:53 /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/gt-existing-perm-race.sh.qwri
+++ :
+++ echo /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/gt-existing-perm-race.sh.qwri
+++ return
++ test_dir_=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/gt-existing-perm-race.sh.qwri
++ cd /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/gt-existing-perm-race.sh.qwri
++ srcdir=../.
++ builddir=..
++ export srcdir builddir
++ gl_init_sh_nl_=

++ IFS= 	

+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
++ saved_IFS= 	

++ IFS=:
++ new_PATH=
++ IFS= 	

++ test -d /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src/.
++ new_PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src
++ IFS= 	

++ test -d /opt/local/bin/.
++ new_PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin
++ IFS= 	

++ test -d /opt/local/sbin/.
++ new_PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin:/opt/local/sbin
++ IFS= 	

++ test -d /bin/.
++ new_PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin:/opt/local/sbin:/bin
++ IFS= 	

++ test -d /sbin/.
++ new_PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin:/opt/local/sbin:/bin:/sbin
++ IFS= 	

++ test -d /usr/bin/.
++ new_PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin
++ IFS= 	

++ test -d /usr/sbin/.
++ new_PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
++ IFS= 	

++ PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
++ export PATH
++ trap remove_tmp_ EXIT
+ path_prepend_ ./src
+ test 1 '!=' 0
+ path_dir_=./src
+ abs_path_dir_=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/./src
+ PATH=/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/./src:/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/src:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+ create_exe_shims_ /opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-Ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/./src
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ print_ver_ cp
+ require_built_ cp
+ skip_=no
+ test no = yes
+ test yes = yes
+ local i
+ env cp --version
cp (GNU coreutils) 9.7
Copyright (C) 2025 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 Torbjorn Granlund, David MacKenzie, and Jim Meyering.
+ require_membership_in_two_groups_
+ test 0 = 0
+ groups=
+ test -z ''
+ groups=502
+ test -z 502
+ groups=502 
+ groups=502 262
+ test -z '502 262'
+ groups=502 262 
+ groups=502 262 2
+ test -z '502 262 2'
+ groups=502 262 2 
+ groups=502 262 2 3
+ test -z '502 262 2 3'
+ groups=502 262 2 3 
+ groups=502 262 2 3 4
+ test -z '502 262 2 3 4'
+ groups=502 262 2 3 4 
+ groups=502 262 2 3 4 29
+ test -z '502 262 2 3 4 29'
+ groups=502 262 2 3 4 29 
+ groups=502 262 2 3 4 29 5
+ test -z '502 262 2 3 4 29 5'
+ groups=502 262 2 3 4 29 5 
+ groups=502 262 2 3 4 29 5 80
+ test -z '502 262 2 3 4 29 5 80'
+ groups=502 262 2 3 4 29 5 80 
+ groups=502 262 2 3 4 29 5 80 20
+ require_local_dir_
+ require_mount_list_
+ local 'mount_list_fail=cannot read table of mounted file systems'
+ df --local
+ grep -F 'cannot read table of mounted file systems'
+ is_local_dir_ .
+ test 1 = 1
+ df --local .
+ require_no_default_acl_ .
+ getfacl --version
+ ls -ld .
+ grep .........+
+ set _ 502 262 2 3 4 29 5 80 20
+ shift
+ g1=502
+ g2=262
+ umask 077
+ mkfifo_or_skip_ fifo
+ test 1 = 1
+ mkfifo fifo
+ touch fifo-copy
+ chgrp 502 fifo
+ chgrp 262 fifo-copy
+ chmod g+r fifo-copy
+ timeout 60 cp -p --copy-contents fifo fifo-copy
cp: cannot stat 'fifo-copy/fifo': Not a directory
+ pid=10815
existing-perm-race.sh (application/octet-stream, 2.8 KB)
#!/bin/sh
# Make sure cp -p isn't too generous with existing file permissions.

# Copyright (C) 2006-2025 Free Software Foundation, Inc.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ cp

require_membership_in_two_groups_

# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
require_local_dir_

require_no_default_acl_ .

set _ $groups; shift
g1=$1
g2=$2


umask 077
mkfifo_or_skip_ fifo

touch fifo-copy &&
chgrp $g1 fifo &&
chgrp $g2 fifo-copy &&
chmod g+r fifo-copy || framework-failure

# Terminate any background cp process
cleanup_() { kill $pid 2>/dev/null && wait $pid; }

# Copy a fifo's contents.  That way, we can examine the
# destination permissions before they're finalized.
timeout 60 cp -p --copy-contents fifo fifo-copy & pid=$!

(
  # Now 'cp' is reading the fifo.  Wait for the destination file to
  # be written to, encouraging things along by echoing to the fifo.
  while test ! -s fifo-copy; do
    echo foo
  done

  # Check the permissions of the destination.
  ls -l -n fifo-copy >ls.out &&

  # Close the fifo so that "cp" can continue.  But output first,
  # before exiting, otherwise some shells would optimize away the file
  # descriptor that holds the fifo open.
  echo foo
) >fifo || fail=1

# Check that the destination mode is safe while the file is being copied.
read mode links owner group etc <ls.out || fail=1
case $mode in
  -rw-------*) ;;

  # FIXME: Remove the following case; the file mode should always be
  # 600 while the data are being copied.  This will require changing
  # cp so that it also does not put $g1's data in a file that is
  # accessible to $g2.  This fix will not close a security hole, since
  # a $g2 process can maintain an open file descriptor to the
  # destination, but it's safer anyway.
  -rw-r-----*)
    # If the file has group $g1 and is group-readable, that is definitely bogus,
    # as neither the source nor the destination was readable to group $g1.
    test "$group" = "$g1" && fail=1;;

  *) fail=1;;
esac

wait $pid || fail=1

# Check that the final mode and group are right.
ls -l -n fifo-copy >ls.out &&
read mode links owner group etc <ls.out || fail=1
case $mode in
  -rw-------*) test "$group" = "$g1" || fail=1;;
  *) fail=1;;
esac

Exit $fail
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.