Menu

#2174 directory symlink unpacked as file symlink

None
open-later
None
5
2024-08-22
2019-01-01
No

On Windows, directory symlinks and file symlinks are not the same.
If wrong type is used, the symlink just cannot be followed.
7z sometimes creates file symliks where directory symlinks should be.

In the following test case C:\User\t\lldb-7.0.1.src\packages\Python\lldbsuite\test is is a directory so C:\User\t\lldb-7.0.1.src\test\testcases must be SYMLINKD, not a SYMLINK

==================================
C:\User>curl --output lldb-7.0.1.src.tar.xz
https://releases.llvm.org/7.0.1/lldb-7.0.1.src.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 18.4M 100 18.4M 0 0 18.4M 0 0:00:01 0:00:01 --:--:-- 12.0M

C:\User\t>7z x lldb-7.0.1.src.tar.xz -so | 7z x -aoa -si -ttar

7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30

Extracting archive:

Path =
Type = tar
Code Page = UTF-8

Everything is Ok

Folders: 1019
Files: 6728
Size: 86090754
Compressed: 4656128

C:\User\t>dir lldb-7.0.1.src\test
Volume in drive C has no label.
Volume Serial Number is 4484-BEB3

Directory of C:\User\t\lldb-7.0.1.src\test

12/15/2018 04:51 AM

.
12/15/2018 04:51 AM ..
07/04/2018 01:59 PM 4,513 CMakeLists.txt
10/28/2015 07:59 PM 134 dotest.py
01/01/2019 01:28 AM <symlink> testcases
[..\packages\Python\lldbsuite\test]
09/06/2016 08:57 PM 679 use_lldb_suite.py
4 File(s) 5,326 bytes
2 Dir(s) 172,752,535,552 bytes free

C:\User\t>dir lldb-7.0.1.src\packages\Python\lldbsuite
Volume in drive C has no label.
Volume Serial Number is 4484-BEB3

Directory of C:\User\t\lldb-7.0.1.src\packages\Python\lldbsuite

12/15/2018 04:51 AM

.
12/15/2018 04:51 AM ..
09/06/2016 05:19 PM 107 .clang-format
12/15/2018 04:51 AM pre_kill_hook
12/15/2018 04:51 AM support
12/15/2018 04:51 AM test
12/15/2018 04:51 AM test_event
09/06/2016 08:57 PM 741 init.py
2 File(s) 848 bytes
6 Dir(s) 172,693,954,560 bytes free

</symlink>

Discussion

  • Denis Petrov

    Denis Petrov - 2019-01-01

    On Windows, directory symlinks and file symlinks are not the same.
    If wrong type is used, the symlink just cannot be followed.
    7z sometimes creates file symliks where directory symlinks should be.

    In the following test case C:\User\t\lldb-7.0.1.src\packages\Python\lldbsuite\test is is a directory so C:\User\t\lldb-7.0.1.src\test\testcases must be SYMLINKD, not a SYMLINK

    C:\User>curl --output lldb-7.0.1.src.tar.xz
    https://releases.llvm.org/7.0.1/lldb-7.0.1.src.tar.xz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 18.4M  100 18.4M    0     0  18.4M      0  0:00:01  0:00:01 --:--:-- 12.0M
    
    C:\User\t>7z x lldb-7.0.1.src.tar.xz -so  |  7z x -aoa -si -ttar
    
    7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
    
    
    Extracting archive:
    --
    Path =
    Type = tar
    Code Page = UTF-8
    
    Everything is Ok
    
    Folders: 1019
    Files: 6728
    Size:       86090754
    Compressed: 4656128
    
    C:\User\t>dir lldb-7.0.1.src\test
     Volume in drive C has no label.
     Volume Serial Number is 4484-BEB3
    
     Directory of C:\User\t\lldb-7.0.1.src\test
    
    12/15/2018  04:51 AM    <DIR>          .
    12/15/2018  04:51 AM    <DIR>          ..
    07/04/2018  01:59 PM             4,513 CMakeLists.txt
    10/28/2015  07:59 PM               134 dotest.py
    01/01/2019  01:28 AM    <SYMLINK>      testcases
    [..\packages\Python\lldbsuite\test]
    09/06/2016  08:57 PM               679 use_lldb_suite.py
                   4 File(s)          5,326 bytes
                   2 Dir(s)  172,752,535,552 bytes free
    
    C:\User\t>dir lldb-7.0.1.src\packages\Python\lldbsuite
     Volume in drive C has no label.
     Volume Serial Number is 4484-BEB3
    
     Directory of C:\User\t\lldb-7.0.1.src\packages\Python\lldbsuite
    
    12/15/2018  04:51 AM    <DIR>          .
    12/15/2018  04:51 AM    <DIR>          ..
    09/06/2016  05:19 PM               107 .clang-format
    12/15/2018  04:51 AM    <DIR>          pre_kill_hook
    12/15/2018  04:51 AM    <DIR>          support
    12/15/2018  04:51 AM    <DIR>          test
    12/15/2018  04:51 AM    <DIR>          test_event
    09/06/2016  08:57 PM               741 __init__.py
                   2 File(s)            848 bytes
                   6 Dir(s)  172,693,954,560 bytes free
    
     
  • Igor Pavlov

    Igor Pavlov - 2019-01-01
    • status: open --> open-later
    • Group: -->
     
  • Igor Pavlov

    Igor Pavlov - 2019-01-01

    Now it can be difficult to fix.
    Maybe later.

     
  • Denis Petrov

    Denis Petrov - 2019-01-12

    Yes, this might require to track all created symlinks and after full unpack to check where do they point to, because the file or directory might be unpacked after the symlink and its type is not yet known at the time of symlink creation.
    If you accept pull requests I can fix this bug

     
  • Igor Pavlov

    Igor Pavlov - 2019-01-12

    Maybe later.

     
  • Jerry

    Jerry - 2024-08-22

    @ipavlov this bug renders many orgs to be stuck on version 17x. There are so many great improvements in 18+, this bug is a really big problem for many orgs. Would you be willing to take this on this year?

     

Log in to post a comment.

MongoDB Logo MongoDB