bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] poor signal handling behavior on GNU tar with symlinks and dir


From: Andrew Ruder
Subject: [Bug-tar] poor signal handling behavior on GNU tar with symlinks and dirs
Date: Thu, 02 Mar 2017 16:41:09 -0600

Hi all,

I believe I've found a very surprising behavior with GNU tar 1.29 and
signal handling.  I've attached a testcase tar file. Note that this tar
file, while very small, CREATES A VERY LARGE FILE (1 gig).  This is to
aid in timing.   All files are owned by 0:0  (root/wheel on my system).

% sudo gtar jtvf testcase-gnu-tar-bug.tar.bz2
drwxr-xr-x root/wheel        0 2017-03-02 16:10 testcase-gnu-tar-bug/
drwxr-xr-x root/wheel        0 2017-03-02 16:17
testcase-gnu-tar-bug/dir1/
-rw-r--r-- root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/dir1/file
-rw-r--r-- root/wheel        0 2017-03-02 15:55
testcase-gnu-tar-bug/file1
lrwxr-xr-x root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/file2 -> /var/somewhere
-rw-r--r-- root/wheel 1073741824 2017-03-02 16:10
testcase-gnu-tar-bug/file3

TEST CASE 1 is, in my opinion, pretty broken.  I've tried a lot of
different command-line options trying to adjust the behavior with very
little luck.  Am I missing something??

TEST CASE 2 and TEST CASE 3 are, in my opinion, acting as expected.

My system: OS X 10.12.3 with GNU tar 1.29 installed via homebrew but I
have verified this with GNU tar 1.29 on Arch Linux as well.


=====
TEST CASE 1

I hit ctrl-c while it is extracting the final file.

% sudo rm -fr testcase-gnu-tar-bug ; bunzip2
testcase-gnu-tar-bug.tar.bz2 | sudo gtar -xvvf -
drwxr-xr-x root/wheel        0 2017-03-02 16:10 testcase-gnu-tar-bug/
drwxr-xr-x root/wheel        0 2017-03-02 16:17
testcase-gnu-tar-bug/dir1/
-rw-r--r-- root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/dir1/file
-rw-r--r-- root/wheel        0 2017-03-02 15:55
testcase-gnu-tar-bug/file1
lrwxr-xr-x root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/file2 -> /var/somewhere
-rw-r--r-- root/wheel 1073741824 2017-03-02 16:10
testcase-gnu-tar-bug/file3
^C                                                                       

% sudo ls -lsa testcase-gnu-tar-bug
total 184816
     0 drwx------  6 root     staff       204 Mar  2 16:21 .
     0 drwx------+ 6 aeruder  staff       204 Mar  2 16:21 ..
     0 drwxr-xr-x  3 root     wheel       102 Mar  2 16:17 dir1
     0 -rw-r--r--  1 root     wheel         0 Mar  2 15:55 file1
     0 ----------  1 root     staff         0 Mar  2 16:21 file2
184816 -rw-------  1 root     staff  94624768 Mar  2 16:21 file3

Note that:

1.) parent dir has wrong permissions and wrong ownership (BAD)
2.) file2 has wrong permissions, wrong file type, wrong ownership (BAD)
3.) file3 has wrong permissions, wrong ownership (OK)


====
TEST CASE 2

Everything runs normal, no ctrl-c

% sudo rm -fr testcase-gnu-tar-bug ; bunzip2 <
testcase-gnu-tar-bug.tar.bz2 | sudo gtar -xvvf -
drwxr-xr-x root/wheel        0 2017-03-02 16:10 testcase-gnu-tar-bug/
drwxr-xr-x root/wheel        0 2017-03-02 16:17
testcase-gnu-tar-bug/dir1/
-rw-r--r-- root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/dir1/file
-rw-r--r-- root/wheel        0 2017-03-02 15:55
testcase-gnu-tar-bug/file1
lrwxr-xr-x root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/file2 -> /var/somewhere
-rw-r--r-- root/wheel 1073741824 2017-03-02 16:10
testcase-gnu-tar-bug/file3

% sudo ls -lsa testcase-gnu-tar-bug
total 2097160
      0 drwxr-xr-x  6 root     wheel         204 Mar  2 16:10 .
      0 drwx------+ 6 aeruder  staff         204 Mar  2 16:27 ..
      0 drwxr-xr-x  3 root     wheel         102 Mar  2 16:17 dir1
      0 -rw-r--r--  1 root     wheel           0 Mar  2 15:55 file1
      8 lrwxr-xr-x  1 root     wheel          14 Mar  2 16:10 file2 ->
      /var/somewhere
2097152 -rw-r--r--  1 root     wheel  1073741824 Mar  2 16:10 file3

====
TEST CASE 3

Kill the 'bunzip2' process while gnu tar is running.  I used pkill -n
bunzip2 from another terminal.

% sudo rm -fr testcase-gnu-tar-bug ; bunzip2 <
testcase-gnu-tar-bug.tar.bz2 | sudo gtar -xvvf -
drwxr-xr-x root/wheel        0 2017-03-02 16:10 testcase-gnu-tar-bug/
drwxr-xr-x root/wheel        0 2017-03-02 16:17
testcase-gnu-tar-bug/dir1/
-rw-r--r-- root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/dir1/file
-rw-r--r-- root/wheel        0 2017-03-02 15:55
testcase-gnu-tar-bug/file1
lrwxr-xr-x root/wheel        0 2017-03-02 16:10
testcase-gnu-tar-bug/file2 -> /var/somewhere
-rw-r--r-- root/wheel 1073741824 2017-03-02 16:10
testcase-gnu-tar-bug/file3
gtar: Unexpected EOF in archive
gtar: Unexpected EOF in archive
gtar: Error is not recoverable: exiting now
[1]    33786 terminated  bunzip2 < testcase-gnu-tar-bug.tar.bz2

% sudo ls -lsa testcase-gnu-tar-bug
total 579784
     0 drwxr-xr-x  6 root     wheel        204 Mar  2 16:10 .
     0 drwx------+ 6 aeruder  staff        204 Mar  2 16:34 ..
     0 drwxr-xr-x  3 root     wheel        102 Mar  2 16:17 dir1
     0 -rw-r--r--  1 root     wheel          0 Mar  2 15:55 file1
     8 lrwxr-xr-x  1 root     wheel         14 Mar  2 16:10 file2 ->
     /var/somewhere
579776 -rw-------  1 root     staff  296842240 Mar  2 16:34 file3

Note that:

1.) file3 has wrong permissions, wrong ownership (OK)


-- 
  Andrew Ruder
  address@hidden

Attachment: testcase-gnu-tar-bug.tar.bz2
Description: BZip2 compressed data


reply via email to

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