Subject: bug#12830: charset.alias incorrect path

From: Jim Meyering <[email-masked]>
Date: Fri, 09 Nov 2012 07:53:02 +0100

Jim Meyering wrote:
> Matias A. fonzo wrote:
>> El Thu, 08 Nov 2012 08:11:37 +0100
>> Jim Meyering <[email-masked]> escribió:
>>> [..]
>>>
>>> +	from the "lib/" prefix-adding heuristic.  Reported by Matias
>>> A. fonzo
>>> +	in http://bugs.gnu.org/12206.
>>> +
>>> [...]
>>
>> Reported here in http://bugs.gnu.org/12830
>
> Good catch.  I've corrected both the log and ChangeLog locally.
> Testing momentarily...

Glad I tested.  That patch had no effect.
The one below does what I want.
It induces this sole difference in coreutils' Makefile.in:

  -charset_alias = $(DESTDIR)$(libdir)/lib/charset.alias
  +charset_alias = $(DESTDIR)$(libdir)/charset.alias

>From 86b0eb58273181fc4ef484f19b8ab835f7f392ea Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Wed, 7 Nov 2012 22:37:39 -0800
Subject: [PATCH] prefix-gnulib-mk: avoid overzealous "lib/"-prefix addition

* build-aux/prefix-gnulib-mk (prefix): Tighten a regexp to require
white space before each of the special-cased file names, to avoid
adding "lib/" after $(libdir)/.  Reported by Matias A. fonzo
in http://bugs.gnu.org/12830.
---
 ChangeLog                  | 8 ++++++++
 build-aux/prefix-gnulib-mk | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 9817769..a742d0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-11-08  Jim Meyering  <[email-masked]>
+
+	prefix-gnulib-mk: avoid overzealous "lib/"-prefix addition
+	* build-aux/prefix-gnulib-mk (prefix): Tighten a regexp to require
+	white space before each of the special-cased file names, to avoid
+	adding "lib/" after $(libdir)/.  Reported by Matias A. fonzo
+	in http://bugs.gnu.org/12830.
+
 2012-11-08  Paul Eggert  <[email-masked]>

 	fcntl-h: default O_SEARCH, O_EXEC back to O_RDONLY
diff --git a/build-aux/prefix-gnulib-mk b/build-aux/prefix-gnulib-mk
index 9b23245..7553f65 100755
--- a/build-aux/prefix-gnulib-mk
+++ b/build-aux/prefix-gnulib-mk
@@ -147,7 +147,11 @@ sub prefix ($)
    {prefix_assignment($1, $2)}gem;

   # These three guys escape all the other regular rules.
-  s{(charset\.alias|ref-add\.sed|ref-del\.sed)}{$prefix$1}g;
+  # Require the leading white space to avoid inserting the prefix
+  # on a line like this:
+  # charset_alias = $(DESTDIR)$(libdir)/charset.alias
+  # With $(libdir), it would be erroneous.
+  s{(\s)(charset\.alias|ref-add\.sed|ref-del\.sed)}{$1$prefix$2}g;
   # Unfortunately, as a result we sometimes have lib/lib.
   s{($prefix){2}}{$1}g;

--
1.8.0