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

[regression] untargz fails extracting some folders #17998

Merged
merged 4 commits into from
Mar 25, 2025

Conversation

franramirez688
Copy link
Contributor

@franramirez688 franramirez688 commented Mar 20, 2025

Changelog: Bugfix: untargz() method was failing if directories had a more restrictive mode.
Docs: omit
Closes: #17987

Now, it does not show the file percentage until we find a better solution for that:

Python 3.12.3 (works as expected)

conanfile.py (test/1.0): Downloading 142.8MB x-tools-x86_64-bionic-linux-gnu-gcc14.tar.xz
conanfile.py (test/1.0): Unzipping x-tools-x86_64-bionic-linux-gnu-gcc14.tar.xz to /tmp/tmp52l7sgb4

The key part is here (from tarfile.py):

class TarFile(object):
    # ....

    def extractall(self, path=".", members=None, *, numeric_owner=False,
                   filter=None):
        # ...
        for member in members:
            tarinfo = self._get_extract_tarinfo(member, filter_function, path)
            if tarinfo is None:
                continue
            if tarinfo.isdir():
                # For directories, delay setting attributes until later,
                # since permissions can interfere with extraction and
                # extracting contents can reset mtime.
                directories.append(tarinfo)
            self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
                              numeric_owner=numeric_owner)

        # Do some stuff with directories

In a nutshell, it's not setting the attributes for those directories at that point, it's done later. It's not the same as it's done by the extract() method.

@franramirez688 franramirez688 marked this pull request as ready for review March 21, 2025 15:37
tgz.close()


def test_decompressing_folders_with_different_modes():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails in the develop2 branch.

@memsharded memsharded added this to the 2.15.0 milestone Mar 25, 2025
@czoido czoido merged commit 6a57a66 into conan-io:develop2 Mar 25, 2025
15 checks passed
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

Successfully merging this pull request may close these issues.

[bug] Regression - Conan 2.13-2.14 fail to extract tar files with read-only directories
4 participants