Menu

#2417 7z won't handle both `-i@file.lst` and -snl options correctly

open
nobody
None
5
2023-10-26
2023-10-25
Paul Semel
No

Basically, I'd want to be able to list some directories in file.lst that are symlink, but as the -snl option suggests it, I want the link to be added to the archive and not the whole directory content.

zip does it the right way, because it makes a distinction between path/to/dir and path/to/dir/*.

Note that this is also true for files, as 7z will try to add the actual file to the archive instead of just the link.

I guess for files it'd be easy to fix this, but for directories it would be harder, since 7z accepts both formats mentioned above to target "the directory and its content".

Discussion

  • Igor Pavlov

    Igor Pavlov - 2023-10-25

    why file.lst?
    you can write names in command without file list.
    Show simplest and smallest command that doesn't work as you expect.

     
  • Paul Semel

    Paul Semel - 2023-10-25

    Context:

    $ ls
    file.lst test_dir
    
    $ ls -l test_dir
    Oct 25 16:20 file -> /tmp/test
    
    $ cat file.lst
    test_dir/file
    

    The command is: 7z a -snl -i@file.lst test.zip

    I expect 7zip to create a zip archive with only one file which is a symlink (because I set -snl). What it contains is an archive with one file, which is named file, which contains the content of /tmp/test. So it is not a symlink, which is what I would have expected.

     
  • Igor Pavlov

    Igor Pavlov - 2023-10-25

    What version of 7-zip?

     
    • Paul Semel

      Paul Semel - 2023-10-25
      7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
      p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,128 CPUs AMD EPYC 7B12 (830F10),ASM,AES-NI)
      
       
  • Igor Pavlov

    Igor Pavlov - 2023-10-25

    -snl switch to store symbolic links as links (WIM and TAR formats only).

     

    Last edit: Igor Pavlov 2023-10-25
    • Paul Semel

      Paul Semel - 2023-10-25

      Interesting. A few remarks:
      1. From the linux command line we can read "-snl : store symbolic links as links". Same thing for the man page.
      2. Running 7za a -snl -tzip test.zip test_dir/ will store test_dir/file as a symbolic link, so as I expect it to do.

      Am I misunderstanding something here?

       
  • Igor Pavlov

    Igor Pavlov - 2023-10-25

    I don't update old version16.02.
    You can use 7-Zip ver 23.01 instead from www.7-zip.org

     
  • Paul Semel

    Paul Semel - 2023-10-26

    Indeed, both options actually seem to work on newer versions of 7zip, my bad...

    Thanks a lot for helping!

     

Log in to post a comment.