Bug 2230127

Summary: tar 1.35.1: --delete creates tarfiles with duplicate file paths
Product: [Fedora] Fedora Reporter: Ed Santiago <santiago>
Component: tarAssignee: Pavel Raiskup <praiskup>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: kdudka, ljavorsk, mmuzila, ovasik, pkubat, praiskup
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tar-1.35-2.fc39 tar-1.35-2.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-15 16:09:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
a.ante.tar - untouched output of podman export a
none
a.post.tar - result of tar --delete none

Description Ed Santiago 2023-08-08 18:18:46 UTC
The `--delete` flag in tar 1.35.1 (rawhide) generates a tarball that is unreadable by podman, and possibly by other tools using the Go tar implementation.

Reproducible: Always

Steps to Reproduce:
podman create --name a quay.io/libpod/testimage:20221018
podman export -o /tmp/a.tar a
tar --delete -f /tmp/a.tar home/podman/pause
podman import /tmp/a.tar b
Actual Results:  
Error: writing blob: adding layer with blob "sha256:51098d81131bac1a1a8539c68e4389e15fe1a800e4922eecd9cb11b0f51d9386": processing tar file(): duplicates of file paths not supported

Expected Results:  
clean import

Ran `tar tf` against old & new tarball. Results:

@@ -234,3 +234,2 @@
 home/podman/
-home/podman/pause
 home/podman/testimage-id
@@ -773,2 +772,14 @@
 usr/share/misc/
+usr/share/man/
+usr/share/misc/
+usr/share/udhcpc/
+usr/share/udhcpc/default.script
+var/
+var/cache/
+var/cache/apk/
+var/cache/misc/
+var/empty/
+var/lib/
+var/lib/apk/
+var/lib/arpd/
 usr/share/udhcpc/

home/podman/pause is expected and correct. The others, not so much. Note that `usr/lib/misc` is instantly recognizable as a dup

Comment 1 Ed Santiago 2023-08-10 23:13:00 UTC
This is the commit that introduced the problem:

https://git.savannah.gnu.org/cgit/tar.git/commit/?id=e89c7a45eba7644693870b613386baa45d624e6a

Comment 2 Ed Santiago 2023-08-11 12:20:58 UTC
Created attachment 1983003 [details]
a.ante.tar - untouched output of podman export a

Comment 3 Ed Santiago 2023-08-11 12:26:31 UTC
Created attachment 1983004 [details]
a.post.tar - result of tar --delete

Comment 4 Ed Santiago 2023-08-11 12:30:02 UTC
Attached a.ante.tar and a.post.tar, the before & after tarballs. 'post' was generated using tar-1.35-1.fc39.x86_64 but it is functionally equivalent to one generated by tar-from-source.

'tar tf /tmp/a.post.tar |sort|uniq -cd' lists 12 dups: usr/share/man down to var/lib/arpd. (tar-1.34 does as well).

Comment 5 Pavel Raiskup 2023-08-15 09:24:33 UTC
Thank you Ed for the debugging and communication with upstream.

Downstream backport: https://src.fedoraproject.org/rpms/tar/pull-request/18

Comment 6 Fedora Update System 2023-08-15 14:06:57 UTC
FEDORA-2023-13e5135bc9 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-13e5135bc9

Comment 7 Fedora Update System 2023-08-15 14:07:02 UTC
FEDORA-2023-1b0c5370c2 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-1b0c5370c2

Comment 8 Fedora Update System 2023-08-15 16:09:37 UTC
FEDORA-2023-13e5135bc9 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2023-08-15 16:27:37 UTC
FEDORA-2023-1b0c5370c2 has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.