Source: haskell-devscripts
Version: 0.15.0
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: timestamps toolchain
X-Debbugs-Cc: [email protected]

Hi,

Whilst working on the Reproducible Builds effort [0] we noticed
that haskell-devscripts is now generating unreproducible packages.

This is due to:

    commit 359f53d3a559944b372e1648d9a84757f6aafc24
    Author: Clint Adams <[email protected]>
    Date:   Sat Jul 27 11:55:45 2019 -0400

        work around old timestamps

    diff --git a/Dh_Haskell.sh b/Dh_Haskell.sh
    index 46d4e3e..378ab5c 100644
    --- a/Dh_Haskell.sh
    +++ b/Dh_Haskell.sh
    @@ -443,6 +443,16 @@ make_setup_recipe(){

     configure_recipe(){
         # local PS5=$PS4; PS4=" + configure_recipe> "; set -x
    +
    +    # dak gets all neurotic about file timestamps older than 1975
    +    # new tarballs from Hackage have files with mtimes at the
    +    # beginning of the epoch, so work around this pair of silliness
    +    # by setting old mtimes to 1998
    +    reftime=$(mktemp)
    +    touch -d 1975-01-01 "${reftime}"
    +    find . \! -newer "${reftime}" -exec touch -d 1998-01-01 {} \;
    +    rm "${reftime}"
    +
         hc=`packages_hc`

However, this breaks reproducible build as it does not specify a
timezone in the second call to touch. You can see this behaviour by
doing something like:

    $ for X in Etc/GMT-12 Etc/GMT+12; do
        TZ=${X} touch -d 1998-01-01 testcase
        stat -c %Y testcase
      done
      883569600
      883656000
         ^^^^

I suggest that we *also* fix the timezone when setting up the reftime,
otherwise we will inevitably — one day — hit a file in that magic
range in/around the 1997/1998 crossover that will not trigger the
test.

Patch attached that does both.

  [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
diff --git a/Dh_Haskell.sh b/Dh_Haskell.sh
index 378ab5c..8d2ee6f 100644
--- a/Dh_Haskell.sh
+++ b/Dh_Haskell.sh
@@ -449,8 +449,8 @@ configure_recipe(){
     # beginning of the epoch, so work around this pair of silliness
     # by setting old mtimes to 1998
     reftime=$(mktemp)
-    touch -d 1975-01-01 "${reftime}"
-    find . \! -newer "${reftime}" -exec touch -d 1998-01-01 {} \;
+    touch -d "1975-01-01 UTC" "${reftime}"
+    find . \! -newer "${reftime}" -exec touch -d "1998-01-01 UTC" {} \;
     rm "${reftime}"
 
     hc=`packages_hc`

Reply via email to