[Reproducible-commits] [strip-nondeterminism] 01/01: Fix how ar handler deals with padding
Andrew Ayer
agwa at andrewayer.name
Wed Oct 1 18:05:45 UTC 2014
This is an automated email from the git hooks/post-receive script.
agwa-guest pushed a commit to branch master
in repository strip-nondeterminism.
commit 4ec308b6714b7926567f7c2b7374ea874c2e6b10
Author: Andrew Ayer <agwa at andrewayer.name>
Date: Wed Oct 1 11:04:37 2014 -0700
Fix how ar handler deals with padding
---
lib/File/StripNondeterminism/handlers/ar.pm | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/File/StripNondeterminism/handlers/ar.pm b/lib/File/StripNondeterminism/handlers/ar.pm
index ca4a0a8..e23485d 100644
--- a/lib/File/StripNondeterminism/handlers/ar.pm
+++ b/lib/File/StripNondeterminism/handlers/ar.pm
@@ -58,9 +58,6 @@ sub normalize {
#48 57 File size in bytes Decimal
#58 59 File magic \140\012
- # not quite sure if this is correct but it seems to work
- last if $count == 1 and eof($fh) and $buf eq "\n";
-
die "Incorrect header length"
if length $buf != $FILE_HEADER_LENGTH;
die "Incorrect file magic"
@@ -80,6 +77,14 @@ sub normalize {
# move to next member
seek $fh, $file_header_start + $FILE_HEADER_LENGTH + $file_size, SEEK_SET;
+
+ # if file has an odd length, it is padded with a single \n character
+ if ($file_size % 2 == 1) {
+ $count = read $fh, $buf, 1;
+ die "reading $file failed: $!" if !defined $count;
+ die "Incorrect file padding" if $buf ne "\n";
+ }
+
}
return 1;
--
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