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

Daniel Shahaf danielsh at apache.org
Sun May 1 19:51:37 UTC 2016


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



More information about the debian-science-maintainers mailing list