[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#995809: libinput: please make the build reproducible



On 2021-10-06, Chris Lamb wrote:
> Whilst working on the Reproducible Builds effort [0] we noticed that
> libinput could not be built reproducibly.
>
> This is due to the use of the LIBINPUT_QUIRKS_DIR macro which includes
> the absolute build path.
>
> It is not entirely clear (during a very brief look) when/where this
> value is even used — the testsuite still passes even if this is set to
> a dummy value (see attached dummy patch). And, of course, the build
> path cannot be relied upon at runtime.

The attached patch is an alternate approach by removing the code that
actually references the build path from various source files. It also
makes the build reproducible and the package still builds (so I presume
the test suite passes).

As Chris pointed out, the build path is not something one can rely on at
runtime, so the installed package cannot rely on it anyways.

I would like to perform an NMU in the near future, unless there are
objections?

live well,
  vagrant
From 6b78d6697661c497ae4ff2a3bbf1eea53ae60ccc Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Fri, 1 Dec 2023 14:17:20 -0800
Subject: [PATCH] tools: Remove references to LIBINPUT_QUIRKS_SRCDIR. (Closes:
 #995809)

This embeds the build path which is not generally available at runtime and
makes it more difficult to reproduce the build.

https://reproducible-builds.org/docs/build-path/
---
 tools/libinput-quirks.c | 10 ++--------
 tools/libinput-record.c |  9 ---------
 tools/shared.c          | 12 ------------
 3 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/tools/libinput-quirks.c b/tools/libinput-quirks.c
index e97eff6..7f3e26f 100644
--- a/tools/libinput-quirks.c
+++ b/tools/libinput-quirks.c
@@ -166,14 +166,8 @@ main(int argc, char **argv)
 
 	/* Overriding the data dir means no custom override file */
 	if (!data_path) {
-		char *builddir = builddir_lookup();
-		if (builddir) {
-			data_path = LIBINPUT_QUIRKS_SRCDIR;
-			free(builddir);
-		} else {
-			data_path = LIBINPUT_QUIRKS_DIR;
-			override_file = LIBINPUT_QUIRKS_OVERRIDE_FILE;
-		}
+		data_path = LIBINPUT_QUIRKS_DIR;
+		override_file = LIBINPUT_QUIRKS_OVERRIDE_FILE;
 	}
 
 	quirks = quirks_init_subsystem(data_path,
diff --git a/tools/libinput-record.c b/tools/libinput-record.c
index 30b2900..1de63bc 100644
--- a/tools/libinput-record.c
+++ b/tools/libinput-record.c
@@ -1762,19 +1762,10 @@ print_device_quirks(struct record_device *dev)
 	struct quirks_context *quirks;
 	const char *data_path = LIBINPUT_QUIRKS_DIR;
 	const char *override_file = LIBINPUT_QUIRKS_OVERRIDE_FILE;
-	char *builddir = NULL;
 
 	if (stat(dev->devnode, &st) < 0)
 		return;
 
-	if ((builddir = builddir_lookup())) {
-		setenv("LIBINPUT_QUIRKS_DIR", LIBINPUT_QUIRKS_SRCDIR, 0);
-		data_path = LIBINPUT_QUIRKS_SRCDIR;
-		override_file = NULL;
-	}
-
-	free(builddir);
-
 	quirks = quirks_init_subsystem(data_path,
 				       override_file,
 				       quirks_log_handler,
diff --git a/tools/shared.c b/tools/shared.c
index 7a73027..fcacb03 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -411,16 +411,6 @@ tools_open_device(const char **paths, bool verbose, bool *grab)
 	return li;
 }
 
-static void
-tools_setenv_quirks_dir(void)
-{
-	char *builddir = builddir_lookup();
-	if (builddir) {
-		setenv("LIBINPUT_QUIRKS_DIR", LIBINPUT_QUIRKS_SRCDIR, 0);
-		free(builddir);
-	}
-}
-
 struct libinput *
 tools_open_backend(enum tools_backend which,
 		   const char **seat_or_device,
@@ -429,8 +419,6 @@ tools_open_backend(enum tools_backend which,
 {
 	struct libinput *li;
 
-	tools_setenv_quirks_dir();
-
 	switch (which) {
 	case BACKEND_UDEV:
 		li = tools_open_udev(seat_or_device[0], verbose, grab);
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature


Reply to: