bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] tar HEAD: difflink.at portability issue


From: Christian Weisgerber
Subject: [Bug-tar] tar HEAD: difflink.at portability issue
Date: Thu, 26 Apr 2018 19:01:05 +0200
User-agent: Mutt/1.9.5 (2018-04-13)

In the tar 1.30 release there was a problem with the difflink.at
test; this has been fixed in HEAD.  However, the test still fails
on *BSD and there is an underlying portability issue.

The preparatory part of the test runs this:

mkdir a
genfile -f a/x
ln -s x a/y
ln a/y a/z

What is the expected result?

ls -l a

==> OpenBSD, FreeBSD:
total 0
-rw-r--r--  2 naddy  naddy  0 Apr 26 18:45 x
lrwxr-xr-x  1 naddy  naddy  1 Apr 26 18:45 y -> x
-rw-r--r--  2 naddy  naddy  0 Apr 26 18:45 z

==> Linux:
total 0
-rw-r--r-- 1 naddy unixag 0 Apr 26 18:46 x
lrwxrwxrwx 2 naddy unixag 1 Apr 26 18:46 y -> x
lrwxrwxrwx 2 naddy unixag 1 Apr 26 18:46 z -> x

That's the difference between "ln -L a/y a/z" and "ln -P a/y a/z".
POSIX says the default behavior is "implementation defined".

I suggest the following fix:

--- /home/naddy/difflink.at     Thu Apr 26 18:58:04 2018
+++ difflink.at Thu Apr 26 18:52:59 2018
@@ -20,7 +20,7 @@
 mkdir a
 genfile -f a/x
 ln -s x a/y
-ln a/y a/z
+ln -P a/y a/z
 tar cf a.tar a/x a/y a/z
 rm a/z
 ln -s x a/z
-- 
Christian "naddy" Weisgerber                          address@hidden



reply via email to

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