Bug 918487 - tar gobbles up too many files
Summary: tar gobbles up too many files
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: 13.2
Hardware: All Linux
: P5 - None : Critical with 5 votes (vote)
Target Milestone: ---
Assignee: Kristyna Streitova
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 913058 919233
  Show dependency treegraph
 
Reported: 2015-02-18 21:38 UTC by Jan Engelhardt
Modified: 2016-11-10 17:57 UTC (History)
6 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Engelhardt 2015-02-18 21:38:56 UTC
The new tar-recursive--files-from.patch causes a terrible regression. The file list is no longer the same.

find /etc -type d -print0 | tar -T- --no-r --null -cvf /tmp/skeleton.tar

With the patch, it is no longer possible to create such an archive of skeletal directories.

Please REVERT.
Comment 1 Jan Engelhardt 2015-02-18 21:41:02 UTC
With original tar as delivered in 13.2:

# find /etc -type d -print0 | tar -T- --no-r --null -cvf /tmp/skeleton.tar | head -n10
tar: -: file name read contains nul character
tar: Removing leading `/' from member names
/etc/
/etc/ConsoleKit/
/etc/ConsoleKit/run-seat.d/
/etc/ConsoleKit/run-session.d/
/etc/ConsoleKit/seats.d/
/etc/ImageMagick-6_Q16-2/
/etc/NetworkManager/
/etc/NetworkManager/dispatcher.d/
/etc/NetworkManager/VPN/
/etc/NetworkManager/system-connections/


With tar-1.28-2.13.1 (broken):

# find /etc -type d -print0 | tar -T- --no-r --null -cvf /tmp/skeleton.tar | head -n10
tar: -: file name read contains nul character
tar: Removing leading `/' from member names
/etc/
/etc/HOSTNAME
/etc/localtime
/etc/mtab
/etc/rc.d
/etc/termcap
/etc/ConsoleKit/
/etc/ConsoleKit/run-seat.d/
/etc/ConsoleKit/run-session.d/
/etc/ConsoleKit/run-session.d/dbus_at_console.ck
...
Comment 2 Vítězslav Čížek 2015-02-19 17:01:50 UTC
What happens:
Tar prepares its list from the -T option immediately when it encounters -T on the command line.
It stores the value of the recursive_option along that data.
The --no-recursive parameter hasn't been parsed yet and the the recursive option is on by default.
So it thinks it'll have to work recursively on the files.
And it adds each directory recursively:

# find test
test
test/D
test/D/c
test/D/D2
test/b
# cat files
./test
./test/D
./test/D/D2
# tar -T files --no-r -cvf skeleton.tar
./test/
./test/D/
./test/D/c
./test/D/D2/
./test/b
./test/D/
./test/D/c
./test/D/D2/
./test/D/D2/

^^^ here test/D/D2 got archived 3 times.

There's a simple workaround:
Add the --no-recursive option in front of the -T.
Comment 3 Vítězslav Čížek 2015-04-13 10:44:47 UTC
For the record here's your upstream report:
http://lists.gnu.org/archive/html/bug-tar/2015-02/msg00011.html

It got no attention, so we might need to fix it ourselves.

There are other reports about this regression, eg bug 919233.
So let's revert the patch until we have a working solution.
Comment 4 Bernhard Wiedemann 2015-04-13 11:00:08 UTC
This is an autogenerated message for OBS integration:
This bug (918487) was mentioned in
https://build.opensuse.org/request/show/295670 13.2+13.1 / tar
Comment 5 Benjamin Brunner 2015-04-21 08:44:18 UTC
Update released for openSUSE 13.2. Resolved fixed.
Comment 6 Swamp Workflow Management 2015-04-21 09:05:08 UTC
openSUSE-RU-2015:0738-1: An update that has two recommended fixes can now be installed.

Category: recommended (important)
Bug References: 918487,919233
CVE References: 
Sources used:
openSUSE 13.2 (src):    tar-1.28-2.16.1
Comment 7 Kristyna Streitova 2016-11-09 18:22:49 UTC
(In reply to Vítězslav Čížek from comment #3)
> So let's revert the patch until we have a working solution.

It seems that upstream doesn't consider this a regression but intended change in behaviour instead [1]:

<cite>
Yes, --recursive is position-sensitive option and as such it must be
used before arguments it is supposed to affect.  Please see 3.4.4
"Position-Sensitive Options"[1], for details.
</cite>

In this case, we should re-introduce the reverted patch and fix all packages that use the wrong option position.


[1] http://lists.gnu.org/archive/html/bug-tar/2016-05/msg00010.html
Comment 8 Jan Engelhardt 2016-11-10 09:41:33 UTC
Yes, I concur.
Comment 9 Kristyna Streitova 2016-11-10 17:57:58 UTC
The tar patch was re-introduced and dpkg packages were fixed:

|    Codestream    | Request - tar | Request - dpkg |
|------------------|---------------|----------------|
| SLE10SP3         | not affected  | -              |
| SLE11            | not affected  | -              |
| SLE12            | #123860       | *              |
| openSUSE 13.2    | #439565       | #439557        |
| Leap             | via SLE12     | #123855        |
| openSUSE:Factory | not affected  | -              |

* it was consulted with Leonardo that dpkg change isn't required here.

Closing as fixed.