[SV #38442] Add library names to the string cache.
authorPaul Smith <psmith@gnu.org>
Sun, 26 May 2013 20:53:17 +0000 (16:53 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 26 May 2013 20:53:17 +0000 (16:53 -0400)
ChangeLog
file.c
remake.c
tests/ChangeLog
tests/scripts/features/archives

index 498ad56f08f4619bc8ed1341d06370a223f3c9f0..5f5dd93532f1a1f1d614c8d2ce846dba6cb9005a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2013-05-26  Paul Smith  <psmith@gnu.org>
 
+       * remake.c (f_mtime): Ensure that archive file names are in the
+       string cache.  Fixes Savannah bug #38442.
+
        * read.c (readline): To be safe, move the entire buffer if we
        detect a CR.  Fixes Savannah bug #38945.
 
diff --git a/file.c b/file.c
index a2371741c127ef8fb64e8a5a565ea3453215efa0..06a2ce5c2586aa1bb6875b294f0acb3530e44267 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1052,7 +1052,7 @@ print_file_data_base (void)
 #define VERIFY_CACHED(_p,_n) \
     do{\
         if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \
-          error (NULL, "%s: Field '%s' not cached: %s\n", _p->name, # _n, _p->_n); \
+          error (NULL, _("%s: Field '%s' not cached: %s"), _p->name, # _n, _p->_n); \
     }while(0)
 
 static void
index f56a8569504675ad20b07925a2a04eb5d697a090..06e47bc9613b155a3f55b35a14a0b318b8d84888 100644 (file)
--- a/remake.c
+++ b/remake.c
@@ -1256,7 +1256,7 @@ f_mtime (struct file *file, int search)
           arlen = strlen (arfile->hname);
           memlen = strlen (memname);
 
-          name = xmalloc (arlen + 1 + memlen + 2);
+          name = alloca (arlen + 1 + memlen + 2);
           memcpy (name, arfile->hname, arlen);
           name[arlen] = '(';
           memcpy (name + arlen + 1, memname, memlen);
@@ -1266,9 +1266,9 @@ f_mtime (struct file *file, int search)
           /* If the archive was found with GPATH, make the change permanent;
              otherwise defer it until later.  */
           if (arfile->name == arfile->hname)
-            rename_file (file, name);
+            rename_file (file, strcache_add (name));
           else
-            rehash_file (file, name);
+            rehash_file (file, strcache_add (name));
           check_renamed (file);
         }
 
index 7f1bd3cffe20ade443122b0ec34af575d6b1e828..7bdc5a12a60853994e1b5866862be8335f22200d 100644 (file)
@@ -1,5 +1,7 @@
 2013-05-26  Paul Smith  <psmith@gnu.org>
 
+       * scripts/features/archives: Test for Savannah bug #38442.
+
        * scripts/misc/bs-nl: Test for Savannah bug #39035.
        Add a test for Savannah bug #38945.
 
index 41ac26dc65f5cbdbc0434438b80cf140cdf852af..4b331c2635e7ad3da55446f752ad7fdaca1249a4 100644 (file)
@@ -51,5 +51,25 @@ foo(bar).baz: ; @echo '$@'
 !,
               '', "foo(bar).baz\n");
 
+# Check renaming of archive targets.
+# See Savannah bug #38442
+
+mkdir('artest', 0777);
+touch('foo.vhd');
+
+run_make_test(q!
+DIR = artest
+vpath % $(DIR)
+default: lib(foo)
+(%): %.vhd ; @cd $(DIR) && touch $(*F) && $(AR) $(ARFLAGS) $@ $(*F) >/dev/null 2>&1 && rm $(*F)
+.PHONY: default
+!,
+              '', "");
+
+run_make_test(undef, '', "#MAKE#: Nothing to be done for 'default'.\n");
+
+unlink('foo.vhd');
+remove_directory_tree('artest');
+
 # This tells the test driver that the perl test script executed properly.
 1;