You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to extract a.txt. But this only happens for the .tar.gz archive. For the zip, I need to specify root_dir in the pattern.
Both behaviours can be argued for (though I'd say if I pass strip_root, I have expressed I do not care about the root directory, and do not want to pass its name in my pattern -- that's half the point of the option) but it should certainly be consistent.
Logs
No response
The text was updated successfully, but these errors were encountered:
It seems you are using the legacy from conans tools. These are no longer recommended and will not get any changes anymore. Please update to the new tools from conan.tools.files import xxxx. In that new scope the untargz is not exposed anymore, it is internal only, so unzip() should always be used.
Hi, ok, but is the behaviour actually fixed there? The problem is not with the untargz function signature, it is with the logic itself. Calling unzip for both archives has the same problem.
Hi, ok, but is the behaviour actually fixed there?
I don't know, it is possible that the issue is still happening there. But also new tools have fixed tons of issues, so it might be possible that it is fixed too. As legacy tools will not get the fixes anyway, the recommendation is to update to the new tools and report against those. Having a quick look to the new tools, it seems they are using the same fnmatch() expression for the pattern, both for unzip and untargz, so apparently this should behave the same, and this would need to be further investigated, once confirmed it keeps happening with the new tools. Many thanks!
Environment details
Conan version 1.57.0
Steps to reproduce
Consider an archive with a structure like this
This is compressed once as .tar.gz and once as .zip. I would expect this command:
conans.tools.unzip("archive.XXX", pattern="a.txt", strip_root=True)
to extract a.txt. But this only happens for the .tar.gz archive. For the zip, I need to specify root_dir in the pattern.
Both behaviours can be argued for (though I'd say if I pass strip_root, I have expressed I do not care about the root directory, and do not want to pass its name in my pattern -- that's half the point of the option) but it should certainly be consistent.
Logs
No response
The text was updated successfully, but these errors were encountered: