On 2023-12-01, Vagrant Cascadian wrote:
> On 2021-10-06, Chris Lamb wrote:
>> 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?

I have uploaded an NMU to DELAYED/10 using dgit with the following
changes:

diff -Nru libinput-1.23.0/debian/changelog libinput-1.23.0/debian/changelog
--- libinput-1.23.0/debian/changelog    2023-06-13 17:30:14.000000000 -0700
+++ libinput-1.23.0/debian/changelog    2023-12-06 15:10:33.000000000 -0800
@@ -1,3 +1,10 @@
+libinput (1.23.0-2.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * tools: Remove references to LIBINPUT_QUIRKS_SRCDIR. (Closes: #995809)
+
+ -- Vagrant Cascadian <vagr...@reproducible-builds.org>  Wed, 06 Dec 2023 
15:10:33 -0800
+
 libinput (1.23.0-2) unstable; urgency=medium
 
   * debian/control:
diff -Nru libinput-1.23.0/debian/patches/series 
libinput-1.23.0/debian/patches/series
--- libinput-1.23.0/debian/patches/series       2023-05-29 16:50:56.000000000 
-0700
+++ libinput-1.23.0/debian/patches/series       2023-12-06 15:10:33.000000000 
-0800
@@ -1 +1,2 @@
 #placeholder
+tools-remove-references-to-libinput_quir.patch
diff -Nru 
libinput-1.23.0/debian/patches/tools-remove-references-to-libinput_quir.patch 
libinput-1.23.0/debian/patches/tools-remove-references-to-libinput_quir.patch
--- 
libinput-1.23.0/debian/patches/tools-remove-references-to-libinput_quir.patch   
    1969-12-31 16:00:00.000000000 -0800
+++ 
libinput-1.23.0/debian/patches/tools-remove-references-to-libinput_quir.patch   
    2023-12-06 15:10:33.000000000 -0800
@@ -0,0 +1,87 @@
+From: Vagrant Cascadian <vagr...@reproducible-builds.org>
+Date: Fri, 1 Dec 2023 14:17:20 -0800
+X-Dgit-Generated: 1.23.0-2.1 8d72c3fd82d3eb08e28adc552aaeb93df83f9d3a
+Subject: 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/
+
+---
+
+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);

Attachment: signature.asc
Description: PGP signature

Reply via email to