Subject: Re: bug#12830: charset.alias incorrect path

From: Jim Meyering <[email-masked]>
Date: Thu, 08 Nov 2012 08:11:37 +0100

Eric Blake wrote:
> On 11/07/2012 05:52 PM, Matias A. fonzo wrote:
>> Hi there,
>>
>> The path for the installed file "charset.alias" is already set by
>> $(libdir), it is composed as $(libdir)/lib wrongly in Makefile.in. This
>> is at the line 3001 on Makefile.in (coreutils 8.20):
>>
>> charset_alias = $(DESTDIR)$(libdir)/charset.alias
>>
>> I provide a difference fixing the path:
>>
>> --- Makefile.in.orig	2012-10-23 13:26:32.000000000 -0300
>> +++ Makefile.in	2012-11-07 17:04:26.000000000 -0300
>> @@ -2998,7 +2998,7 @@
>>  	lib/waitpid.c lib/wcrtomb.c lib/wcswidth.c lib/wcwidth.c \
>>  	lib/write.c lib/xstrtod.c
>>  GPERF = gperf
>> -charset_alias = $(DESTDIR)$(libdir)/lib/charset.alias
>> +charset_alias = $(DESTDIR)$(libdir)/charset.alias
>>  charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
>
> Thanks for the report.  Hmm, this snippet is originally copied in from
> gnulib, but in gnulib, it was already correct:
>
> modules/localcharset:charset_alias = $(DESTDIR)$(libdir)/charset.alias
>
> So I suspect a bug in the bootstrap script that is converting things
> incorrectly when it attempts to normalize path names during a gnulib import.

Thanks.  You're right.
This error was fall-out from the um, ... pragmatic, hack
required to support non-recursive make.

Here's a possible fix.
I'll test it in the next day or so.

>From 8bc198bac4068761f662fcd3f84a5c66e401747a 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_assignment): Exempt charset_alias
from the "lib/" prefix-adding heuristic.  Reported by Matias A. fonzo
in http://bugs.gnu.org/12206.
---
 ChangeLog                  |  7 +++++++
 build-aux/prefix-gnulib-mk | 11 +++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index adcb8d1..e5b46be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-11-07  Jim Meyering  <[email-masked]>
+
+	prefix-gnulib-mk: avoid overzealous "lib/"-prefix addition
+	* build-aux/prefix-gnulib-mk (prefix_assignment): Exempt charset_alias
+	from the "lib/" prefix-adding heuristic.  Reported by Matias A. fonzo
+	in http://bugs.gnu.org/12206.
+
 2012-11-05  Paul Eggert  <[email-masked]>

 	errno: port to LynxOS 178 2.2.2
diff --git a/build-aux/prefix-gnulib-mk b/build-aux/prefix-gnulib-mk
index 9b23245..11fb31a 100755
--- a/build-aux/prefix-gnulib-mk
+++ b/build-aux/prefix-gnulib-mk
@@ -89,17 +89,20 @@ sub prefix_assignment ($$)
   my ($lhs_and_assign_op, $rhs) = @_;
   my $res;

-  # Some variables are initialized by gnulib.mk, and we don't want
-  # that.  Change '=' to '+='.
-  if ($lhs_and_assign_op =~ /^GPERF =$/)
+  if ($lhs_and_assign_op =~ /^(?:GPERF|charset_alias) =$/)
     {
-      # Do not change the RHS, which specifies the GPERF program.
+      # Do not change the RHS when it specifies the GPERF program
+      # or when the LHS is charset_alias.  The latter's RHS already
+      # includes $(libdir), e.g.,
+      # charset_alias = $(DESTDIR)$(libdir)/charset.alias
     }
   elsif ($lhs_and_assign_op =~
       /^(SUBDIRS|EXTRA_DIST|BUILT_SOURCES|SUFFIXES|MOSTLYCLEANFILES
          |CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES|AM_CFLAGS
          |AM_CPPFLAGS|AM_GNU_GETTEXT)\ =/x)
     {
+      # Some variables are initialized by gnulib.mk, and we don't want
+      # that.  Change '=' to '+='.
       $lhs_and_assign_op =~ s/=/+=/;
     }
   # We don't want to inherit gnulib's AUTOMAKE_OPTIONS, comment them.
--
1.8.0