Menu

#435 Cannot create symbolic link while extracting ext4 filesystem

open
nobody
None
3
2022-11-16
2022-10-11
linjingbi
No

Hi,
i am using 7zip 22.01 to extract filesystem from a .img file which is a ext4 filesystem and the extraction failed with cannot create symbolic link, but if i use mount, all the symbolic links are created successfully.

I am running those commands on ubuntu 18.04. And the 7zip is installed from here:
https://sourceforge.net/projects/sevenzip/files/7-Zip/21.07/7z2107-linux-x64.tar.xz/download

Here are my commands, error happened when extracting 1.img.
$ curl -LO https://packages.vmware.com/photon/4.0/Rev2/ova/photon_uefi.ova
$ 7zz x photon_uefi.ova
$ 7zz x photon-disk1.vmdk
$ mkdir tmp
$ 7zz x -otmp 1.img
And error log attached as 7zz.log.

Can someone help to take a look at it?

Thanks!
Ellen

1 Attachments

Discussion

  • linjingbi

    linjingbi - 2022-10-11

    need to correct that the 7zip version is 21.07, not 22.01.

     
  • Igor Pavlov

    Igor Pavlov - 2022-10-11

    There are 2 problems with that case:
    1) Problem-1:

    ERROR: Dangerous symbolic link path was ignored
    

    you can fix that problem with -snld switch

    2) Problem-2:

    : Cannot create symbolic link : errno=17 : File exists
    

    Probably it's bug in 7-zip for Linux. 7-Zip can't create symbolic link to directory, if 7-Zip knows that the link to directory. In that case 7-zip creates directory item instead of link and then it can't set the link for that existing filesystem item. I'll try to fix that code in next version of 7-Zip.

    Thanks for report!

     
  • linjingbi

    linjingbi - 2022-10-11

    thanks for the quick response!!! so that means 7-zip has this create symbolic issue for all support format, not just ext4, right? Because I also have other filesystem types, just want to be clear about the scope.

    Thanks!

     
  • Igor Pavlov

    Igor Pavlov - 2022-10-11

    I suppose that it's problem only for some formats, where 7-zip looks filesystem tree structure. So it can detect that symlink links to directory. If 7-zip doesn't look another items, it thinks that link is file and doesn't create dir item.
    For example, 7-Zip doesn't look links in tar archive, so extracting such links from tar archive works correctly, as I can see.

    That code was developed for Windows, where symbolic link to directory is also directory itself, so it has both directory and link flags and attributes. So it was not problem in Windows, if we create directory item before link creation.

     

    Last edit: Igor Pavlov 2022-10-11
  • linjingbi

    linjingbi - 2022-10-11

    I see now! Thanks for the explanation!!! Kindly ask do you have an ETA for next release? Because i am actually counting on 7-zip to support part of our product's function:)

     
  • Igor Pavlov

    Igor Pavlov - 2022-10-11

    I hope it will be in one month.

     
  • Aaron Hamid

    Aaron Hamid - 2022-11-16

    I have a patch that seemed to fix the problem for me with Ext format, but it's not heavily tested.

    The problem here is that a symlink to a directory is being interpreted as "a directory" and therefore created as a directory before the linking process. The fix is to change the Archive_IsItem_Dir call in CPP/7zip/UI/Common/OpenArchive.cpp CArc::GetItem method to one which only assigns IsDir=true if kpidSymLink property is not set.

    https://github.com/ahamid/7-Zip/pull/1/files

     

    Last edit: Aaron Hamid 2022-11-16

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.