On 11/23/10 08:16, Joerg Schilling wrote:

> The POSIX standard requires errno to be ELOOP in this case.

Quite right.  And I see that this incompatibility is not
fixed in FreeBSD 9-current, at least according to the
published manual page.  Christian, would you please report this
to the FreeBSD folks, if they don't know about it already?

Christian's workaround is pretty easy, so I installed this:

>From ce6e292e2e3601ac690a1e3e82d91ef5e3f5a7c8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 23 Nov 2010 12:57:47 -0800
Subject: [PATCH] tar: work around FreeBSD symlink incompatibility with POSIX

* src/extract.c (maybe_recoverable): Treat EMLINK like ELOOP, for
FreeBSD.  Problem reported by Christian Weisgerber in
<http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00080.html>.
---
 src/extract.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/extract.c b/src/extract.c
index 6711f87..c52c9ce 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -609,6 +609,9 @@ maybe_recoverable (char *file_name, bool regular, bool 
*interdir_made)
   switch (e)
     {
     case ELOOP:
+      /* With open ("symlink", O_NOFOLLOW|...), POSIX says errno == ELOOP,
+        but FreeBSD through at least 8.1 uses errno == EMLINK.  */
+    case EMLINK:
       if (! regular
          || old_files_option != OVERWRITE_OLD_FILES || dereference_option)
        break;
-- 
1.7.2


Reply via email to