-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
std.tar single file tars fail. #17620
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
Comments
I haven't read much into neither tar nor the API, but after taking a quick peek at the source code, I have a feeling this is not an issue with the tar implementation.
You seem to be trying to skip one directory level, although there are no directories to skip. Thus, and from testing, I conclude that this issue is not caused by extracting a single file but by |
Yeah, but the default for |
Even though it is the default behavior of the GNU tar program, I argue that, generally, it makes sense to be verbose when it comes to exceptions. Setting However - to play devil's advocate, I cannot think of a scenario where silently ignoring this issue, like you suggested, would be unappreciated. Also, another difference I have noticed to the GNU tar program is that |
I suppose that what this exposes is a lack of consensus around what the zig I feel like this is going to require thorough research into This should hopefully illustrate to people hoping to contribute to zig that just because something is contributor-friendly doesn't mean that it's easy. This might not require deep knowledge of Zig's internals, but deep knowledge of |
If this were a CLI, and therefore a finished product, I'd agree that this is a bug. Since it's a library, meant to be used to create a finished product, I agree with @DISTREAT 's first assertion that it instead makes sense to be verbose with errors. This way, the library user, who knows how they should be dealt with, can deal with them. |
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strips-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
I filed a PR for adding the 'strip components' option to
So that does differ from what But the *nix commandline zip doesn't have the same option and the one it does have works differently:
So that's four different ways of handling this:
We could keep it how it is, we could make std.tar behave like *nix tar since we've copied the option name. We can choose new option names and choose their behaviours and standardize them across std.tar, std.zip, etc. We can add a second option that specifies what happens when 'strip components'. Etc. Thoughts? |
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
This was the only kind of error which was raised in pipeToFileSystem and not added to Diagnostics. Shell tar silently ignores paths which are stripped out when used with `--strip-components` switch. This enables that same behavior, errors will be collected in diagnostics but caller is free to ignore that type of diagnostics errors. Enables use case where caller knows structure of the tar file and want to extract only some deeply nested folders ignoring upper files/folders. Fixes: ziglang#17620 by giving caller options: - not provide diagnostic and get errors - provide diagnostics and analyze errors - provide diagnostics and ignore errors
Zig Version
0.12.0-dev.985+e44152e25
Steps to Reproduce and Observed Behavior
tar -cvf test.tar exec
whereexec
is just a file.you attempt to untar it.
Results in:
I found this when working on solving #17462
Expected Behavior
It unzips the single file as expected.
The text was updated successfully, but these errors were encountered: