[SV #38442] Add library names to the string cache.

This commit is contained in:
Paul Smith 2013-05-26 16:53:17 -04:00
parent c11024b3b3
commit dc922e3f4c
5 changed files with 29 additions and 4 deletions

View file

@ -1,5 +1,8 @@
2013-05-26 Paul Smith <psmith@gnu.org> 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 * read.c (readline): To be safe, move the entire buffer if we
detect a CR. Fixes Savannah bug #38945. detect a CR. Fixes Savannah bug #38945.

2
file.c
View file

@ -1052,7 +1052,7 @@ print_file_data_base (void)
#define VERIFY_CACHED(_p,_n) \ #define VERIFY_CACHED(_p,_n) \
do{\ do{\
if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \ 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) }while(0)
static void static void

View file

@ -1256,7 +1256,7 @@ f_mtime (struct file *file, int search)
arlen = strlen (arfile->hname); arlen = strlen (arfile->hname);
memlen = strlen (memname); memlen = strlen (memname);
name = xmalloc (arlen + 1 + memlen + 2); name = alloca (arlen + 1 + memlen + 2);
memcpy (name, arfile->hname, arlen); memcpy (name, arfile->hname, arlen);
name[arlen] = '('; name[arlen] = '(';
memcpy (name + arlen + 1, memname, memlen); 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; /* If the archive was found with GPATH, make the change permanent;
otherwise defer it until later. */ otherwise defer it until later. */
if (arfile->name == arfile->hname) if (arfile->name == arfile->hname)
rename_file (file, name); rename_file (file, strcache_add (name));
else else
rehash_file (file, name); rehash_file (file, strcache_add (name));
check_renamed (file); check_renamed (file);
} }

View file

@ -1,5 +1,7 @@
2013-05-26 Paul Smith <psmith@gnu.org> 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. * scripts/misc/bs-nl: Test for Savannah bug #39035.
Add a test for Savannah bug #38945. Add a test for Savannah bug #38945.

View file

@ -51,5 +51,25 @@ foo(bar).baz: ; @echo '$@'
!, !,
'', "foo(bar).baz\n"); '', "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. # This tells the test driver that the perl test script executed properly.
1; 1;