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.000000000 +0100
+++ rp-pppoe-3.12/debian/changelog      2018-12-02 16:34:59.000000000 +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 <andr...@fatal.se>  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.000000000 +0100
+++ rp-pppoe-3.12/debian/patches/07_pppoestart-echo.patch       2018-12-02 
16:31:44.000000000 +0100
@@ -0,0 +1,166 @@
+From: Andreas Henriksson <andr...@fatal.se>
+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 "---------------------------------------------" >> $DEBUG
+     if [ "`uname -s`" = "Linux" ] ; then
+-        $ECHO "* The following section contains information about kernel 
modules" >> $DEBUG
+-      $ECHO "* If the module for your Ethernet card is 'tulip', you might" >> 
$DEBUG
+-      $ECHO "* want to look for an updated version at http://www.scyld.com"; 
>> $DEBUG
+-      $ECHO "Output of lsmod" >> $DEBUG
++        echo "* The following section contains information about kernel 
modules" >> $DEBUG
++      echo "* If the module for your Ethernet card is 'tulip', you might" >> 
$DEBUG
++      echo "* want to look for an updated version at http://www.scyld.com"; >> 
$DEBUG
++      echo "Output of lsmod" >> $DEBUG
+       lsmod >> $DEBUG
+-      $ECHO "---------------------------------------------" >> $DEBUG
++      echo "---------------------------------------------" >> $DEBUG
+     fi
+-    $ECHO "* The following section lists your routing table." >> $DEBUG
+-    $ECHO "* If you have an entry which starts with '0.0.0.0', you probably" 
>> $DEBUG
+-    $ECHO "* have defined a default route and gateway, and pppd will" >> 
$DEBUG
+-    $ECHO "* not create a default route using your ISP.  Try getting" >> 
$DEBUG
+-    $ECHO "* rid of this route." >> $DEBUG
+-    $ECHO "Output of netstat -n -r" >> $DEBUG
++    echo "* The following section lists your routing table." >> $DEBUG
++    echo "* If you have an entry which starts with '0.0.0.0', you probably" 
>> $DEBUG
++    echo "* have defined a default route and gateway, and pppd will" >> $DEBUG
++    echo "* not create a default route using your ISP.  Try getting" >> $DEBUG
++    echo "* rid of this route." >> $DEBUG
++    echo "Output of netstat -n -r" >> $DEBUG
+     netstat -n -r >> $DEBUG
+-    $ECHO "---------------------------------------------" >> $DEBUG
+-    $ECHO "Contents of /etc/resolv.conf" >> $DEBUG
+-    $ECHO "* The following section lists DNS setup." >> $DEBUG
+-    $ECHO "* If you can browse by IP address, but not name, suspect" >> $DEBUG
+-    $ECHO "* a DNS problem." >> $DEBUG
++    echo "---------------------------------------------" >> $DEBUG
++    echo "Contents of /etc/resolv.conf" >> $DEBUG
++    echo "* The following section lists DNS setup." >> $DEBUG
++    echo "* If you can browse by IP address, but not name, suspect" >> $DEBUG
++    echo "* a DNS problem." >> $DEBUG
+     cat /etc/resolv.conf >> $DEBUG
+-    $ECHO "---------------------------------------------" >> $DEBUG
+-    $ECHO "* The following section lists /etc/ppp/options." >> $DEBUG
+-    $ECHO "* You should have NOTHING in that file." >> $DEBUG
+-    $ECHO "Contents of /etc/ppp/options" >> $DEBUG
++    echo "---------------------------------------------" >> $DEBUG
++    echo "* The following section lists /etc/ppp/options." >> $DEBUG
++    echo "* You should have NOTHING in that file." >> $DEBUG
++    echo "Contents of /etc/ppp/options" >> $DEBUG
+     cat /etc/ppp/options >> $DEBUG 2>/dev/null
+-    $ECHO "---------------------------------------------" >> $DEBUG
++    echo "---------------------------------------------" >> $DEBUG
+ else
+     DEBUG=""
+ fi
+@@ -114,7 +113,7 @@ case "$#" in
+ esac
+ 
+ if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then
+-    $ECHO "$ME: Cannot read configuration file '$CONFIG'" >& 2
++    echo "$ME: Cannot read configuration file '$CONFIG'" >& 2
+     exit 1
+ fi
+ export CONFIG
+@@ -134,7 +133,7 @@ if [ -r "$PIDFILE" ] ; then
+     # Check if still running
+     kill -0 $PID > /dev/null 2>&1
+     if [ $? = 0 ] ; then
+-      $ECHO "$ME: There already seems to be a PPPoE connection up (PID $PID)" 
>& 2
++      echo "$ME: There already seems to be a PPPoE connection up (PID $PID)" 
>& 2
+       exit 1
+     fi
+     # Delete bogus PIDFILE
+@@ -169,7 +168,7 @@ while [ true ] ; do
+     # Looks like the interface came up
+     if [ $? = 0 ] ; then
+       # Print newline if standard input is a TTY
+-      tty -s && $ECHO " Connected!"
++      tty -s && echo " Connected!"
+       exit 0
+     fi
+ 
+@@ -185,7 +184,7 @@ while [ true ] ; do
+     fi
+ done
+ 
+-$ECHO "TIMED OUT" >& 2
++echo "TIMED OUT" >& 2
+ # Timed out!  Kill the pppoe-connect process and quit
+ kill $CONNECT_PID > /dev/null 2>&1
+ 
diff -Nru rp-pppoe-3.12/debian/patches/series 
rp-pppoe-3.12/debian/patches/series
--- rp-pppoe-3.12/debian/patches/series 2016-12-25 11:07:18.000000000 +0100
+++ rp-pppoe-3.12/debian/patches/series 2018-12-02 16:24:34.000000000 +0100
@@ -4,3 +4,4 @@
 04_ignore_broadcasted_pado_packets.patch
 05_change_default_timeout.patch
 06_typo_fixes.patch
+07_pppoestart-echo.patch

Reply via email to