Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: symlinks are stored as text files if added explicitly #235

Open
slowpeek opened this issue Jun 24, 2024 · 0 comments
Open

Bug: symlinks are stored as text files if added explicitly #235

slowpeek opened this issue Jun 24, 2024 · 0 comments

Comments

@slowpeek
Copy link

Create test dir:

mkdir a
date > a/date.txt
ln -s date.txt a/link1

On archlinux with p7zip package version 17.05, pack a into 1.7z, a/* into 2.7z:

> 7za a -snl 1.7z a

7-Zip (a) [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs x64)

Scanning the drive:
1 folder, 2 files, 37 bytes (1 KiB)

Creating archive: 1.7z

Items to compress: 3


Files read from disk: 2
Archive size: 223 bytes (1 KiB)
Everything is Ok
> 7za a -snl 2.7z a/*

7-Zip (a) [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs x64)

Scanning the drive:
2 files, 58 bytes (1 KiB)

Creating archive: 2.7z

Items to compress: 2


Files read from disk: 2
Archive size: 209 bytes (1 KiB)
Everything is Ok

and check out whats inside:

> 7za l -ba -slt 1.7z | grep -E 'Path|Attr'
Path = a
Attributes = D_ drwxr-xr-x
Path = a/date.txt
Attributes = A_ -rw-r--r--
Path = a/link1
Attributes = A_ lrwxrwxrwx
> 7za l -ba -slt 2.7z | grep -E 'Path|Attr'
Path = a/date.txt
Attributes = A_ -rw-r--r--
Path = a/link1
Attributes = A_ -rw-r--r--

So, when I pack a as a whole, link1 is saved as a link. But when I pack a/link1 explicitly, it is saved as a text file.

Let's unpack 2.7z:

> mkdir 2; cd 2
> 7za x ../2.7z 

7-Zip (a) [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs x64)

Scanning the drive for archives:
1 file, 209 bytes (1 KiB)

Extracting archive: ../2.7z
--
Path = ../2.7z
Type = 7z
Physical Size = 209
Headers Size = 168
Method = LZMA2:12
Solid = +
Blocks = 1

Everything is Ok

Files: 2
Size:       37
Compressed: 209
> ls -l a
total 8
-rw-r--r-- 1 root root 29 Jun 23 23:28 date.txt
-rw-r--r-- 1 root root  8 Jun 23 23:28 link1
> cat a/link1; echo
date.txt

So, it packed link1 as a text file with the link target as its contents.

Other affected versions: 15.14 and 16.02

Not affected: 9.38. Its l -slt printer does not print posix attrs. Just unpack the archive to check if the symlink is there or use a newer binary to inspect.

Binaries built from 7zip.org sources are not affected. For example, 7zz version 21.07 from 7zip package in ubuntu 22.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant