[Reproducible-builds] Fwd: [Bug#823174: ros-pluginlib: debian/rules uses non-portable shell syntax; please make the build reproducible (shell)]

Daniel Shahaf danielsh at apache.org
Mon May 2 12:05:07 UTC 2016


Forwarding to the list.

(I did proofread the bug report before sending it, but missed adding the
X-Debbugs-Cc header because the "master copy" I was diffing against —
the copy of #823123 in my inbox — didn't have that header, even though
it did get X-Debbugs-Cc'd to this list.)



----- Forwarded message from Daniel Shahaf <danielsh at apache.org> -----

Date: Sun, 01 May 2016 19:51:37 +0000
From: Daniel Shahaf <danielsh at apache.org>
To: Debian Bug Tracking System <submit at bugs.debian.org>
Subject: Bug#823174: ros-pluginlib: debian/rules uses non-portable shell syntax; please make the build reproducible (shell)
Message-ID: <20160501195137.21143.31130.reportbug at fujitsu.shahaf.local2>
X-Mailer: reportbug 6.6.3

Source: ros-pluginlib
Version: 1.10.1-3
Severity: minor
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: environment

Dear Maintainer,

While working on the “reproducible builds” effort, we have noticed that
ros-pluginlib could not be built reproducibly; the diff between two
builds is:

    https://tests.reproducible-builds.org/rb-pkg/unstable/amd64/ros-pluginlib.html
    │   │   │   │ -add_definitions(-DCMAKE_LIBRARY_ARCHITECTURE=\"${CMAKE_LIBRARY_ARCHITECTURE}\")
    │   │   │   │ +add_definitions(-DCMAKE_LIBRARY_ARCHITECTURE=\\"${CMAKE_LIBRARY_ARCHITECTURE}\\")

This difference is down to debian/rules calling echo(1) with an argument
that contains a literal backslash.  The behaviour of echo(1) in that
case is (according to POSIX) implementation-defined.  Since debian/rules
uses echo(1) from the building user's shell, the build output differs
when the building user uses SHELL=bash v. SHELL=dash:

    % s=\'foo\\\\bar\'; LC_ALL=C dash -c "echo $s" 
    foo\bar
    % s=\'foo\\\\bar\'; LC_ALL=C bash -c "echo $s" 
    foo\\bar
    %

The following patch removes the use of implementation-defined behaviour:

[[[
diff --git a/debian/rules b/debian/rules
index 9e5b691..c867402 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,7 +10,7 @@ override_dh_auto_test:
 
 override_dh_auto_configure:
        dh_auto_configure
-       echo 'add_definitions(-DCMAKE_LIBRARY_ARCHITECTURE=\\"$${CMAKE_LIBRARY_ARCHITECTURE}\\")' >> build/catkin_generated/installspace/pluginlibConfig.cmake
+       printf 'add_definitions(-DCMAKE_LIBRARY_ARCHITECTURE=\\"%s\\")' '$${CMAKE_LIBRARY_ARCHITECTURE}' >> build/catkin_generated/installspace/pluginlibConfig.cmake
 
 override_dh_auto_install:
        dh_auto_install --destdir=debian/tmp
]]]

This patch should also make the build reproducible, but I didn't test that.

Note that when built under bash, pluginlibConfig.cmake would contain
additional backslashes; I'm not sure what their effect would be.

Cheers,

Daniel

----- End forwarded message -----



More information about the Reproducible-builds mailing list