Bugzilla – Bug 918487
tar gobbles up too many files
Last modified: 2016-11-10 17:57:58 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.
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 ...
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.
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.
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
Update released for openSUSE 13.2. Resolved fixed.
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
(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
Yes, I concur.
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.