Page MenuHomeSoftware Heritage

tarball: Fix also directory permissions in normalize_permissions
ClosedPublic

Authored by anlambert on Oct 11 2022, 5:14 PM.

Details

Summary

It exist cases when an uncompressed tarball has directories without
any traversal or read permissions so ensure to also fix directory
permissions in normalize_permissions function.

I spotted that issue while testing the CPAN loader in docker.
It is also happening when attempting to load some PyPI and Maven packages.
(see Sentry issues below).

Fixes SWH-LOADER-CORE-1AZ and SWH-LOADER-CORE-ZW

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8660 (id=31276)

Rebasing onto be9403c676...

Current branch diff-target is up to date.
Changes applied before test
commit 3d42643e4e412875e14739d4cc5841d8accdc33f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Oct 11 17:09:26 2022 +0200

    tarball: Fix also directory permissions in normalize_permissions
    
    It exist cases when an uncompressed tarball has directories without
    any traversal or read permissions so ensure to also fix directory
    permissions in normalize_permissions function.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/478/ for more details.

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/core/tarball.py
181–186

for all dirs but the root, your code chmods when dirpath is their parent , so there is no need to chmod again when dirpath is themselves

This revision is now accepted and ready to land.Oct 12 2022, 9:40 AM

Build is green

Patch application report for D8660 (id=31289)

Rebasing onto be9403c676...

Current branch diff-target is up to date.
Changes applied before test
commit 6012be54994c8e48f8cc105a27bc89f2cc249941
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Oct 11 17:09:26 2022 +0200

    tarball: Fix also directory permissions in normalize_permissions
    
    It exist cases when an uncompressed tarball has directories without
    any traversal or read permissions so ensure to also fix directory
    permissions in normalize_permissions function.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/481/ for more details.