This patch is taken from:
Fix various errors parsing archives with multiple objects in the parenthesis,
as well as wildcards. Fixes Savannah bug #30612.
Second patch is a followup for that bug as well:
--- a/read.c 2010/07/13 01:20:42 1.193
+++ b/read.c 2010/08/14 02:50:14 1.194
@@ -3028,7 +3028,7 @@
{
/* This looks like the first element in an open archive group.
A valid group MUST have ')' as the last character. */
- const char *e = p + nlen;
+ const char *e = p;
do
{
e = next_token (e);
@@ -3084,19 +3084,19 @@
Go to the next item in the string. */
if (flags & PARSEFS_NOGLOB)
{
- NEWELT (concat (2, prefix, tp));
+ NEWELT (concat (2, prefix, tmpbuf));
continue;
}
/* If we get here we know we're doing glob expansion.
TP is a string in tmpbuf. NLEN is no longer used.
We may need to do more work: after this NAME will be set. */
- name = tp;
+ name = tmpbuf;
/* Expand tilde if applicable. */
- if (tp[0] == '~')
+ if (tmpbuf[0] == '~')
{
- tildep = tilde_expand (tp);
+ tildep = tilde_expand (tmpbuf);
if (tildep != 0)
name = tildep;
}
@@ -3152,7 +3152,10 @@
else
{
/* We got a chain of items. Attach them. */
- (*newp)->next = found;
+ if (*newp)
+ (*newp)->next = found;
+ else
+ *newp = found;
/* Find and set the new end. Massage names if necessary. */
while (1)
--- a/read.c 2011/05/07 14:36:12 1.200
+++ b/read.c 2011/06/12 16:22:04 1.201
@@ -3044,16 +3044,16 @@
nlen -= (n + 1) - tp;
tp = n + 1;
- /* If we have just "lib(", part of something like
- "lib( a b)", go to the next item. */
- if (! nlen)
- continue;
-
/* We can stop looking now. */
break;
}
}
while (*e != '\0');
+
+ /* If we have just "lib(", part of something like "lib( a b)",
+ go to the next item. */
+ if (! nlen)
+ continue;
}
}