bugGNU tar - Bugs: bug #62208, tar --delete dummy demages long...

 
 

bug #62208: tar --delete dummy demages long soft-links in tar created by git archive

Submitter:  None
Submitted:  Mon 21 Mar 2022 05:37:56 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 15 Jan 2024 09:14:21 PM UTC, comment #2: 

Works for commit 6ba24c31c6874ba59da880c4c858b749c1cc1417

Sergey Poznyakoff <gray>
Group administrator
Mon 21 Mar 2022 05:44:56 PM UTC, comment #1: 

a> cat test.tar | tar --delete notExistingFile | hexdump -C
tar: notExistingFile: Not found in archive
tar: Exiting with failure status due to previous errors
00000000  6c 69 6e 6b 31 00 00 00  00 00 00 00 00 00 00 00  |link1...........|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000060  00 00 00 00 30 30 30 30  37 37 37 00 30 30 30 30  |....0000777.0000|
00000070  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00000080  30 30 30 30 30 30 30 00  31 34 32 31 36 31 33 32  |0000000.14216132|
00000090  30 36 35 00 30 30 33 33  33 34 32 00 32 76 65 72  |065.0033342.2ver|
000000a0  79 4c 6f 6e 67 46 69 6c  65 6e 61 6d 65 43 6c 6f  |yLongFilenameClo|
000000b0  73 65 54 6f 31 30 30 43  68 61 72 73 56 65 72 79  |seTo100CharsVery|
000000c0  4c 6f 6e 67 46 69 6c 65  6e 61 6d 65 43 6c 6f 73  |LongFilenameClos|
000000d0  65 54 6f 31 30 30 43 68  61 72 73 56 65 72 79 4c  |eTo100CharsVeryL|
000000e0  6f 6e 67 46 69 6c 65 6e  61 6d 65 43 6c 6f 73 65  |ongFilenameClose|
000000f0  54 6f 31 30 30 43 68 61  72 73 00 00 00 00 00 00  |To100Chars......|
00000100  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000120  00 00 00 00 00 00 00 00  00 72 6f 6f 74 00 00 00  |.........root...|
00000130  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000140  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
00000150  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
00000160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  66 34 63 61 63 33 66 61  64 38 37 34 32 35 66 39  |f4cac3fad87425f9|
00000210  34 61 34 62 35 39 63 66  65 31 61 64 62 36 31 61  |4a4b59cfe1adb61a|
00000220  62 66 65 32 36 37 30 30  2e 70 61 78 68 65 61 64  |bfe26700.paxhead|
00000230  65 72 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |er..............|
00000240  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000260  00 00 00 00 30 30 30 30  36 36 36 00 30 30 30 30  |....0000666.0000|
00000270  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00000280  30 30 30 30 31 36 37 00  31 34 32 31 36 31 33 32  |0000167.14216132|
00000290  30 36 35 00 30 30 32 31  30 37 31 00 78 00 00 00  |065.0021071.x...|
000002a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000300  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00000310  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000320  00 00 00 00 00 00 00 00  00 72 6f 6f 74 00 00 00  |.........root...|
00000330  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000340  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
00000350  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
00000360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  31 31 39 20 6c 69 6e 6b  70 61 74 68 3d 2e 2e 2f  |119 linkpath=../|
00000410  74 65 73 74 2e 73 72 63  2f 76 65 72 79 4c 6f 6e  |test.src/veryLon|
00000420  67 46 69 6c 65 6e 61 6d  65 43 6c 6f 73 65 54 6f  |gFilenameCloseTo|
00000430  31 30 30 43 68 61 72 73  56 65 72 79 4c 6f 6e 67  |100CharsVeryLong|
00000440  46 69 6c 65 6e 61 6d 65  43 6c 6f 73 65 54 6f 31  |FilenameCloseTo1|
00000450  30 30 43 68 61 72 73 56  65 72 79 4c 6f 6e 67 46  |00CharsVeryLongF|
00000460  69 6c 65 6e 61 6d 65 43  6c 6f 73 65 54 6f 31 30  |ilenameCloseTo10|
00000470  30 43 68 61 72 73 0a 00  00 00 00 00 00 00 00 00  |0Chars..........|
00000480  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000600  6c 69 6e 6b 32 00 00 00  00 00 00 00 00 00 00 00  |link2...........|
00000610  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000660  00 00 00 00 30 30 30 30  37 37 37 00 30 30 30 30  |....0000777.0000|
00000670  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00000680  30 30 30 30 30 30 30 00  31 34 32 31 36 31 33 32  |0000000.14216132|
00000690  30 36 35 00 30 30 32 32  34 34 35 00 32 73 65 65  |065.0022445.2see|
000006a0  20 66 34 63 61 63 33 66  61 64 38 37 34 32 35 66  | f4cac3fad87425f|
000006b0  39 34 61 34 62 35 39 63  66 65 31 61 64 62 36 31  |94a4b59cfe1adb61|
000006c0  61 62 66 65 32 36 37 30  30 2e 70 61 78 68 65 61  |abfe26700.paxhea|
000006d0  64 65 72 00 00 00 00 00  00 00 00 00 00 00 00 00  |der.............|
000006e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000700  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00000710  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000720  00 00 00 00 00 00 00 00  00 72 6f 6f 74 00 00 00  |.........root...|
00000730  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000740  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
00000750  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
00000760  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000800  66 34 63 61 63 33 66 61  64 38 37 34 32 35 66 39  |f4cac3fad87425f9|
00000810  34 61 34 62 35 39 63 66  65 31 61 64 62 36 31 61  |4a4b59cfe1adb61a|
00000820  62 66 65 32 36 37 30 30  2e 70 61 78 68 65 61 64  |bfe26700.paxhead|
00000830  65 72 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |er..............|
00000840  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000860  00 00 00 00 30 30 30 30  36 36 36 00 30 30 30 30  |....0000666.0000|
00000870  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00000880  30 30 30 30 31 36 37 00  31 34 32 31 36 31 33 32  |0000167.14216132|
00000890  30 36 35 00 30 30 32 31  30 37 31 00 78 00 00 00  |065.0021071.x...|
000008a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000900  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00000910  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000920  00 00 00 00 00 00 00 00  00 72 6f 6f 74 00 00 00  |.........root...|
00000930  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000940  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
00000950  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
00000960  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000a00  31 31 39 20 6c 69 6e 6b  70 61 74 68 3d 2e 2e 2f  |119 linkpath=../|
00000a10  74 65 73 74 2e 73 72 63  2f 76 65 72 79 4c 6f 6e  |test.src/veryLon|
00000a20  67 46 69 6c 65 6e 61 6d  65 43 6c 6f 73 65 54 6f  |gFilenameCloseTo|
00000a30  31 30 30 43 68 61 72 73  56 65 72 79 4c 6f 6e 67  |100CharsVeryLong|
00000a40  46 69 6c 65 6e 61 6d 65  43 6c 6f 73 65 54 6f 31  |FilenameCloseTo1|
00000a50  30 30 43 68 61 72 73 56  65 72 79 4c 6f 6e 67 46  |00CharsVeryLongF|
00000a60  69 6c 65 6e 61 6d 65 43  6c 6f 73 65 54 6f 31 30  |ilenameCloseTo10|
00000a70  30 43 68 61 72 73 0a 00  00 00 00 00 00 00 00 00  |0Chars..........|
00000a80  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000c00  6c 69 6e 6b 33 00 00 00  00 00 00 00 00 00 00 00  |link3...........|
00000c10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000c60  00 00 00 00 30 30 30 30  37 37 37 00 30 30 30 30  |....0000777.0000|
00000c70  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00000c80  30 30 30 30 30 30 30 00  31 34 32 31 36 31 33 32  |0000000.14216132|
00000c90  30 36 35 00 30 30 31 33  30 37 32 00 32 64 75 6d  |065.0013072.2dum|
00000ca0  6d 79 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |my..............|
00000cb0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000d00  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00000d10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000d20  00 00 00 00 00 00 00 00  00 72 6f 6f 74 00 00 00  |.........root...|
00000d30  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000d40  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
00000d50  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
00000d60  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000e00  66 34 63 61 63 33 66 61  64 38 37 34 32 35 66 39  |f4cac3fad87425f9|
00000e10  34 61 34 62 35 39 63 66  65 31 61 64 62 36 31 61  |4a4b59cfe1adb61a|
00000e20  62 66 65 32 36 37 30 30  2e 70 61 78 68 65 61 64  |bfe26700.paxhead|
00000e30  65 72 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |er..............|
00000e40  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000e60  00 00 00 00 30 30 30 30  36 36 36 00 30 30 30 30  |....0000666.0000|
00000e70  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00000e80  30 30 30 30 31 36 37 00  31 34 32 31 36 31 33 32  |0000167.14216132|
00000e90  30 36 35 00 30 30 32 31  30 37 31 00 78 00 00 00  |065.0021071.x...|
00000ea0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000f00  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00000f10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000f20  00 00 00 00 00 00 00 00  00 72 6f 6f 74 00 00 00  |.........root...|
00000f30  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000f40  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
00000f50  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
00000f60  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001000  31 31 39 20 6c 69 6e 6b  70 61 74 68 3d 2e 2e 2f  |119 linkpath=../|
00001010  74 65 73 74 2e 73 72 63  2f 76 65 72 79 4c 6f 6e  |test.src/veryLon|
00001020  67 46 69 6c 65 6e 61 6d  65 43 6c 6f 73 65 54 6f  |gFilenameCloseTo|
00001030  31 30 30 43 68 61 72 73  56 65 72 79 4c 6f 6e 67  |100CharsVeryLong|
00001040  46 69 6c 65 6e 61 6d 65  43 6c 6f 73 65 54 6f 31  |FilenameCloseTo1|
00001050  30 30 43 68 61 72 73 56  65 72 79 4c 6f 6e 67 46  |00CharsVeryLongF|
00001060  69 6c 65 6e 61 6d 65 43  6c 6f 73 65 54 6f 31 30  |ilenameCloseTo10|
00001070  30 43 68 61 72 73 0a 00  00 00 00 00 00 00 00 00  |0Chars..........|
00001080  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001200  76 65 72 79 4c 6f 6e 67  46 69 6c 65 6e 61 6d 65  |veryLongFilename|
00001210  43 6c 6f 73 65 54 6f 31  30 30 43 68 61 72 73 56  |CloseTo100CharsV|
00001220  65 72 79 4c 6f 6e 67 46  69 6c 65 6e 61 6d 65 43  |eryLongFilenameC|
00001230  6c 6f 73 65 54 6f 31 30  30 43 68 61 72 73 56 65  |loseTo100CharsVe|
00001240  72 79 4c 6f 6e 67 46 69  6c 65 6e 61 6d 65 43 6c  |ryLongFilenameCl|
00001250  6f 73 65 54 6f 31 30 30  43 68 61 72 73 00 00 00  |oseTo100Chars...|
00001260  00 00 00 00 30 30 30 30  36 36 34 00 30 30 30 30  |....0000664.0000|
00001270  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00001280  30 30 30 30 30 30 35 00  31 34 32 31 36 31 33 32  |0000005.14216132|
00001290  30 36 35 00 30 30 33 32  34 30 31 00 30 00 00 00  |065.0032401.0...|
000012a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001300  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00001310  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00001320  00 00 00 00 00 00 00 00  00 72 6f 6f 74 00 00 00  |.........root...|
00001330  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00001340  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
00001350  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
00001360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001400  74 65 73 74 0a 00 00 00  00 00 00 00 00 00 00 00  |test............|
00001410  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00002800

Anonymous
Mon 21 Mar 2022 05:37:56 PM UTC, original submission:  

When soft-link is longer as 100 chars 'git archive ...' creates additional ustar struct with linkpath. 'tar --delete dummy' duplicates this additional ustar struct for all following ustar structs.
Bellow you can find a small script to reproduce the problem.


a> cat test.sh
#!/bin/bash

set -e

rm -rf test.src test.ok test.notOk test.tar

file_name=veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars

git --version
tar --version | head -1
git init --quiet test.src
echo test > test.src/$file_name
ln -s $file_name test.src/link1
ln -s ../test.src/$file_name test.src/link2
ln -s dummy test.src/link3
git -C test.src add $file_name link1 link2 link3
git -C test.src commit --quiet -m 'test commit'
git -C test.src archive HEAD > test.tar

echo '--------------- extract without tar --delete notExistingFile'
mkdir test.ok
cat test.tar | tar -C test.ok -x
ls -l test.ok | sed -e 's/  */ /g' | cut -d' ' -f9-

echo '--------------- extract with tar --delete notExistingFile'
mkdir test.notOk
cat test.tar | tar --delete notExistingFile | tar -C test.notOk -x
ls -l test.notOk | sed -e 's/  */ /g' | cut -d' ' -f9-

a> ./test.sh
git version 2.30.2
tar (GNU tar) 1.32
--------------- extract without tar --delete notExistingFile

link1 -> veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars
link2 -> ../test.src/veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars
link3 -> dummy
veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars
--------------- extract with tar --delete notExistingFile
tar: notExistingFile: Not found in archive
tar: Exiting with failure status due to previous errors

link1 -> veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars
link2 -> ../test.src/veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars
link3 -> ../test.src/veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars
veryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100CharsVeryLongFilenameCloseTo100Chars

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gray (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-15 gray StatusNone Works For Me
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code