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]>
Having finally managed to codesign Gdb!

On macOS Sonoma 14.7.4 (intel) mv starts as on PPC Tiger. It reaches lines #457 and #459, but "target_dirfd_valid (fd)" delivers here FALSE, deduced from the fact that line #478 gets executed with errno presumingly 20 (on line #480 I can print err, which gives this value). x.rename_errno from line #454 is 17, as on PPC Tiger.

   457       if (x.rename_errno != 0)
   458         {
   459           int fd = target_directory_operand (lastfile, &sb);
   460           if (target_dirfd_valid (fd))
   461             {
   462               x.rename_errno = -1;
   463               target_dirfd = fd;
   464               target_directory = lastfile;
   465               n_files--;
   466             }
   467           else
   468             {
   469               /* The last operand LASTFILE cannot be opened as a directory.
   470                  If there are more than two operands, report an error.
   471  
   472                  Also, report an error if LASTFILE is known to be a directory
   473                  even though it could not be opened, which can happen if
   474                  opening failed with EACCES on a platform lacking O_PATH.
   475                  In this case use stat to test whether LASTFILE is a
   476                  directory, in case opening a non-directory with (O_SEARCH
   477                  | O_DIRECTORY) failed with EACCES not ENOTDIR.  */
   478               int err = errno;
   479               if (2 < n_files
   480                   || (O_PATHSEARCH == O_SEARCH && err == EACCES
   481                       && (sb.st_mode != 0 || stat (lastfile, &sb) == 0)
   482                       && S_ISDIR (sb.st_mode)))
   483                 error (EXIT_FAILURE, err, _("target %s"), quoteaf (lastfile));
   484             }
   485         }

n_files is 2, EACCES is presumingly 13 (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/errno.h:101, /* Permission denied */) – the others I cannot tell (O_PATHSEARCH does not seem to exist, O_SEARCH  is (O_EXEC | O_DIRECTORY)). The error() function is not executed and line #485 (no visible text output, cursor jumps over line #483) reached.

On line #519 target_directory is still 0x0, so

   537           ok &= do_move (source, dest, target_dirfd, dest_relname, &x);

is reached and job done correctly:

	pete 289 /\ ./ls -l k out
	ls: Zugriff auf 'k' nicht möglich: No such file or directory
	-rw-r--r-- 1 pete admin 0 23. Mai 15:38 out
	Exit 2

Interestingly the output is so polyglot…


So presumingly it's not renameatu() but rather lib/targetdir.c:61:target_directory_operand (char const *file, struct stat *st) that is faulty…


OK, I'll try to continue a bit today!

--

Greetings

  Pete

If the majority of cooking accidents happen in the kitchen, then why don't we just cook in other rooms?
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.