ip7z / 7zip

7-Zip
815 stars 79 forks source link

Bug (archive creation fails when two files with the same filename but different path are passed prepended with "./" as filename arguments in linux) #55

Open Ashbd9 opened 2 months ago

Ashbd9 commented 2 months ago

System: Linux 7z version: 24.08

How to reproduce:

  1. touch file
  2. mkdir subdir
  3. touch subdir/file
  4. 7zz a .7z ./file ./subdir/file

Current Behaviour: ERROR: Duplicate filename on disk: file file

Expected Behaviour: The archive .7z is created and contains file subdir/file. By the way, it works if the filename arguments are passed without the starting "./" i.e. as 7zz a .7z file subdir/file It does not work when it is 7zz a .7z ./file ./subdir/file Also does not work is 7zz a .7z /tmp/file /tmp/subdir/file

ip7z commented 2 months ago

It's feature. 7-zip removes path prefixes for absolute paths and for paths starting from ./. 7-zip doesn't remove path prefixes for relative paths without ./ prefix.

So if you want path prefixes in archive, do not use ./. If you don't want path prefixes in archive, use ./ or absolute paths.

Ashbd9 commented 2 months ago

I have been reading the documentation and found that I can use the -spf flag to make it work in my case. Thank you!