Star (*) is expanded into archive name in output path for 7z x command
A free file archiver for extremely high compression
Brought to you by:
ipavlov
7z seems to expand star (*) in the output (-o) path to archive's name. To reproduce:
mkdir test; cd test
touch file.txt
mkdir -p './star*path/output'
7z a NAME.7z file.txt
7z x -o'./star*path/output' NAME.7z
The result is creation of ./starNAMEpath/output/file.txt . Looks like a bug, since star is a legit path symbol and there is no mention that 7z expands it into anything in path as far as I can tell.
Also tried to add backslashes - they do not do anything(aside from appearing in path).
system: debian 13
7z version: 7-Zip 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03
64-bit locale=en_US.UTF-8 Threads:20 OPEN_MAX:524288, ASM
Sorry, first time using sourceforge, did not know it fucks up newlines in code formatting. Here is the thing in code block, but with new lines:
mkdir test; cd test
touch file.txt
mkdir -p './star*path/output'
7z a NAME.7z file.txt
7z x -o'./star*path/output' NAME.7z
It does not.
`
line 1
line 2
line 3
`
line 1 line 2 line 3```
line 1
line 2
line 3
```
Markdown Syntax Guide
Last edit: Sam Tansy 2 days ago
Okay, so sourceforge use markdown, good to know. But "Code" button gives just ``, not triple backticks. And I cant find a way to edit original post.
This is completely unrelated to the bugreport issue and a problem on the sourceforge poor interface (hiding this information behind a button does not help much for first time users like me. Simple notation "We use markdown" would be much better - I cant be bothered to read documentation on formatting of a site I do not intend to use more than one time).
I would much prefer at least a word on current topic - is this by chance intended behavior or not. Because if it is intended - '-o' is almost useless - because it does not treat path string just as string, but a path template, I now extract into temp folder for which I control path, to make sure contents does not go somewhere unpredictable or cause some wild issue from unintentional expansion of * into something malicious.
Last edit: lynx 2 days ago
Eeeeehhh.
That's what I get:
Which (~~~) is equivalent to ```.
--
Own ticket modification is impossible
You can join feature request, maybe if more people request it, it will work.
Last edit: Sam Tansy 2 days ago
It's feature for Windows version:
Linux version was released later. So it still uses that feature.
You can do it so now : create directory, change current directory to that created path, and then extract archive to that current directory.
Maybe we need new additional switch to turn off that feature in Linux.
Last edit: Igor Pavlov 2 days ago
Info-zip, and many other tools, use `--' for that purpose.
It's not only switches pathname expansion off but does it 'locally' i.e. only after switch all arguments are treated as paths, before expansion works as usual.