Hi Bruno,

Bruno Haible via GNU coreutils General Discussion <[email protected]>
writes:

> On CentOS 5, I see 3 test failures:
>
> FAIL: tests/fold/fold-zero-width.sh
> FAIL: tests/cp/attr-existing.sh
> FAIL: tests/mv/part-symlink.sh
>
> The fold-zero-width failure is reported in another mail. Here's the log for
> the other two failures.

Here is where the 'cp' and 'mv' tests fail:

    + cp -a --remove-destination --attributes-only sym1 file2
    cp: preserving times for 'file2': Function not implemented
    + fail=1
    [...]
    + diff -u expected actual
    --- expected        2025-09-18 12:09:15.000000000 +0200
    +++ actual  2025-09-18 12:09:15.000000000 +0200
    @@ -87,12 +87,14 @@
      [mv: 'rem_sl' and 'loc_reg' are the same file]
      (loc_reg) (rem_sl -> dir/loc_reg)
     0 mv -b rem_sl loc_reg
    + [mv: preserving times for 'loc_reg': Function not implemented]
      (loc_reg -> dir/loc_reg loc_reg~) ()
     
     1 mv loc_sl rem_reg
      [mv: 'loc_sl' and 'rem_reg' are the same file]
      (loc_sl -> rem_reg) (rem_reg)
     0 mv -b loc_sl rem_reg
    + [mv: preserving times for 'rem_reg': Function not implemented]
      () (rem_reg -> rem_reg rem_reg~)
     
     0 mv rem_reg loc_sl
    + fail=1

Here is the kernel version:

    System information (uname -a): Linux 2.6.18-308.24.1.el5 #1 SMP Tue Dec 4 
17:43:34 EST 2012 x86_64 x86_64 x86_64
    Distribution information (/etc/issue):
    CentOS release 5.8 (Final)

These errors occur after utimensat fails. Based on the man page,
utimensat was added in 2.6.22 [1]. So we are almost certainly using the
Gnulib replacement.

In the failing test we are copying/moving a symlink and then trying to
preserve its timestamps using utimensat. Based on that information, I
assume that this limitation in the utimensat replacement applies on this
platform [2]:

    On some platforms, timestamps of symbolic links cannot be modified,
    so the replacement fails with ENOSYS if passed the flag
    AT_SYMLINK_NOFOLLOW on a symlink.

It is under "Portability problems not fixed by Gnulib", but is lacking a
list of platforms. Do you remember if this applies to old Linux
versions? It was written in 2009, so no problem if not.

If I am correct, then I think it is fine to just skip the test if
grep'ing stderr finds "Function not implemented". I don't see a
reasonable workaround. It wouldn't prevent you from copying symlinks,
only setting the timestamps. So not the end of the world, IMO.

Collin

[1] https://man7.org/linux/man-pages/man2/utimensat.2.html
[2] https://www.gnu.org/software/gnulib/manual/gnulib.html#utimensat

Reply via email to