bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 4 test failures on freebsd8-rc2


From: Jim Meyering
Subject: Re: 4 test failures on freebsd8-rc2
Date: Tue, 10 Nov 2009 10:14:14 +0100

Jim Meyering wrote:
> Eric Blake wrote:
>> Jim Meyering <jim <at> meyering.net> writes:
>>> If I'd known this was coming so quickly, I would have delayed
>>> making the coreutils snapshot.
>>>
>>> Let me know when you're done: maybe I'll make one more
>>> before the release.
>>
>> At least a couple more to go.  I've confirmed that on FreeBSD:
>>
>> touch f
>> ln -s f l
>> link l/ g
>> unlink l/
>>
>> creates g as a hard link to f, then removes f; both the link and the unlink
>> should have failed, since l/ is not a symlink-to-directory.  Hmm, that means
>> coreutils' testsuite could use more trailing slash tests, so I'll add that to
>> my todo list.  Here's what I'm currently testing on the gnulib side...
>>
>> I also suspect problems in chmod and chown, but have not had time to confirm
>> that yet.
>>
>>>From 120a86a14b534bf24808974967786611f16dc8c0 Mon Sep 17 00:00:00 2001
>> From: Eric Blake <address@hidden>
>> Date: Mon, 9 Nov 2009 10:44:08 -0700
>> Subject: [PATCH 1/2] unlink, remove: detect FreeBSD bug
> ...
>> Subject: [PATCH 2/2] link: detect FreeBSD bug
>
> Both look fine, though I haven't tested at all yet.
> Thanks for the quick work.

I bootstrapped coreutils with that and tested on Fedora 11.
It didn't compile because of this:

    remove.c:32: error: no previous declaration for 'rpl_remove' 
[-Wmissing-declarations]

But obviously it shouldn't even be compiling that file on F11.
Why was it doing that?  Because the new unlink test had failed to
compile, which made it think it needed to replace remove.
Here's the patch you'll need for that:

diff --git a/m4/unlink.m4 b/m4/unlink.m4
index 376e584..444bce9 100644
--- a/m4/unlink.m4
+++ b/m4/unlink.m4
@@ -20,9 +20,9 @@ AC_DEFUN([gl_FUNC_UNLINK],
        [AC_LANG_PROGRAM(
         [[#include <stdio.h>
           #include <errno.h>
-]], [[if (!unlink ("conftest.file/") || errno != ENOTDIR;) return 1;
+]], [[if (!unlink ("conftest.file/") || errno != ENOTDIR) return 1;
 #if HAVE_LSTAT
-      if (!unlink ("conftest.lnk/") || errno != ENOTDIR;) return 2;
+      if (!unlink ("conftest.lnk/") || errno != ENOTDIR) return 2;
 #endif
       ]])],
       [gl_cv_func_unlink_works=yes], [gl_cv_func_unlink_works=no],

Thinking about how to avoid this, I'd sure like a way to tell
autoconf that a particular test is portable enough that when it
fails to *compile*, configure must FAIL.

With the above change, all of the tests passed except two:

First failure was test-link, due to this:

  errno = 0;
  ASSERT (func (BASE "link/", BASE "b") == -1);
  ASSERT (errno == ENOTDIR);

There, link failed with errno == EEXIST.
This works around it:

  ASSERT (errno == ENOTDIR || errno == EEXIST);

Then, on a later test also in test-link, this one failed for the same reason:

  errno = 0;
  ASSERT (func (BASE "b", BASE "link/") == -1);
  ASSERT (errno == ENOTDIR || errno == ENOENT);

This works around it, and solved the problem for test-linkat, too:

  ASSERT (errno == ENOTDIR || errno == ENOENT || errno == EEXIST);

Here's the patch

diff --git a/tests/test-link.h b/tests/test-link.h
index bd9ac73..0d58262 100644
--- a/tests/test-link.h
+++ b/tests/test-link.h
@@ -162,11 +162,11 @@ test_link (int (*func) (char const *, char const *), bool 
print)
     }
   errno = 0;
   ASSERT (func (BASE "b", BASE "link/") == -1);
-  ASSERT (errno == ENOTDIR || errno == ENOENT);
+  ASSERT (errno == ENOTDIR || errno == ENOENT || errno == EEXIST);
   ASSERT (rename (BASE "b", BASE "a") == 0);
   errno = 0;
   ASSERT (func (BASE "link/", BASE "b") == -1);
-  ASSERT (errno == ENOTDIR);
+  ASSERT (errno == ENOTDIR || errno == EEXIST);

   /* Clean up.  */
   ASSERT (unlink (BASE "a") == 0);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]