Hi Thomas,

> Le 18 mai 2020 à 08:23, Thomas Petazzoni <[email protected]> a 
> écrit :
> 
> Commit a4ede8f85b0c9a254fcb01e5888cee1983095669 ("package: make bison
> a relocatable package") made Bison relocatable, but in fact it still
> contains one absolute reference: the M4 variable, which points to the
> M4 program. Let's fix that by using relocate().

Good point.


The patch is not right though: you are *forced* to have relocated m4 for
this patch to work: if you moved only your install tree of bison, it looks
for m4 there.

You should check that a relocated m4 is available, and then fallback to
M4 again.

You also have minor stylistic issues.

diff --git a/src/files.c b/src/files.c
index b8b43230..98547571 100644
--- a/src/files.c
+++ b/src/files.c
@@ -424,8 +424,8 @@ pkgdatadir (void)
 char const *
 m4path (void)
 {
-  char const *m4 = getenv("M4");
-  return m4 ? m4 : relocate(M4);
+  char const *m4 = getenv ("M4");
+  return m4 ? m4 : relocate (M4);
 }
 
 void



Cheers!

Reply via email to