An include list file with no names makes `l`/`t`/`x` fail with "Cannot use absolute pathnames for this command", while `a`/`h`/`d` accept it
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
- 58/100
Direzione di ricerca
Start by reading CPP/7zip/UI/Common/ArchiveCommandLine.cpp around the empty censor handling and the relative path check, then inspect CPP/Common/Wildcard.h and the Pairs.Front() uses in Main.cpp mentioned in the report. Reproduce with an empty include list and compare a, h, d, l, t and x. Done when the commands handle the empty selection consistently without breaking the Pairs.Front() assumptions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- 7-Zip (z) 26.06 (arm64),
ip7z/7zip@d3296e3, built withCPP/7zip/cmpl_mac_arm64.mak(Bundles/Alone2) - macOS arm64, Apple clang
Description
When the only include source is an empty list file, a, h and d finish with rc=0 and select nothing. l, t and x stop with Command Line Error: Cannot use absolute pathnames for this command (rc=7), although no path was given at all.
Steps to reproduce
Z=7zz
d=$(mktemp -d) && cd "$d"
echo hi > a.txt; : > e.lst; $Z a -bd g.7z a.txt >/dev/null
for c in "a -bd n.7z" "h -bd" "d -bd g.7z" "l -bd g.7z" "t -bd g.7z" "x -bd -y -oxo g.7z"; do
$Z $c [email protected] >out.txt 2>&1; rc=$?
echo "7zz $c [email protected] => rc=$rc | $(grep -E 'Command Line|absolute|Everything' out.txt | tr '\n' ' ')"
done
Observed (two runs, identical):
7zz a -bd n.7z [email protected] => rc=0 | Everything is Ok
7zz h -bd [email protected] => rc=0 | Everything is Ok
7zz d -bd g.7z [email protected] => rc=0 | Everything is Ok
7zz l -bd g.7z [email protected] => rc=7 | Command Line Error: Cannot use absolute pathnames for this command
7zz t -bd g.7z [email protected] => rc=7 | Command Line Error: Cannot use absolute pathnames for this command
7zz x -bd -y -oxo g.7z [email protected] => rc=7 | Command Line Error: Cannot use absolute pathnames for this command
@e.lst as a positional operand behaves the same.
Expected
The documentation says only that a list file holds file names separated by newlines:
You can supply one or more filenames or wildcards for special list files (files containing lists of files). The filenames in such list file must be separated by new line symbol(s).
(https://7-zip.opensource.jp/chm/cmdline/syntax.htm). It does not make an empty list an error. The same list should behave the same in every command: either select nothing everywhere, or fail everywhere with a message that names the real problem (an empty list), not an absolute-path problem.
Actual
See the table above: three commands succeed, three fail with a message about absolute pathnames that does not apply.
Root cause (analysis on d3296e3)
CPP/7zip/UI/Common/ArchiveCommandLine.cpp:578adds the default*item only when there are no non-switch operands and no-iswitch. An[email protected]counts as a switch include and an@e.lstoperand counts as an operand, so the censor stays empty (Pairs.Size() == 0).ArchiveCommandLine.cpp:1663-1668(extract/list group):if (!options.Censor.AllAreRelative()) throw CArcCmdLineException("Cannot use absolute pathnames for this command");.CPP/Common/Wildcard.h:201-202:AllAreRelative()isPairs.Size() == 1 && Pairs.Front().Prefix.IsEmpty(). With zero pairs it returns false, which the caller reads as "some path is absolute".a/h/ddo not run this check, so they continue with an empty selection.
Suggested fix
Treat an empty pair list as relative in AllAreRelative() (for example Pairs.Size() == 0 || ...), or check for an empty censor before the absolute-path test and either report "no files specified" or fall through to select nothing, in the same way for all commands. Also note Main.cpp:1410 and Main.cpp:1536 call options.Censor.Pairs.Front() and rely on that earlier exception to keep Pairs non-empty, so the fix must keep that invariant.
Found with a differential test setup (a model of the documented behavior, and for some reports an independent tool such as libarchive/bsdtar, 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
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
area::installer documentation engine::sd enhancement wg::platform-core
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
lemonade-sdk/lemonade#4349 ·
I maintainer di solito rispondono entro 1 giorno
-
Python example: list a model's scenes and their camerasForse già presa @rudraparmar76 l’ha presa oggi. Apertadocumentation good first issue python
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
iamahsanmehmood/openskp#796 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tenstorrent/tt-umd#4183 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
odelaneau/GLIMPSE#353 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni