On 11/23/2010 07:26 PM, Bruno Haible wrote: > Additionally, on NetBSD, the errno value EFTYPE should be turned into ELOOP > in the same way. And possibly also ENOTSUP on OSF/1. > <http://gnats.netbsd.org/43154> > > <http://www.sfr-fresh.com/unix/misc/xz-5.0.0.tar.gz:a/xz-5.0.0/src/xz/file_io.c>
Thanks for mentioning that. I applied the following patch to GNU tar for now, though it does seem like it'd make more sense to do this in gnulib. >From 1e3795cf3057be35ae6db1bcf04d9af89261f306 Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Wed, 24 Nov 2010 23:07:46 -0800 Subject: [PATCH] tar: work around NetBSD and Tru64 symlink incompatibility with POSIX Problem reported by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00306.html>. * src/extract.c (maybe_recoverable): Also treat EFTYPE (if defined) and ENOTSUP like ELOOP. --- src/extract.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/extract.c b/src/extract.c index c52c9ce..aaea56e 100644 --- a/src/extract.c +++ b/src/extract.c @@ -609,9 +609,18 @@ 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. */ + but some operating systems do not conform to the standard. */ +#ifdef EFTYPE + /* NetBSD uses errno == EFTYPE; see <http://gnats.netbsd.org/43154>. */ + case EFTYPE: +#endif + /* FreeBSD 8.1 uses errno == EMLINK. */ case EMLINK: + /* Tru64 5.1B uses errno == ENOTSUP. */ + case ENOTSUP: + if (! regular || old_files_option != OVERWRITE_OLD_FILES || dereference_option) break; -- 1.7.2
