Subject: Re: bug#18896: regressions in coreutils 8.23 on Yosemite

From: Jack Howarth <[email-masked]>
Date: Thu, 30 Oct 2014 23:30:55 -0400

On Fri, Oct 31, 2014 at 02:29:05AM +0000, Pádraig Brady wrote:
> On 10/30/2014 06:24 PM, Jack Howarth wrote:
> > On Thu, Oct 30, 2014 at 12:01:17AM +0000, Pádraig Brady wrote:
> >> On 10/29/2014 11:13 PM, Jack Howarth wrote:
> >>>    I am finding that the single failure seen on Mavericks for the 
> >>> coreutils 8.23 testsuite...
> >>>
> >>> FAIL: test-getcwd.sh
> >>>
> >>> =====================================================
> >>>    GNU coreutils 8.23: gnulib-tests/test-suite.log
> >>> =====================================================
> >>
> >> The above gnulib issue may occur on Yosemite too but was not run
> >> due to the new failures below
> >>
> >>> when run as sudo, is replaced by two new errors and two new failures
> >>> under Yosemite as sudo.
> >>>
> >>> ERROR: tests/cp/link-deref.sh
> >>> FAIL: tests/cp/link-no-deref.sh
> >>>
> >>> FAIL: tests/cp/link-symlink.sh
> >>>
> >>> ERROR: tests/ln/hard-to-sym.sh
> >>>
> >>> ============================================================================
> >>> Testsuite summary for GNU coreutils 8.23
> >>> ============================================================================
> >>> # TOTAL: 563
> >>> # PASS:  397
> >>> # SKIP:  162
> >>> # XFAIL: 0
> >>> # FAIL:  2
> >>> # XPASS: 0
> >>> # ERROR: 2
> >>
> >> All these failures and errors are due to trying to create
> >> a hardlink to a symlink and getting an "Operation not supported" error.
> >>
> >> Can you send the output of this command?
> >>   $ grep -E "(LINK_F|LINKAT)" lib/config.h
> > 
> > On x86_64-apple-darwin13 which doesn't show these failures, I see...
> > 
> > #define GNULIB_AREADLINKAT 1
> > #define GNULIB_TEST_LINKAT 1
> > #define GNULIB_TEST_READLINKAT 1
> > #define GNULIB_TEST_SYMLINKAT 1
> > #define GNULIB_TEST_UNLINKAT 1
> > /* #undef HAVE_LINKAT */
> > /* #undef HAVE_READLINKAT */
> > /* #undef HAVE_SYMLINKAT */
> > /* #undef HAVE_UNLINKAT */
> > /* #undef LINKAT_TRAILING_SLASH_BUG */
> > #define LINK_FOLLOWS_SYMLINKS 1
> > 
> > whereas on x86_64-apple-darwin14, I get...
> > 
> > #define GNULIB_AREADLINKAT 1
> > #define GNULIB_TEST_LINKAT 1
> > #define GNULIB_TEST_READLINKAT 1
> > #define GNULIB_TEST_SYMLINKAT 1
> > #define GNULIB_TEST_UNLINKAT 1
> > #define HAVE_LINKAT 1
> > #define HAVE_READLINKAT 1
> > #define HAVE_SYMLINKAT 1
> > #define HAVE_UNLINKAT 1
> > /* #undef LINKAT_TRAILING_SLASH_BUG */
> > #define LINK_FOLLOWS_SYMLINKS 1
> > 
> >>
> >> What file system type are you running this one?
> > 
> > Both filesystems are
> > 
> >    File System Personality:  Journaled HFS+
> >    Type (Bundle):            hfs
> >    Name (User Visible):      Mac OS Extended (Journaled)
> >    Journal:                  Journal size 81920 KB at offset 0x1d1c000
> >    Owners:                   Enabled
> > 
> >>
> >> I suspect that this might help?
> >>
> >> diff --git a/lib/linkat.c b/lib/linkat.c
> >> index 6ee30fb..fd6bd1c 100644
> >> --- a/lib/linkat.c
> >> +++ b/lib/linkat.c
> >> @@ -329,7 +329,8 @@ rpl_linkat (int fd1, char const *file1, int fd2, char const *file2, int flag)
> >>      if (0 <= have_follow_really)
> >>      {
> >>        int result = linkat (fd1, file1, fd2, file2, flag);
> >> -      if (!(result == -1 && errno == EINVAL))
> >> +      if (!(result == -1 && (errno == EINVAL || errno == ENOTSUP
> >> +                             || errno == EOPNOTSUPP)))
> >>          {
> >>            have_follow_really = 1;
> >>            return result;
> > 
> > Unfortunately, with this patch, I still see the failures on x86_64-apple-darwin14.
> 
> Ah right, that code path is only for older Linux kernels
> with AT_SYMLINK_FOLLOW specified, which is not the case here.
> Please drop this patch.
> 
> > link-deref.sh: set-up failure: 
> > ERROR: tests/cp/link-deref.sh
> > FAIL: tests/cp/link-no-deref.sh
> > FAIL: tests/cp/link-symlink.sh
> > hard-to-sym.sh: set-up failure: 
> > ERROR: tests/ln/hard-to-sym.sh
> 
> So linkat() is now available but doesn't support hardlinks to symlinks
> contrary to the POSIX spec. So it would be best we consider linkat()
> unavailable, which can be done manually like:
> 
>   ac_cv_func_linkat=no ./configure
> 
> We'll have to augment the gnulib linkat check to actually check
> that linkat() works, rather than just being available.

Passing ac_cv_func_linkat=no to configure and using your attached patch
results in a large number of failures on x86_64-apple-darwin14.

../build-aux/test-driver: line 107: 83817 Abort trap: 6           "$@" > $log_file 2>&1
FAIL: test-futimens

../build-aux/test-driver: line 107: 84551 Abort trap: 6           "$@" > $log_file 2>&1
FAIL: test-readlinkat

../build-aux/test-driver: line 107: 83516 Abort trap: 6           "$@" > $log_file 2>&1
FAIL: test-fdutimensat

../build-aux/test-driver: line 107: 84928 Abort trap: 6           "$@" > $log_file 2>&1
FAIL: test-symlinkat

../build-aux/test-driver: line 107: 85151 Abort trap: 6           "$@" > $log_file 2>&1
FAIL: test-unlinkat

../build-aux/test-driver: line 107: 85185 Abort trap: 6           "$@" > $log_file 2>&1
FAIL: test-utimens

=====================================================
   GNU coreutils 8.23: gnulib-tests/test-suite.log
=====================================================

# TOTAL: 306
# PASS:  288
# SKIP:  12
# XFAIL: 0
# FAIL:  6
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: test-fdutimensat
======================

./test-utimens.h:113: assertion 'st3.st_atime == Y2K' failed

FAIL: test-futimens
===================

./test-futimens.h:112: assertion 'st1.st_atime == st2.st_atime' failed

SKIP: test-getlogin
===================

Skipping test: stdin is not a tty.

SKIP: test-mbrtowc-w32-1.sh
===========================

Skipping test: not a native Windows system

SKIP: test-mbrtowc-w32-2.sh
===========================

Skipping test: not a native Windows system

SKIP: test-mbrtowc-w32-3.sh
===========================

Skipping test: not a native Windows system

SKIP: test-mbrtowc-w32-4.sh
===========================

Skipping test: not a native Windows system

SKIP: test-mbrtowc-w32-5.sh
===========================

Skipping test: not a native Windows system

SKIP: test-mbscasecmp.sh
========================

Skipping test: no turkish Unicode locale is installed

FAIL: test-readlinkat
=====================

./test-readlink.h:71: assertion 'func (BASE "link2/", buf, sizeof buf) == -1' failed

FAIL: test-symlinkat
====================

./test-symlink.h:83: assertion 'func (BASE "nowhere", BASE "link1/") == -1' failed

FAIL: test-unlinkat
===================

./test-unlink.h:49: assertion 'func ("..") == -1' failed

FAIL: test-utimens
==================

./test-futimens.h:112: assertion 'st1.st_atime == st2.st_atime' failed

SKIP: test-wcrtomb-w32-1.sh
===========================

Skipping test: not a native Windows system

SKIP: test-wcrtomb-w32-2.sh
===========================

Skipping test: not a native Windows system

SKIP: test-wcrtomb-w32-3.sh
===========================

Skipping test: not a native Windows system

SKIP: test-wcrtomb-w32-4.sh
===========================

Skipping test: not a native Windows system

SKIP: test-wcrtomb-w32-5.sh
===========================

Skipping test: not a native Windows system

============================================================================
Testsuite summary for GNU coreutils 8.23
============================================================================
# TOTAL: 306
# PASS:  288
# SKIP:  12
# XFAIL: 0
# FAIL:  6
# XPASS: 0
# ERROR: 0
============================================================================

> 
> Attached is an ancillary patch to coreutils to convert the
> Last ERROR above to the more correct FAILs, which you don't need to apply.
> 
> thanks,
> Pádraig.

> >From 0ba224ec5cd102773086137b7097ec91d1538e49 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
> Date: Fri, 31 Oct 2014 02:25:02 +0000
> Subject: [PATCH] tests: ln/hard-to-sym FAIL rather than ERROR when ln fails
> 
> * tests/ln/hard-to-sym.sh: Only call framework_failure_ when ln
> returns success.
> ---
>  tests/ln/hard-to-sym.sh |   36 +++++++++++++++++++++---------------
>  1 files changed, 21 insertions(+), 15 deletions(-)
> 
> diff --git a/tests/ln/hard-to-sym.sh b/tests/ln/hard-to-sym.sh
> index 995d3cf..f3ac8ba 100755
> --- a/tests/ln/hard-to-sym.sh
> +++ b/tests/ln/hard-to-sym.sh
> @@ -29,24 +29,30 @@ ln -s -L -P symlink2 symlink3 || fail=1
>  
>  # ===================================================
>  # ensure that -L follows symlinks, and overrides -P
> -ln -P -L symlink3 hard-to-a || fail=1
> -ls=$(ls -lG hard-to-a)x
> -case "$ls" in
> -  *'hard-to-ax') ;;
> -  *'hard-to-a -> '*x) fail=1 ;;
> -  *) framework_failure_ ;;
> -esac
> +if ln -P -L symlink3 hard-to-a; then
> +  ls=$(ls -lG hard-to-a)x
> +  case "$ls" in
> +    *'hard-to-ax') ;;
> +    *'hard-to-a -> '*x) fail=1 ;;
> +    *) framework_failure_ ;;
> +  esac
> +else
> +  fail=1
> +fi
>  
>  # ===================================================
>  # ensure that -P links (or at least duplicates) symlinks, and overrides -L
> -ln -L -P symlink3 hard-to-3 || fail=1
> -ls=$(ls -lG hard-to-3)x
> -case "$ls" in
> -  *'hard-to-3 -> symlink2x') ;;
> -  *'hard-to-3x') fail=1 ;;
> -  *'hard-to-3 -> '*x) fail=1 ;;
> -  *) framework_failure_ ;;
> -esac
> +if ln -L -P symlink3 hard-to-3; then
> +  ls=$(ls -lG hard-to-3)x
> +  case "$ls" in
> +    *'hard-to-3 -> symlink2x') ;;
> +    *'hard-to-3x') fail=1 ;;
> +    *'hard-to-3 -> '*x) fail=1 ;;
> +    *) framework_failure_ ;;
> +  esac
> +else
> +  fail=1
> +fi
>  
>  # ===================================================
>  # Create a hard link to a dangling symlink.
> -- 
> 1.7.7.6
>