[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#794004: marked as done (ghostscript: please support timestamps from environment)



Your message dated Sat, 01 Aug 2015 16:04:36 +0000
with message-id <E1ZLZH2-00052o-Op@franck.debian.org>
and subject line Bug#794004: fixed in ghostscript 9.16~dfsg-1
has caused the Debian Bug report #794004,
regarding ghostscript: please support timestamps from environment
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
794004: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794004
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: ghostscript
Version: 9.15~dfsg-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: toolchain timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi,

While working on the "reproducible builds" effort [1], we have noticed
that the ghostscript embeds timestamps on the creation of pdf files.

For the Reproducible Builds effort we are proposing an environment
variable (SOURCE_DATE_EPOCH) [2] that will contain a deterministic epoch
timestamp (based on the latest debian/changelog entry) that could be
used, which should be automatically exported by debhelper in the future [3].

The attached patch proposes a way to use this variable to get
reproducible timestamps in the pdf files generated by ghostscript, if
the variable has been set (if not, it falls back to the old behavior).
With the attached patch packages using ghostscript would then
automatically generate reproducible pdf files.


[1]: https://wiki.debian.org/ReproducibleBuilds
[2]: https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal
[3]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=791815

Regards,
-- 
Dhole
diff -Nru ghostscript-9.15~dfsg/debian/changelog ghostscript-9.15~dfsg/debian/changelog
--- ghostscript-9.15~dfsg/debian/changelog	2015-07-26 20:17:32.000000000 +0200
+++ ghostscript-9.15~dfsg/debian/changelog	2015-07-28 18:48:03.000000000 +0200
@@ -1,3 +1,12 @@
+ghostscript (9.15~dfsg-1.0~reproducible1) UNRELEASED; urgency=medium
+
+  [ Peter De Wachter, Eduard Sanou ]
+  * Add patch to allow the build timestamp to be set through the environment
+    variable SOURCE_DATE_EPOCH, and set TZ=UTC in case the external timestamp
+    is used. This is needed for reproducible builds.
+
+ -- Eduard Sanou <dhole@openmailbox.org>  Tue, 28 Jul 2015 16:26:20 +0200
+
 ghostscript (9.15~dfsg-1) unstable; urgency=medium
 
   [ upstream ]
diff -Nru ghostscript-9.15~dfsg/debian/patches/2010_add_build_timestamp_setting.patch ghostscript-9.15~dfsg/debian/patches/2010_add_build_timestamp_setting.patch
--- ghostscript-9.15~dfsg/debian/patches/2010_add_build_timestamp_setting.patch	1970-01-01 01:00:00.000000000 +0100
+++ ghostscript-9.15~dfsg/debian/patches/2010_add_build_timestamp_setting.patch	2015-07-29 15:59:49.000000000 +0200
@@ -0,0 +1,122 @@
+Description: Allow the build timestamp to be externally set
+ In order to make Ghostscript output reproducible, we need a way to
+ set the build timestamp to other values than the current time.
+ We now consistently use gp_get_realtime() instead of directly calling
+ time() or gp_get_usertime() and make gp_get_realtime() use the value
+ found in the SOURCE_DATE_EPOCH environment variable if set. Also,
+ environment timezone is fixed to UTC if SOURCE_DATE_EPOCH is used to
+ avoid variations.
+Author: Peter De Wachter <pdewacht@gmail.com>, Eduard Sanou <dhole@openmailbox.org>
+
+Index: ghostscript-9.15~dfsg-1.0~reproducible1/base/gp_unix.c
+===================================================================
+--- ghostscript-9.15~dfsg-1.0~reproducible1.orig/base/gp_unix.c
++++ ghostscript-9.15~dfsg-1.0~reproducible1/base/gp_unix.c
+@@ -16,6 +16,7 @@
+ 
+ /* Unix-specific routines for Ghostscript */
+ 
++#include "errno_.h"
+ #include "pipe_.h"
+ #include "string_.h"
+ #include "time_.h"
+@@ -145,6 +146,7 @@ void
+ gp_get_realtime(long *pdt)
+ {
+     struct timeval tp;
++    const char *env;
+ 
+ #if gettimeofday_no_timezone    /* older versions of SVR4 */
+     {
+@@ -164,6 +166,26 @@ gp_get_realtime(long *pdt)
+     }
+ #endif
+ 
++    env = getenv("SOURCE_DATE_EPOCH");
++    if (env) {
++        char *end;
++        long timestamp;
++
++        errno = 0;
++        timestamp = strtol(env, &end, 10);
++        if (env == end || *end || errno != 0) {
++            lprintf("Ghostscript: SOURCE_DATE_EPOCH is not a number!\n");
++            timestamp = 0;
++        }
++
++        tp.tv_sec = timestamp;
++        tp.tv_usec = 0;
++
++        /* We need to fix the environment timezone to get reproducible */
++        /* results when parsing the result of gp_get_realtime. */
++        setenv("TZ", "UTC", 1);
++    }
++
+     /* tp.tv_sec is #secs since Jan 1, 1970 */
+     pdt[0] = tp.tv_sec;
+ 
+Index: ghostscript-9.15~dfsg-1.0~reproducible1/devices/vector/gdevpdf.c
+===================================================================
+--- ghostscript-9.15~dfsg-1.0~reproducible1.orig/devices/vector/gdevpdf.c
++++ ghostscript-9.15~dfsg-1.0~reproducible1/devices/vector/gdevpdf.c
+@@ -389,12 +389,14 @@ pdf_initialize_ids(gx_device_pdf * pdev)
+      */
+     {
+         struct tm tms;
++        long secs_ns[2];
+         time_t t;
+         char buf[1+2+4+2+2+2+2+2+1+2+1+2+1+1+1]; /* (D:yyyymmddhhmmssZhh'mm')\0 */
+         int timeoffset;
+         char timesign;
+ 
+-        time(&t);
++        gp_get_realtime(secs_ns);
++        t = secs_ns[0];
+         tms = *gmtime(&t);
+         tms.tm_isdst = -1;
+         timeoffset = (int)difftime(t, mktime(&tms)); /* tz+dst in seconds */
+@@ -437,7 +439,7 @@ pdf_compute_fileID(gx_device_pdf * pdev)
+     if (s == NULL)
+         return_error(gs_error_VMerror);
+     pdev->KeyLength = 0; /* Disable encryption. Not so important though. */
+-    gp_get_usertime(secs_ns);
++    gp_get_realtime(secs_ns);
+     sputs(s, (byte *)secs_ns, sizeof(secs_ns), &ignore);
+     sputs(s, (const byte *)pdev->fname, strlen(pdev->fname), &ignore);
+     pdev->strm = s;
+Index: ghostscript-9.15~dfsg-1.0~reproducible1/devices/vector/gdevpdfe.c
+===================================================================
+--- ghostscript-9.15~dfsg-1.0~reproducible1.orig/devices/vector/gdevpdfe.c
++++ ghostscript-9.15~dfsg-1.0~reproducible1/devices/vector/gdevpdfe.c
+@@ -200,10 +200,12 @@ pdf_xmp_time(char *buf, int buf_length)
+ {
+     /* We don't write a day time because we don't have a time zone. */
+     struct tm tms;
++    long secs_ns[2];
+     time_t t;
+     char buf1[4+1+2+1+2+1]; /* yyyy-mm-dd\0 */
+ 
+-    time(&t);
++    gp_get_realtime(secs_ns);
++    t = secs_ns[0];
+     tms = *localtime(&t);
+     gs_sprintf(buf1,
+             "%04d-%02d-%02d",
+Index: ghostscript-9.15~dfsg-1.0~reproducible1/devices/vector/gdevpsu.c
+===================================================================
+--- ghostscript-9.15~dfsg-1.0~reproducible1.orig/devices/vector/gdevpsu.c
++++ ghostscript-9.15~dfsg-1.0~reproducible1/devices/vector/gdevpsu.c
+@@ -183,10 +183,12 @@ psw_begin_file_header(FILE *f, const gx_
+     fprintf(f, "%%%%Creator: %s %ld (%s)\n", gs_product, (long)gs_revision,
+             dev->dname);
+     {
++        long secs_ns[2];
+         time_t t;
+         struct tm tms;
+ 
+-        time(&t);
++        gp_get_realtime(secs_ns);
++        t = secs_ns[0];
+         tms = *localtime(&t);
+         fprintf(f, "%%%%CreationDate: %d/%02d/%02d %02d:%02d:%02d\n",
+                 tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
diff -Nru ghostscript-9.15~dfsg/debian/patches/series ghostscript-9.15~dfsg/debian/patches/series
--- ghostscript-9.15~dfsg/debian/patches/series	2015-07-26 12:00:49.000000000 +0200
+++ ghostscript-9.15~dfsg/debian/patches/series	2015-07-28 16:32:03.000000000 +0200
@@ -9,3 +9,4 @@
 2007_suggest_install_ghostscript-doc_in_code.patch
 2008_mention_ghostscript-x_in_docs.patch
 2009_avoid_ramfs.patch
+2010_add_build_timestamp_setting.patch

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Source: ghostscript
Source-Version: 9.16~dfsg-1

We believe that the bug you reported is fixed in the latest version of
ghostscript, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 794004@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jonas Smedegaard <dr@jones.dk> (supplier of updated ghostscript package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 31 Jul 2015 23:00:24 +0200
Source: ghostscript
Binary: ghostscript ghostscript-x ghostscript-doc libgs9 libgs9-common libgs-dev ghostscript-dbg
Architecture: source amd64 all
Version: 9.16~dfsg-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Printing Team <debian-printing@lists.debian.org>
Changed-By: Jonas Smedegaard <dr@jones.dk>
Description:
 ghostscript - interpreter for the PostScript language and for PDF
 ghostscript-dbg - interpreter for the PostScript language and for PDF - Debug symbo
 ghostscript-doc - interpreter for the PostScript language and for PDF - Documentati
 ghostscript-x - interpreter for the PostScript language and for PDF - X11 support
 libgs-dev  - interpreter for the PostScript language and for PDF - Development
 libgs9     - interpreter for the PostScript language and for PDF - Library
 libgs9-common - interpreter for the PostScript language and for PDF - common file
Closes: 794004
Changes:
 ghostscript (9.16~dfsg-1) unstable; urgency=medium
 .
   [ upstream ]
   * New release 9.07.
     Highlights:
     + Add -dLockColorants option for tiffsep and psdcmyk devices.
     + Improved high level devices handling of Forms.
     + Update URW+ Nimbus* fonts, adding Greek and Cyrillic glyphs.
 .
   [ Jonas Smedegaard ]
   * Add patch 2010 to allow the build timestamp to be externally set.
     Closes: Bug#794004. Thanks to Peter De Wachter and Eduard Sanou.
   * Update copyright info:
     + Extend coverage for main upstream authors to include current year.
   * Add patch 1002 to fix have devxps link against shared zlib.
   * Unfuzz patches.
   * Update symbols file (30 new).
Checksums-Sha1:
 aebc40addbcd1a7078a73f125a13c2a763046e3a 2834 ghostscript_9.16~dfsg-1.dsc
 8c4b3ed3746ff68035a5bcc2dfcd4138adfbe310 19842829 ghostscript_9.16~dfsg.orig.tar.gz
 b191c95d26f91afaf4f8d7f9f6b69f97dc7c3a51 100312 ghostscript_9.16~dfsg-1.debian.tar.xz
 8cde38c0f74a556a64cdc929d41daefb11441138 5555320 ghostscript-dbg_9.16~dfsg-1_amd64.deb
 6074d25b471b1e4d3c5c95275a1c1fcd2b2188b1 4992540 ghostscript-doc_9.16~dfsg-1_all.deb
 4ce8df07402ce767be5836457604cafcc4013fb8 85794 ghostscript-x_9.16~dfsg-1_amd64.deb
 b81895b6cd377a8168a01cf11691d3dfc78b27fe 92798 ghostscript_9.16~dfsg-1_amd64.deb
 cf18fbc9e44a13dc46009f36c9a626ebfabfb74a 2245954 libgs-dev_9.16~dfsg-1_amd64.deb
 066b40acef72a0a27a189b024e981ab382c5c8fc 2985636 libgs9-common_9.16~dfsg-1_all.deb
 779a3fe34bd5f88f4fded3b0c25523c43bb011e1 2008130 libgs9_9.16~dfsg-1_amd64.deb
Checksums-Sha256:
 6e81f1df0a8436c770f71223e3ce974ddc2870b75c888ebbb5aad356eff94ac5 2834 ghostscript_9.16~dfsg-1.dsc
 3dd5b78fed1f76c249b03a1fd52b9e4c36ff7c87acc567e72498e0697502f92b 19842829 ghostscript_9.16~dfsg.orig.tar.gz
 3d4b77695288e9ce1b1c00615f0c1c9d62887731ec3a016fb6ad02c216fe548c 100312 ghostscript_9.16~dfsg-1.debian.tar.xz
 0db301062ae1897038fa0d7aa867e3675484f4f028156e2c78ea5b8d94ca08ad 5555320 ghostscript-dbg_9.16~dfsg-1_amd64.deb
 2919db52c3a0e0c00ecdf2010ff78f2f0bbf08dac6b827005874d02505796fc3 4992540 ghostscript-doc_9.16~dfsg-1_all.deb
 5a311a25cdd300a063cc8efea077b5bd9950bd48b805528d365f460e51357270 85794 ghostscript-x_9.16~dfsg-1_amd64.deb
 9980dfbc4c70b9161d5cb5d0b0ab4d587a5c44be645d13511f1d23013fa3fc31 92798 ghostscript_9.16~dfsg-1_amd64.deb
 46804ab7a1f27976af9a5bd18a57bbbbaa1ae000f28afe409c24734ccd2e2518 2245954 libgs-dev_9.16~dfsg-1_amd64.deb
 f57ecf1e8f4f5bcbe790b6cf8b8a1a8c8847e6b6773c4bba29798c9dbe5d2473 2985636 libgs9-common_9.16~dfsg-1_all.deb
 447b89cee6a0e5731b51a690dc0c310c1ff33397b6b5325c71ca020693199802 2008130 libgs9_9.16~dfsg-1_amd64.deb
Files:
 8b56e7b4303be18382e6e02390f0a15e 2834 text optional ghostscript_9.16~dfsg-1.dsc
 d7edb9beee1248209edff0e3f07718bf 19842829 text optional ghostscript_9.16~dfsg.orig.tar.gz
 064dfcd228fb8cfde2996d8f689b709b 100312 text optional ghostscript_9.16~dfsg-1.debian.tar.xz
 659e470a7d1ffee2f3c4228fa0caa736 5555320 debug extra ghostscript-dbg_9.16~dfsg-1_amd64.deb
 b54bb9fefb9ad8cbc30c11716f7951bb 4992540 doc optional ghostscript-doc_9.16~dfsg-1_all.deb
 9a5c8c15223e042bc3bc3226326700d9 85794 text optional ghostscript-x_9.16~dfsg-1_amd64.deb
 9fad92b641272ea92b545ae06f8cdfcf 92798 text optional ghostscript_9.16~dfsg-1_amd64.deb
 58f0b4ecd1209e7cd702da384e244914 2245954 libdevel optional libgs-dev_9.16~dfsg-1_amd64.deb
 d604d950bbf21590b601aec6dcfc684c 2985636 libs optional libgs9-common_9.16~dfsg-1_all.deb
 601e00b09df6cf89b0387067d3a53402 2008130 libs optional libgs9_9.16~dfsg-1_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVvOncAAoJECx8MUbBoAEhV6MP/1tlgciiMpgb6FMsa/fIdwxA
OmcKJPEXVKbZVElaB+tqHwR3GWyq6KyAcFqjNSt02x/CMBPX81c0vpMHZ3MkKNI5
5XBDtv3g70fXpwkkrJjaHWWlRJwS1PZ12Theuw+042IzV8jhuLXc6ykl82oVNgKl
q+SLx+rdqUILavogYtUEUB8L7Rrk9gFhvBM8Ll8Au0YEFPlFudlL2nxKGH9RN9zs
9xJHKQfJ6HUqxtdNO/dyvrr8t++8sHvs5D8VxHyHXxncZq/G3hUaF29CIuQf9Pkt
CKyZwjh077/iyeVFicGfd/WFl5se+4/AMnSboKybSYrKL8MgjtPYDy/I+CsnBOPp
dFUFqAp60Hxwho2CjwTpsjhpVTN9BDd6sEtUANnJE97VGM3Wotzhs2Z3TJQVKCNM
bJr7Flcu+WJFNHRIo37XztPUmcXYlZe2yW2KCqKf2qXXeeRxP0w8OZHUf+dwp6Wj
Vq+TsjOr2WjVrKw/C/OY6Ln7OY+PbkFlTuCYKowhq8EG+9WwSjxarfzeHfCPeqqh
hZ0LuushpY/cstdIPJJItLX+kG2Zg6qXtI9y97EKd9FFfJt2WAOvGDrxCVcKx02G
w7OJVlQ/LV1MOQL/hAsM3XckDNc4dPDtCFyiu+LHuR4PUHRKJPflV4Om+CY1T2cz
z9vJRHBcoYAZBq76GM4c
=/fJp
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: