Package: libfile-stripnondeterminism-perl
Version: 0.003-1
Severity: normal
Tags: patch

The GNU toolchain uses newlines as padding, but the Go toolchain
writes null bytes. See the endFile function in pack.go:
http://golang.org/src/cmd/pack/pack.go#L384

Because strip-nondeterminism checks the contents of the padding byte,
it fails on Go's archives. The attached patch makes
strip-nondeterminism ignore the contents of the padding byte. 


-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.18.0-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=nl_BE.UTF-8, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libfile-stripnondeterminism-perl depends on:
ii  libarchive-zip-perl  1.39-1
ii  perl                 5.20.1-4

libfile-stripnondeterminism-perl recommends no packages.

libfile-stripnondeterminism-perl suggests no packages.

-- no debconf information
>From 9d0340c0aa36a8d6f0cb84d4ef950ba4246874e5 Mon Sep 17 00:00:00 2001
From: Peter De Wachter <pdewa...@gmail.com>
Date: Sat, 17 Jan 2015 12:26:52 +0100
Subject: [PATCH] Ar files: ignore contents of padding bytes

The GNU toolchain uses newlines as padding, but the Go toolchain
writes null bytes. See the endFile function in pack.go:
http://golang.org/src/cmd/pack/pack.go#L384
---
 lib/File/StripNondeterminism/handlers/ar.pm | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lib/File/StripNondeterminism/handlers/ar.pm b/lib/File/StripNondeterminism/handlers/ar.pm
index cdbf7c0..c74f45b 100644
--- a/lib/File/StripNondeterminism/handlers/ar.pm
+++ b/lib/File/StripNondeterminism/handlers/ar.pm
@@ -76,14 +76,8 @@ sub normalize {
 		syswrite $fh, sprintf("%-8o", 0644);
 
 		# 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";
-		}
+		my $padding = $file_size % 2;
+		seek $fh, $file_header_start + $FILE_HEADER_LENGTH + $file_size + $padding, SEEK_SET;
 
 	}
 
-- 
2.1.4

Reply via email to