Skip to content
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

Type of dir argument for Tar.extract #179

Closed
cgarling opened this issue May 27, 2024 · 1 comment
Closed

Type of dir argument for Tar.extract #179

cgarling opened this issue May 27, 2024 · 1 comment

Comments

@cgarling
Copy link

Given a directory that has been converted into a tar archive, say "archive.tar", it is often typical to extract this into a directory simply named "archive". The obvious way to achieve this programmatically, for example, when you want to extract a list of tar archives input_files, is to set the list of output directory names as output_list = map(x->split(x,".tar")[1], input_files). However, split returns output with types SubString{String}. While Tar.extract accepts dir::AbstractString, I receive a downstream error from Tar.extract_tarball which requires the output root directory to be a String, with signature extract_tarball(predicate::Function, tar::IO, root::String; kws...).

This can be solved if the user converts the SubString to a standard String before passing to Tar.extract. This is not terribly inconvenient, but I hit this snag in my first attempt to use this package and it confused me for a few minutes. Is there a technical reason why the type of root cannot be any AbstractString in Tar.extract_tarball? Or perhaps Tar.extract should convert dir to a standard String before passing it to Tar.extract_tarball?

Running Julia 1.10.3 with Tar 1.10.0.

@StefanKarpinski
Copy link
Member

Can reproduce. This is definitely a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants