bug-gperf
[Top][All Lists]
Advanced

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

options: Remove tool path to allow for reproducible builds


From: Richard Purdie
Subject: options: Remove tool path to allow for reproducible builds
Date: Mon, 04 Jul 2022 15:33:11 +0100
User-agent: Evolution 3.44.1-0ubuntu1

By default gperf puts a header into generated files with the full path to
the tool along with the commandline used. This patch removes the path to
the binary which is arg[0]. This is so that build paths aren't encoded 
into source file output which allows for reproducible builds.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Index: gperf-3.1/src/options.cc
===================================================================
--- gperf-3.1.orig/src/options.cc
+++ gperf-3.1/src/options.cc
@@ -280,6 +280,13 @@ Options::print_options () const
     {
       const char *arg = _argument_vector[i];
 
+      if (i == 0) {
+          const char *shortarg = strrchr(arg, '/');
+          if (shortarg) {
+              arg = shortarg + 1;
+          }
+      }
+
       /* Escape arg if it contains shell metacharacters.  */
       if (*arg == '-')
         {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]