Feature Request : Respect symlinks and hardlinks and automatically save identical files as symlinks "ERROR: Dangerous link path was ignored"

Aperta
#309 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start by reading the ZIP extraction handling for symbolic links and the code that reports “Dangerous link path was ignored”; the issue does not name files or tests. Reproduce with the supplied Windows archive and -snld command, then determine whether the relative link targets are incorrectly rejected. Done means safe links in the archive extract as expected, with tests covering the reported cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi,

I have a situation where multiple subsequent version of a folder is being saved
Most of these files are identical
I tried transforming them into hardlinks and symlinks

For example consider this folder

image image

I have created two copies of this folder

One where all identical files were replaced with hardlinks and another where they were replaced with symlinks using dupeguru

image image

I then verified they were all identical to the original and they were

image

I compressed all of these files, and then decompressed again

The file were created this way

image

And here is the size of each of those zip files

image

Here is the size of each folders

image

So, it appears that even Explorer cannot really tell if that the hardlinked, deduplicated files do not really use the space up

But they really are hardlinks

image

Looking at the compression options, I can't see an option to respect either the softlinks nor hardlinks

image

And searching on google about this

image

It does appear that the -snl option should allow this

So I will try doing this using the command line instead

image

And that does work

image

And to make sure, I decompressed all 3 and then verified them against the originals again using winmerge

Unfortunately, that did not work as expected

image image

And I don't know if this is because the path was too long, or because 7zip always refuses to decompress symlinks in files ?

I do know that, while users can create hardlinks, user cannot create symlinks for very silly reasons on windows. (microsoft incompetence)

But perhaps an elevated command line could decompress the file manually, at least to confirm the zip file itself was not malformed and verify if the problem is only related to the decompression.

First I tried a non-elevated command line.
It refuses to create symlinks, it should just create copies of the file at the very least if it cannot create a symlink !!

And I am getting lots of error

D:\dev\7ziptest\test>7z x Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked.commandline.zip

7-Zip 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03

Scanning the drive for archives:
1 file, 76008956 bytes (73 MiB)

Extracting archive: Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked.commandline.zip
--
Path = Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked.commandline.zip
Type = zip
Physical Size = 76008956

 17% 4846 - Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked\Tab-Manager-Plus-Improvements-Project-0.2.102-Refactor-Step3A\doc\v0276-reviewed-package-delta.json

...

ERROR: Dangerous link path was ignored : Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked\Tab-Manager-Plus-Improvements-Project-0.2.110\patches\own-tab-reuse\doc\version-history.md : ..\..\..\..\Tab-Manager-Plus-Improvements-Project-0.2.106-R1-Portable-Node-Hotfix\patches\own-tab-reuse\doc\implementation.md
ERROR: Dangerous link path was ignored : Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked\Tab-Manager-Plus-Improvements-Project-0.2.110\patches\own-tab-reuse\files\src\helpers\settings.ts : ..\..\..\..\..\..\Tab-Manager-Plus-Improvements-Project-0.2.105-Refactor-Step5\patches\own-tab-reuse\files\src\helpers\settings.ts
ERROR: Dangerous link path was ignored : Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked\Tab-Manager-Plus-Improvements-Project-0.2.110\patches\own-tab-reuse\files\src\popup\settingsFile.ts : ..\..\..\..\..\..\Tab-Manager-Plus-Improvements-Project-0.2.109\patches\own-tab-reuse\files\src\popup\settingsFile.ts

...


Sub items Errors: 21455

Archives with Errors: 1

Sub items Errors: 21455

D:\dev\7ziptest\test>

And the winmerge check

image

Next I tried using using 7z on the command line inside an administrative console which should have the capability of creating a symlink

However the results were identical

Sub items Errors: 21455

Archives with Errors: 1

Sub items Errors: 21455

D:\dev\7ziptest\test>

At this point I asked the machine for advice
It suggested using -snld

Unfortunately, even in administrative console, -snld fails to create the symlink, incorrectly reporting the symlink as dangerous and ignoring it with no alternative

D:\dev\7ziptest\test>7z x -snld Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked.commandline.zip

7-Zip 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03

Scanning the drive for archives:
1 file, 76008956 bytes (73 MiB)

Extracting archive: Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked.commandline.zip
--
Path = Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked.commandline.zip
Type = zip
Physical Size = 76008956

ERROR: Dangerous link path was ignored : Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked\Tab-Manager-Plus-Improvements-Project-0.2.100-Refactor-Step1\build-all.bat : ..\Tab-Manager-Plus-Improvements-Project-0.2.112\build-all.bat
ERROR: Dangerous link path was ignored : Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked\Tab-Manager-Plus-Improvements-Project-0.2.100-Refactor-Step1\build.bat : ..\Tab-Manager-Plus-Improvements-Project-0.2.106-R1-Portable-Node-Hotfix\build.bat
ERROR: Dangerous link path was ignored : Tab-Manager-Plus-Improvements-Project-0.2.100-to-0.2.113-symlinked\Tab-Manager-Plus-Improvements-Project-0.2.100-Refactor-Step1\build.sh : ..\Tab-Manager-Plus-Improvements-Project-0.2.107\build.sh
Lingua principale
C++
Stelle
4.6k
Fork
519
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ip7z/7zip

Tutte le issue di ip7z/7zip

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.