-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tarsnap fails at extracting filenames with brackets #329
Comments
Hmm. This is a difference in behaviour between GNU tar and BSD tar:
I can't see any issues for "brackets" or "squares" in the libarchive project (even in closed issues and PRs), so apparently this has never come up before? I'll continue to look into libarchive to see if it's feasible to add it there. |
What I found interesting (and weird) is that it works if it's escaped ... but I can't imagine what the logic is for escaping things when there's no shell expansion. Does libarchive itself do some kind of wildcard expansion? |
I believe that we do shell globbing when matching files to extract from an archive. |
After editing
|
(err, |
Yeah, it's all about
and then:
|
Which I guess then leaves the question: should users be expected to escape globbing chars on the way in? (Or perhaps should there be a command line switch which turns them off?) |
well, GNUtar behaves differently. I'm looking up whether they still use fnmatch and escape the |
ok, they wrote their own Unless @cperciva says otherwise, I think the thing to do here is improve our man-page so that users can find out that the include and exclude patterns have some special characters (and that the extra pathnames for |
I have gone ahead and worked around this in redsnapper: |
Hi @scotchi. Thanks for the report! We now mention |
If you create an archive with files with brackets in it, you can't extract them by name unless you escape them ... even when bypassing the shell.
e.g.
But then:
It works if you escape the brackets with backslashes, but that doesn't seem like it should be necessary. To make sure it wasn't any shell injected stuff that I wasn't aware of, I did it directly with
exec
to test:And there the error persists. (This got reported as a redsnapper issue.)
The text was updated successfully, but these errors were encountered: