Bug#859103: strip-nondeterminism: does not replace all timestamps in zip archives

2018-03-27 Thread Benjamin Moody
Package: strip-nondeterminism
Version: 0.034-1
Followup-For: Bug #859103

This is especially annoying because the "local extra field" includes
the file *access* time:

   $ rm -f foo 1.zip 2.zip
   $ touch -d 2015-01-01 foo
   $ zip 1.zip foo
   $ zip 2.zip foo
   $ strip-nondeterminism 1.zip 2.zip
   $ diffoscope 1.zip 2.zip
...
 0010:      0300 1c00 666f  ..fo
-0020: 6f55 5409 0003 50d4 a454 50d4 a454 7578  oUT...P..TP..Tux
+0020: 6f55 5409 0003 50d4 a454 62a1 ba5a 7578  oUT...P..Tb..Zux
 0030: 0b00 0104 e803  04e8 0300 0050 4b01  .PK.
...

(Which makes me think, for testing build reproducibility, it'd be
wise to try one build using noatime and another using
strictatime.  But anyway...)


The problem here is that Archive::Zip::ZipFileMember is not
designed to allow modifying the localExtraField() at all.  From
the man page:

   localExtraField( [ $newField ] )
   localExtraField( [ { field => $newField } ] )
   Gets or sets the extra field that was read from the local header.
   This is not set for a member from a zip file until after the member
   has been written out. The extra field must be in the proper format.

That is to say, before calling $zip->overwrite(),
localExtraField() returns an empty string.  Moreover, for
ZipFileMembers, manually setting the field has no effect - even
if you call overwrite(), then go back and modify the
localExtraFields, then call overwrite() again, it will re-read
the fields from the zip file.

(As far as I can tell, the *only* way to manually specify a
localExtraField using Archive::Zip is to decompress and
recompress each member.)


Here is a rather kludgy patch to make Archive::Zip behave the way
that strip-nondeterminism seems to expect:

--- /usr/share/perl5/Archive/Zip/ZipFileMember.pm
+++ Archive/Zip/ZipFileMember.pm
@@ -43,6 +43,25 @@
   and $self->uncompressedSize == 0);
 }
 
+sub localExtraField {
+my $self = shift;
+
+# If this function is called with an argument, it overrides the
+# original field contents from the source archive.
+if (@_) {
+$self->{'_localExtraFieldUserDefined'} = 1;
+}
+# Otherwise, the value is loaded lazily, the first time it is needed.
+elsif (!defined $self->{'_localExtraFieldUserDefined'}
+   and defined $self->{'externalFileName'}) {
+my $origpos = $self->fh()->tell();
+$self->rewindData();
+$self->fh()->seek($origpos, IO::Seekable::SEEK_SET);
+}
+
+return $self->SUPER::localExtraField(@_);
+}
+
 # Seek to the beginning of the local header, just past the signature.
 # Verify that the local header signature is in fact correct.
 # Update the localHeaderRelativeOffset if necessary by adding the 
possibleEocdOffset.
@@ -156,10 +175,17 @@
 }
 
 if ($extraFieldLength) {
-$bytesRead =
-  $self->fh()->read($self->{'localExtraField'}, $extraFieldLength);
-if ($bytesRead != $extraFieldLength) {
-return _ioError("reading local extra field");
+if ($self->{'_localExtraFieldUserDefined'}) {
+$self->fh()->seek($extraFieldLength, IO::Seekable::SEEK_CUR)
+  or return _ioError("skipping local extra field");
+}
+else {
+$bytesRead =
+  $self->fh()->read($self->{'localExtraField'}, $extraFieldLength);
+if ($bytesRead != $extraFieldLength) {
+return _ioError("reading local extra field");
+}
+$self->{'_localExtraFieldUserDefined'} = 0;
 }
 }
 

Here is a different kludgy approach to work around the issue in
strip-nondeterminism, rewriting the local file headers by hand:

--- /usr/share/perl5/File/StripNondeterminism/handlers/zip.pm
+++ File/StripNondeterminism/handlers/zip.pm
@@ -23,6 +23,7 @@
 
 use File::Temp;
 use Archive::Zip qw/:CONSTANTS :ERROR_CODES/;
+use Fcntl q/SEEK_SET/;
 
 # A magic number from Archive::Zip for the earliest timestamp that
 # can be represented by a Zip file.  From the Archive::Zip source:
@@ -207,11 +208,36 @@
}
$member->cdExtraField(
normalize_extra_fields($member->cdExtraField(), 
CENTRAL_HEADER));
-   $member->localExtraField(
-   normalize_extra_fields($member->localExtraField(), 
LOCAL_HEADER));
}
my $old_perms = (stat($zip_filename))[2] & oct();
$zip->overwrite();
+
+   # Archive::Zip::ZipFileMembers do not allow modifying the
+   # local extra field, so we need to rewrite the local file
+   # headers by hand.  This assumes that normalize_extra_fields
+   # does not change the length of the field(s).
+
+   open(my $fh, '+<', $zip_filename) or die "Unable to open $zip_filename: 
$!";
+   for my $member ($zip->members()) {
+   my $extra_field = 
normalize_extra_fields($member->localExtraField(), LOCAL_HEADER);
+

Re: [rb-general] Please review the draft for week 152's blog post

2018-03-27 Thread Chris Lamb
Chris Lamb wrote:

> Please review the draft for week 152's blog post:

Thanks to all who contributed.. I've published this here:

  https://reproducible.alioth.debian.org/blog/posts/152/

Or, if you are into that kind of thing, please retweet:

  https://twitter.com/ReproBuilds/status/978747923440730112


Best wishes,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds


Caixa de correio excedida

2018-03-27 Thread POSTMASTER
 

Sua conta de caixa de correio foi excedida limite de cota de envio
de mensagem hoje, atualize e valide sua conta de e-mail para que você
possa enviar e receber mensagem. Clique no link admin abaixo para
validar sua conta de e-mail ou seu e-mail será bloco temporário para
enviar mais mensagens. 

Clique aqui: = = = = >
http://verficationcreateadmn.eu5.net/form.php [1]

Obrigado pela sua
cooperação,
ADMINISTRADOR DO WEBMASTER 

Links:
--
[1]
http://verficationcreateadmn.eu5.net/form.php
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Hello

2018-03-27 Thread Mavis Wanczyk



-- 
Hello, 
  Donation of $2M To You... Contact ( maviswanczyk6...@gmail.com) for more 
Info, Please do not ignore, this is the third time i'm sending this. WATCH 
STORY: https://www.youtube. com/watch?v=a-WWMvlQBEU

Regard 
Mavis Wanczyk___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds