untarring symlinks with ../ fails randomly

Daniel R. Grayson dan@math.uiuc.edu
Wed Apr 20 16:02:00 GMT 2011


Tar doesn't extract files with symlinks starting with ../ reliably.

Make the tar file like this:

     $ mkdir bb
     $ ln -s ../foo/bar bb/a
     $ ln -s ../foo/bar bb/b
     $ ln -s ../foo/bar bb/c
     $ ln -s ../foo/bar bb/d
     $ ln -s ../foo/bar bb/e
     $ ln -s ../foo/bar bb/f
     $ ln -s ../foo/bar bb/g
     $ ln -s ../foo/bar bb/h
     $ ln -s ../foo/bar bb/i
     $ ln -s ../foo/bar bb/j
     $ tar cf bb.tar bb

Untar it like this:

     $ rm -rf bb
     $ tar xf bb.tar

See what we get:

     $ ls -lR bb
     bb:
     total 6
     lrwxrwxrwx 1 dan None 10 Apr 20 09:25 a -> ../foo/bar
     ---------- 1 dan None  0 Apr 20 09:26 b
     lrwxrwxrwx 1 dan None 10 Apr 20 09:25 c -> ../foo/bar
     lrwxrwxrwx 1 dan None 10 Apr 20 09:25 d -> ../foo/bar
     ---------- 1 dan None  0 Apr 20 09:26 e
     lrwxrwxrwx 1 dan None 10 Apr 20 09:25 f -> ../foo/bar
     lrwxrwxrwx 1 dan None 10 Apr 20 09:25 g -> ../foo/bar
     ---------- 1 dan None  0 Apr 20 09:26 h
     lrwxrwxrwx 1 dan None 10 Apr 20 09:25 i -> ../foo/bar
     ---------- 1 dan None  0 Apr 20 09:26 j

This behavior is similar to the old report at

      http://sourceware.org/ml/cygwin/2010-07/msg00086.html

but that was supposedly fixed a long time ago.  I didn't find anything 
else.  Runnning under strace shows that tar skips some final steps for 
the problem files.

-----------------------------------------------------------------------------

Some info about the system, cygcheck.out file attached.

     $ type tar
     tar is hashed (/usr/bin/tar)
     $ tar --version
     tar (GNU tar) 1.25
     Packaged by Cygwin (1.25-1)
     Copyright (C) 2010 Free Software Foundation, Inc.
     License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>.
     This is free software: you are free to change and redistribute it.
     There is NO WARRANTY, to the extent permitted by law.

     Written by John Gilmore and Jay Fenlason.
     $ cygcheck -s -v -r > cygcheck.out
     /usr/bin/cygrunsrv: warning: OpenService failed for 'DcomLaunch': 
Win32 error 5
     Access is denied.
     /usr/bin/cygrunsrv: warning: OpenService failed for 'pla': Win32 
error 5
     Access is denied.
     /usr/bin/cygrunsrv: warning: OpenService failed for 'QWAVE': Win32 
error 5
     Access is denied.
     /usr/bin/cygrunsrv: warning: OpenService failed for 'RpcEptMapper': 
Win32 error 5
     Access is denied.
     /usr/bin/cygrunsrv: warning: OpenService failed for 'RpcSs': Win32 
error 5
     Access is denied.
     $
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20110420/8a051998/attachment.ksh>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list