# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../make/make-3.82-0003-archives-many-objects.patch # Copyright (C) 2012 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From d3df5370acf8000b7319417f885a584230658ddc Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Mon, 22 Oct 2012 17:50:44 +0200 Subject: [PATCH] archives many objects ChangeLog: 2010-08-13 Paul Smith * read.c (parse_file_seq): Fix various errors parsing archives with multiple objects in the parenthesis, as well as wildcards. Fixes Savannah bug #30612. tests/ChangeLog: 2010-08-13 Paul Smith * scripts/features/archives: New regression tests for archive support. Test for fix to Savannah bug #30612. --- read.c | 15 ++++++++----- tests/scripts/features/archives | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 tests/scripts/features/archives diff --git a/read.c b/read.c index a3ad88e..9dfd4ea 100644 --- a/read.c +++ b/read.c @@ -3028,7 +3028,7 @@ parse_file_seq (char **stringp, unsigned int size, int stopchar, { /* 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 @@ parse_file_seq (char **stringp, unsigned int size, int stopchar, 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 @@ parse_file_seq (char **stringp, unsigned int size, int stopchar, 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) diff --git a/tests/scripts/features/archives b/tests/scripts/features/archives new file mode 100644 index 0000000..00aa1af --- /dev/null +++ b/tests/scripts/features/archives @@ -0,0 +1,42 @@ +# -*-mode: perl-*- + +$description = "Test GNU make's archive management features."; + +$details = "\ +This only works on systems that support it."; + +# If this instance of make doesn't support archives, skip it +exists $FEATURES{archives} or return -1; + +# Create some .o files to work with +utouch(-60, qw(a1.o a2.o a3.o)); + +# Very simple +run_make_test('all: libxx.a(a1.o)', + '', "ar rv libxx.a a1.o\nar: creating libxx.a\na - a1.o\n"); + +# Multiple .o's. Add a new one to the existing library +run_make_test('all: libxx.a(a1.o a2.o)', + '', "ar rv libxx.a a2.o\na - a2.o\n"); + +# Touch one of the .o's so it's rebuilt +utouch(-40, 'a1.o'); +run_make_test(undef, '', "ar rv libxx.a a1.o\nr - a1.o\n"); + +# Use wildcards +run_make_test('all: libxx.a(*.o)', + '', "#MAKE#: Nothing to be done for `all'.\n"); + +# Touch one of the .o's so it's rebuilt +utouch(-30, 'a1.o'); +run_make_test(undef, '', "ar rv libxx.a a1.o\nr - a1.o\n"); + +# Use both wildcards and simple names +utouch(-50, 'a2.o'); +run_make_test('all: libxx.a(a3.o *.o)', '', + "ar rv libxx.a a3.o\na - a3.o\nar rv libxx.a a2.o\nr - a2.o\n"); + +rmfiles(qw(a1.o a2.o a3.o libxx.a)); + +# This tells the test driver that the perl test script executed properly. +1; -- 1.7.2.3