Source: beep
Version: 1.4.3-2
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: environment
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0] we noticed that
beep could not be built reproducibly.

This is because of obscure differences in backslash escaping between
the Bash and Dash shells in GNU Makefiles in/around:

    set -e; IFS=""; while read line; do \
        echo "  \"$${line}\\\\n\"" >> $@; \
    done < $<

This appears to produce "\n" with /bin/dash as /bin/sh or "\\n" with /
bin/bash. A patch is attached that replaces the echo line with a call
to printf which, in my experience, is not as fickle as echo and seems
more suited to this interpolation/template-type string maniplation.

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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
--- a/debian/patches/reproducible-build.patch   1969-12-31 16:00:00.000000000 
-0800
--- b/debian/patches/reproducible-build.patch   2020-03-06 09:48:32.275964824 
-0800
@@ -0,0 +1,15 @@
+Description: Make the build reproducible
+Author: Chris Lamb <la...@debian.org>
+Last-Update: 2020-03-06
+
+--- beep-1.4.3.orig/GNUmakefile
++++ beep-1.4.3/GNUmakefile
+@@ -160,7 +160,7 @@ beep-usage.c: beep-usage.txt
+       echo '#include "beep-usage.h"' >> $@
+       echo 'char beep_usage[] =' >> $@
+       set -e; IFS=""; while read line; do \
+-              echo "  \"$${line}\\\\n\"" >> $@; \
++              printf '  "%s\\n"\n' "$${line}" >> $@; \
+       done < $<
+       echo '  ;' >> $@
+ 
--- a/debian/patches/series     2020-03-06 09:32:47.581446886 -0800
--- b/debian/patches/series     2020-03-06 09:48:30.835949009 -0800
@@ -1,2 +1,3 @@
 beep-usage-fix-missing-terminating-doublequote-character.patch
 fix-debug-symbols.patch
+reproducible-build.patch

Reply via email to