Open mboisson opened 3 years ago
Here is a small test on CephFS:
rm -rf testdir unpack; mkdir testdir; cd testdir; touch b; ln -s b a; cd ..; ls -rl testdir; 7za a testdir.7z testdir; 7za x -y -ounpack testdir.7z; ls -l unpack/testdir/; cat unpack/testdir/a
total 1
-rw-rw-r-- 1 mboisson mboisson 0 18 nov 19:09 b
lrwxrwxrwx 1 mboisson mboisson 1 18 nov 19:09 a -> b
7-Zip (a) [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)
Open archive: testdir.7z
--
Path = testdir.7z
Type = 7z
Physical Size = 174
Headers Size = 169
Method = LZMA2:12
Solid = -
Blocks = 1
Scanning the drive:
1 folder, 2 files, 1 bytes (1 KiB)
Updating archive: testdir.7z
Items to compress: 3
Files read from disk: 1
Archive size: 174 bytes (1 KiB)
Everything is Ok
7-Zip (a) [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)
Scanning the drive for archives:
1 file, 174 bytes (1 KiB)
Extracting archive: testdir.7z
--
Path = testdir.7z
Type = 7z
Physical Size = 174
Headers Size = 169
Method = LZMA2:12
Solid = -
Blocks = 1
ERROR: E_FAIL
Archives with Errors: 1
total 1
-rw-rw-r-- 1 mboisson mboisson 1 18 nov 19:09 a
-rw-rw-r-- 1 mboisson mboisson 0 18 nov 19:09 b
b
And the same on a xfs:
rm -rf testdir unpack; mkdir testdir; cd testdir; touch b; ln -s b a; cd ..; ls -rl testdir; 7za a testdir.7z testdir; 7za x -y -ounpack testdir.7z; ls -l unpack/testdir/; cat unpack/testdir/a
total 0
-rw-rw-r-- 1 mboisson mboisson 0 18 nov 19:11 b
lrwxrwxrwx 1 mboisson mboisson 1 18 nov 19:11 a -> b
7-Zip (a) [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)
Scanning the drive:
1 folder, 2 files, 1 bytes (1 KiB)
Creating archive: testdir.7z
Items to compress: 3
Files read from disk: 1
Archive size: 175 bytes (1 KiB)
Everything is Ok
7-Zip (a) [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)
Scanning the drive for archives:
1 file, 175 bytes (1 KiB)
Extracting archive: testdir.7z
--
Path = testdir.7z
Type = 7z
Physical Size = 175
Headers Size = 170
Method = LZMA2:12
Solid = -
Blocks = 1
Everything is Ok
Folders: 1
Files: 2
Size: 1
Compressed: 175
total 0
lrwxrwxrwx 1 mboisson mboisson 1 18 nov 19:11 a -> b
-rw-rw-r-- 1 mboisson mboisson 0 18 nov 19:11 b
I debugged p7zip, and it turns out that the issue is that lstat
yields a value of 0
for st_dev
. This causes this test to fail and return without transforming the files into symlinks.
https://github.com/jinfeihan57/p7zip/blob/master/CPP/Windows/FileDir.cpp#L862
Why is _dev == 0
an abort condition for converting files into symlinks ?
If I comment this test, then the extraction works just fine.
I applied this patch to our local build, but I would like to know what unforeseen consequence this may have
Hi, I have a .7z file which contains symbolic links. If I extract it on a xfs filesystem, it extracts symlinks correctly. If I extract it on a CephFS filesystem, it saves symlinks as text files which contain the path to their targets, i.e.
CephFS does support symbolic links, so I'm not sure why 7za is not doing the right thing.