Bug#915295: rp-pppoe: reproducible build (usrmerge): embeds path of echo found via PATH

2018-12-02 Thread Andreas Henriksson
On Sun, Dec 02, 2018 at 04:38:49PM +0100, Andreas Henriksson wrote:
> Source: rp-pppoe
> Version: 3.12-1
> Severity: normal
> Tags: patch
[...]

I've uploaded the debdiff to DELAYED/14.

Please feel free to fix this sooner.

Regards,
Andreas Henriksson



Bug#915295: rp-pppoe: reproducible build (usrmerge): embeds path of echo found via PATH

2018-12-02 Thread Andreas Henriksson
Source: rp-pppoe
Version: 3.12-1
Severity: normal
Tags: patch
User: m...@linux.it
Usertags: usrmerge

Dear Maintainer,

The package currently fails to reproducibly build on merged-usr vs
non-merged systems.

The problem is that the full path of echo is embedded in a shipped file.

The problem could be fixed by passing ECHO=/bin/echo to configure,
but that would still embedd a full path and avoid using the
shell-builtin which would be more efficient.

I've thus opted for a patch that simply eliminates the indirection
and just uses plain echo in the script. The script already uses
plain echo in atleast one place, so the $ECHO use isn't even consistent.
I see no value in keeping $ECHO.

Regards,
Andreas Henriksson
diff -Nru rp-pppoe-3.12/debian/changelog rp-pppoe-3.12/debian/changelog
--- rp-pppoe-3.12/debian/changelog  2016-12-25 11:09:52.0 +0100
+++ rp-pppoe-3.12/debian/changelog  2018-12-02 16:34:59.0 +0100
@@ -1,3 +1,11 @@
+rp-pppoe (3.12-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add debian/patches/07_pppoestart-echo.patch
+- fixes reproducible build on merged-usr vs non-merged
+
+ -- Andreas Henriksson   Sun, 02 Dec 2018 16:34:59 +0100
+
 rp-pppoe (3.12-1.1) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru rp-pppoe-3.12/debian/patches/07_pppoestart-echo.patch 
rp-pppoe-3.12/debian/patches/07_pppoestart-echo.patch
--- rp-pppoe-3.12/debian/patches/07_pppoestart-echo.patch   1970-01-01 
01:00:00.0 +0100
+++ rp-pppoe-3.12/debian/patches/07_pppoestart-echo.patch   2018-12-02 
16:31:44.0 +0100
@@ -0,0 +1,166 @@
+From: Andreas Henriksson 
+Subject: Avoid useless indirection and full path embedding of echo
+
+Embedding the full path of echo at build-time, instead of relying
+on PATH at *runtime* seems pointless. Spawning a command rather than
+using using plain echo which is often a shell-builtin is wasteful.
+
+The script also doesn't even consistently use $ECHO, but atleast
+in one place already uses plain echo.
+
+Thus this patch just drops the entire indirection.
+(Even better would be to join the gazillion echos run one after the
+other into a single write.)
+
+Apart from generally being a sane thing to do, this patch fixes
+the reproducible build failure on merged-usr vs non-merged systems
+as was spotted at:
+https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/rp-pppoe.html
+
+
+Index: rp-pppoe-3.12/scripts/pppoe-start.in
+===
+--- rp-pppoe-3.12.orig/scripts/pppoe-start.in
 rp-pppoe-3.12/scripts/pppoe-start.in
+@@ -28,7 +28,6 @@ exec_prefix=@exec_prefix@
+ 
+ # Paths to programs
+ CONNECT=@sbindir@/pppoe-connect
+-ECHO=@ECHO@
+ IFCONFIG=/sbin/ifconfig
+ 
+ # Set to "C" locale so we can parse messages from commands
+@@ -42,63 +41,63 @@ ETH=""
+ ME=`basename $0`
+ # Must be root
+ if [ "`@ID@ -u`" != 0 ] ; then
+-$ECHO "$ME: You must be root to run this script" >& 2
++echo "$ME: You must be root to run this script" >& 2
+ exit 1
+ fi
+ 
+ # Debugging
+ if [ "$DEBUG" = "1" ] ; then
+-$ECHO "*** Running in debug mode... please be patient..."
++echo "*** Running in debug mode... please be patient..."
+ DEBUG=/tmp/pppoe-debug-$$
+ export DEBUG
+ mkdir $DEBUG
+ if [ "$?" != 0 ] ; then
+-  $ECHO "Could not create directory $DEBUG... exiting"
++  echo "Could not create directory $DEBUG... exiting"
+   exit 1
+ fi
+ DEBUG=$DEBUG/pppoe-debug.txt
+ 
+ # Initial debug output
+-$ECHO "-" > $DEBUG
+-$ECHO "* The following section contains information about your system" >> 
$DEBUG
++echo "-" > $DEBUG
++echo "* The following section contains information about your system" >> 
$DEBUG
+ date >> $DEBUG
+-$ECHO "Output of uname -a" >> $DEBUG
++echo "Output of uname -a" >> $DEBUG
+ uname -a >> $DEBUG
+-$ECHO "-" >> $DEBUG
+-$ECHO "* The following section contains information about your network" 
>> $DEBUG
+-$ECHO "* interfaces.  The one you chose for PPPoE should contain the 
words:" >> $DEBUG
+-$ECHO "* 'UP' and 'RUNNING'.  If it does not, you probably have an 
Ethernet" >> $DEBUG
+-$ECHO "* driver problem." >> $DEBUG
+-$ECHO "Output of ifconfig -a" >> $DEBUG
++echo "-" >> $DEBUG
++echo "* The following section contains information about your network" >> 
$DEBUG
++echo "* interfaces.  The one you chose for PPPoE should contain the 
words:" >> $DEBUG
++echo "* 'UP' and 'RUNNING'.  If it does not, you probably have an 
Ethernet" >> $DEBUG
++echo "* driver problem." >> $DEBUG
++echo "Output of ifconfig -a" >> $DEBUG
+ $IFCONFIG -a >> $DEBUG
+-$ECHO "-" >> $DEBUG
++echo