[Reproducible-commits] [strip-nondeterminism] 01/05: zip: preserve execute bit when normalizing permissions

Andrew Ayer agwa at andrewayer.name
Fri Feb 6 17:55:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

agwa-guest pushed a commit to branch debian
in repository strip-nondeterminism.

commit 2a85629644489c8a375c5718035892fbb46f0a53
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Fri Feb 6 09:46:08 2015 -0800

    zip: preserve execute bit when normalizing permissions
    
    Previously, all files were being normalized to 644 permissions, including
    directories and executable files!
    
    Now, files are normalized to 755 permissions if the owner execute bit is
    set on the original file.  This is the same logic that Git uses.
---
 lib/File/StripNondeterminism/handlers/zip.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/File/StripNondeterminism/handlers/zip.pm b/lib/File/StripNondeterminism/handlers/zip.pm
index 5b214b8..b1be666 100644
--- a/lib/File/StripNondeterminism/handlers/zip.pm
+++ b/lib/File/StripNondeterminism/handlers/zip.pm
@@ -126,7 +126,9 @@ sub normalize {
 		$zip->addMember($member);
 		$options{member_normalizer}->($member) if exists $options{member_normalizer};
 		$member->setLastModFileDateTimeFromUnix($File::StripNondeterminism::canonical_time // SAFE_EPOCH);
-		$member->unixFileAttributes(0644) if $member->fileAttributeFormat() == FA_UNIX;
+		if ($member->fileAttributeFormat() == FA_UNIX) {
+			$member->unixFileAttributes(($member->unixFileAttributes() & 0100) ? 0755 : 0644);
+		}
 		$member->cdExtraField(normalize_extra_fields($member->cdExtraField(), CENTRAL_HEADER));
 		$member->localExtraField(normalize_extra_fields($member->localExtraField(), LOCAL_HEADER));
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git



More information about the Reproducible-commits mailing list