`u -uq3` (anti-item action) on zip and tar silently stores the deleted file as an empty regular file; 7z stores a real anti-item
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Start with UpdateCallback.cpp:483-494 and :601-621 to see how anti items reach the format handlers, then compare Archive/7z/7zHandlerOut.cpp:555 with the zip and tar handlers. Reproduce with the supplied commands for zip and tar. Done when the update no longer stores or extracts a deleted item as a zero-byte file, while 7z behavior remains as documented.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
7-Zip (z) 26.06 (arm64), ip7z/7zip @ d3296e3, macOS 26.4.1 arm64
Steps to reproduce
d=$(mktemp -d) && cd "$d"
for t in 7z zip tar; do
rm -rf w xo; mkdir w; cd w
printf aaa > keep.txt; printf bbb > gone.txt
7zz a -bd -t$t ../x.$t keep.txt gone.txt > /dev/null
rm gone.txt # file disappears from disk
7zz u -bd -uq3 ../x.$t keep.txt gone.txt > /dev/null 2>&1 # q3: item only in archive -> anti-item
cd ..
echo "== $t"; 7zz l -slt x.$t | grep -E '^(Path|Size|Anti) =' | tail -n +2 | tr '\n' ' '; echo
7zz x -y -bd -oxo x.$t > /dev/null 2>&1; echo "extracted: $(ls xo | tr '\n' ' ')"
rm -f x.$t
done
Output:
== 7z gone.txt Size=0 Anti=+ keep.txt Size=3 Anti=- extracted: keep.txt
== zip gone.txt Size=0 keep.txt Size=3 extracted: gone.txt keep.txt
== tar gone.txt Size=0 keep.txt Size=3 extracted: gone.txt keep.txt
(The u command itself returns 1 because gone.txt is missing on disk; the same happens for 7z.)
Expected
The -u documentation says of action 3 ("Create Anti-item"): "This feature is supported only in 7z format." So for zip and tar the update action should be rejected with an error (or ignored). Either the update action is rejected for formats that cannot represent anti-items, or the archive does not contain gone.txt at all. The archive should not contain a 0-byte file that was never on disk, and extraction should not create it.
Actual
For zip and tar, gone.txt becomes a regular 0-byte entry and is created by extraction. 7z keeps a real anti-item (Anti = +) that is not extracted.
Root cause (analysis on d3296e3)
UpdateCallback.cpp:483-494 and :601-621 report such items to the format handler with size 0 and kpidIsAnti. Only Archive/7z/7zHandlerOut.cpp:555 queries kpidIsAnti. The zip and tar handlers never read it and write the item as a normal empty file.
Suggested fix
In the zip and tar handlers, skip anti items (or fail the update with a clear message) instead of writing an empty file.
Found with a differential test setup (a model of the documented behavior compared against the real binary) and then checked by hand: every command above was re-run verbatim on the tested build, and the root cause was read in the source. Tested commit: d3296e3 (26.06).
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ip7z/7zip
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
bug low priority preprocessor
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
-
Make the HTTP server's keep-alive and headers timeouts configurableForse già presa @mattgodbolt l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
compiler-explorer/compiler-explorer#9902 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Nixtla/statsforecast#1371 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno