[libpdf-api2-perl] 01/02: Add patch removing current timestamp from font IDs to improve reproducibility

Damyan Ivanov dmn at moszumanska.debian.org
Wed Mar 16 13:31:56 UTC 2016


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

dmn pushed a commit to branch master
in repository libpdf-api2-perl.

commit 580bceebbbbc9efabab6414002709e159f1e6bf7
Author: Damyan Ivanov <dmn at debian.org>
Date:   Wed Mar 16 13:28:46 2016 +0000

    Add patch removing current timestamp from font IDs to improve reproducibility
    
    Closes: #818363
---
 debian/patches/reproducible-resources.patch | 82 +++++++++++++++++++++++++++++
 debian/patches/series                       |  1 +
 2 files changed, 83 insertions(+)

diff --git a/debian/patches/reproducible-resources.patch b/debian/patches/reproducible-resources.patch
new file mode 100644
index 0000000..fe3feeb
--- /dev/null
+++ b/debian/patches/reproducible-resources.patch
@@ -0,0 +1,82 @@
+Description: Remove '~'.time() from internal font IDs
+ Adding '~'.time() is not necessary because the identifiers already include
+ the result of the pdfkey() function, which gives increasing numbers through
+ a process lifetime.
+ .
+ Keeping '~'.time() only makes the output unreproducible and adds a slight
+ performance penalty for thesyscall needed to get the current time.
+Author: Damyan Ivanov <dmn at debian.org>
+Bug-Debian: https://bugs.debian.org/818363
+Bug: https://rt.cpan.org/Ticket/Display.html?id=113084
+
+--- a/lib/PDF/API2/Resource/CIDFont/TrueType.pm
++++ b/lib/PDF/API2/Resource/CIDFont/TrueType.pm
+@@ -38,7 +38,7 @@ sub new {
+     my ($ff,$data)=PDF::API2::Resource::CIDFont::TrueType::FontFile->new($pdf,$file, at opts);
+ 
+     $class = ref $class if ref $class;
+-    my $self=$class->SUPER::new($pdf,$data->{apiname}.pdfkey().'~'.time());
++    my $self=$class->SUPER::new($pdf,$data->{apiname}.pdfkey());
+     $pdf->new_obj($self) if(defined($pdf) && !$self->is_obj($pdf));
+ 
+     $self->{' data'}=$data;
+@@ -51,7 +51,7 @@ sub new {
+ 
+     $de->{'FontDescriptor'} = $des;
+     $de->{'Subtype'} = PDFName($self->iscff ? 'CIDFontType0' : 'CIDFontType2');
+-    ## $de->{'BaseFont'} = PDFName(pdfkey().'+'.($self->fontname).'~'.time());
++    ## $de->{'BaseFont'} = PDFName(pdfkey().'+'.($self->fontname));
+     $de->{'BaseFont'} = PDFName($self->fontname);
+     $de->{'DW'} = PDFNum($self->missingwidth);
+     if($opts{-noembed} != 1)
+--- a/lib/PDF/API2/Resource/Font/BdFont.pm
++++ b/lib/PDF/API2/Resource/Font/BdFont.pm
+@@ -56,7 +56,7 @@ sub new {
+     my %opts=@opts;
+ 
+     $class = ref $class if ref $class;
+-    $self = $class->SUPER::new($pdf, sprintf('%s+Bdf%02i',pdfkey(),++$BmpNum).'~'.time());
++    $self = $class->SUPER::new($pdf, sprintf('%s+Bdf%02i',pdfkey(),++$BmpNum));
+     $pdf->new_obj($self) unless($self->is_obj($pdf));
+ 
+     # adobe bitmap distribution font
+@@ -202,7 +202,7 @@ sub readBDF {
+         $data->{bbox}{'.notdef'} = [0, 0, 0, 0];
+     }
+ 
+-    $data->{fontname}=pdfkey().pdfkey().'~'.time();
++    $data->{fontname}=pdfkey();
+     $data->{apiname}=$data->{fontname};
+     $data->{flags} = 34;
+     $data->{fontbbox} = [ split(/\s+/,$data->{FONTBOUNDINGBOX}) ];
+--- a/lib/PDF/API2/Resource/Font/CoreFont.pm
++++ b/lib/PDF/API2/Resource/Font/CoreFont.pm
+@@ -164,7 +164,7 @@ sub new
+     #}
+     
+     $class = ref $class if ref $class;
+-    $self = $class->SUPER::new($pdf, $data->{apiname}.pdfkey().'~'.time());
++    $self = $class->SUPER::new($pdf, $data->{apiname}.pdfkey());
+     $pdf->new_obj($self) unless($self->is_obj($pdf));
+     $self->{' data'}=$data;
+     $self->{-dokern}=1 if($opts{-dokern});
+--- a/lib/PDF/API2/Resource/Font/Postscript.pm
++++ b/lib/PDF/API2/Resource/Font/Postscript.pm
+@@ -28,7 +28,7 @@ sub new {
+     }
+ 
+     $class = ref $class if ref $class;
+-    $self = $class->SUPER::new($pdf, $data->{apiname}.pdfkey().'~'.time());
++    $self = $class->SUPER::new($pdf, $data->{apiname}.pdfkey());
+     $pdf->new_obj($self) unless($self->is_obj($pdf));
+     $self->{' data'}=$data;
+ 
+@@ -40,7 +40,7 @@ sub new {
+     $self->{'FontDescriptor'}=$self->descrByData();
+     if(-f $psfile)
+     {
+-        $self->{'BaseFont'} = PDFName(pdfkey().'+'.($self->fontname).'~'.time());
++        $self->{'BaseFont'} = PDFName(pdfkey().'+'.($self->fontname));
+ 
+         my ($l1,$l2,$l3,$stream)=$self->readPFAPFB($psfile);
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..2952243
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+reproducible-resources.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libpdf-api2-perl.git



More information about the Pkg-perl-cvs-commits mailing list