chroot-make, make: sync patches with Fedora.

This commit is contained in:
Juan RP 2012-09-27 10:19:32 +02:00
parent 444edd047b
commit 94acb682d6
16 changed files with 798 additions and 119 deletions

View file

@ -1,66 +0,0 @@
http://savannah.gnu.org/bugs/?30612
--- main.c 2010-07-19 17:10:53.000000000 +1000
+++ main.c 2010-09-23 23:33:37.908855839 +1000
@@ -1,3 +1,4 @@
+
/* Argument parsing and main program of GNU Make.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@@ -1138,7 +1139,7 @@
a macro and some compilers (MSVC) don't like conditionals in macros. */
{
const char *features = "target-specific order-only second-expansion"
- " else-if shortest-stem undefine"
+ " else-if shortest-stem undefine oneshell"
#ifndef NO_ARCHIVES
" archives"
#endif
--- read.c 2010-07-13 11:20:42.000000000 +1000
+++ read.c 2010-09-23 23:30:58.018855839 +1000
@@ -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,11 @@
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)

View file

@ -1,13 +0,0 @@
http://savannah.gnu.org/bugs/?30723
--- main.c 2010-07-19 17:10:53.000000000 +1000
+++ main.c 2010-09-23 23:34:10.932188592 +1000
@@ -2093,7 +2093,7 @@
const char *pv = define_makeflags (1, 1);
char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1);
sprintf (p, "MAKEFLAGS=%s", pv);
- putenv (p);
+ putenv (allocated_variable_expand (p));
}
if (ISDB (DB_BASIC))

View file

@ -0,0 +1,243 @@
diff -urpN make/ChangeLog make-new/ChangeLog
--- ChangeLog 2010-09-13 13:42:35.000000000 +0200
+++ ChangeLog 2010-09-13 13:42:09.000000000 +0200
@@ -1,3 +1,22 @@
+2010-08-13 Paul Smith <psmith@gnu.org>
+
+ * NEWS: Accidentally forgot to back out the sorted wildcard
+ enhancement in 3.82, so update NEWS.
+ Also add NEWS about the error check for explicit and pattern
+ targets in the same rule, added to 3.82.
+
+ * main.c (main): Add "oneshell" to $(.FEATURES) (forgot to add
+ this in 3.82!)
+
+ * read.c (parse_file_seq): Fix various errors parsing archives
+ with multiple objects in the parenthesis, as well as wildcards.
+ Fixes Savannah bug #30612.
+
+2010-08-10 Paul Smith <psmith@gnu.org>
+
+ * main.c (main): Expand MAKEFLAGS before adding it to the
+ environment when re-exec'ing. Fixes Savannah bug #30723.
+
2010-07-28 Paul Smith <psmith@gnu.org>
Version 3.82 released.
--- main.c 2010-09-13 13:42:35.000000000 +0200
+++ main.c 2010-09-13 13:42:12.000000000 +0200
@@ -1138,7 +1138,7 @@ main (int argc, char **argv, char **envp
a macro and some compilers (MSVC) don't like conditionals in macros. */
{
const char *features = "target-specific order-only second-expansion"
- " else-if shortest-stem undefine"
+ " else-if shortest-stem undefine oneshell"
#ifndef NO_ARCHIVES
" archives"
#endif
@@ -2093,7 +2093,7 @@ main (int argc, char **argv, char **envp
const char *pv = define_makeflags (1, 1);
char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1);
sprintf (p, "MAKEFLAGS=%s", pv);
- putenv (p);
+ putenv (allocated_variable_expand (p));
}
if (ISDB (DB_BASIC))
--- NEWS 2010-09-13 13:42:35.000000000 +0200
+++ NEWS 2010-09-13 13:42:11.000000000 +0200
@@ -18,14 +18,6 @@ http://sv.gnu.org/bugs/index.php?group=m
* Compiling GNU make now requires a conforming ISO C 1989 compiler and
standard runtime library.
-* WARNING: Future backward-incompatibility!
- Wildcards are not documented as returning sorted values, but up to and
- including this release the results have been sorted and some makefiles are
- apparently depending on that. In the next release of GNU make, for
- performance reasons, we may remove that sorting. If your makefiles
- require sorted results from wildcard expansions, use the $(sort ...)
- function to request it explicitly.
-
* WARNING: Backward-incompatibility!
The POSIX standard for make was changed in the 2008 version in a
fundamentally incompatible way: make is required to invoke the shell as if
@@ -42,6 +34,21 @@ http://sv.gnu.org/bugs/index.php?group=m
existing targets were provided in $?).
* WARNING: Backward-incompatibility!
+ Wildcards were not documented as returning sorted values, but the results
+ have been sorted up until this release.. If your makefiles require sorted
+ results from wildcard expansions, use the $(sort ...) function to request
+ it explicitly.
+
+* WARNING: Backward-incompatibility!
+ In previous versions of make it was acceptable to list one or more explicit
+ targets followed by one or more pattern targets in the same rule and it
+ worked "as expected". However, this was not documented as acceptable and if
+ you listed any explicit targets AFTER the pattern targets, the entire rule
+ would be mis-parsed. This release removes this ability completely: make
+ will generate an error message if you mix explicit and pattern targets in
+ the same rule.
+
+* WARNING: Backward-incompatibility!
As a result of parser enhancements, three backward-compatibility issues
exist: first, a prerequisite containing an "=" cannot be escaped with a
backslash any longer. You must create a variable containing an "=" and
--- read.c 2010-09-13 13:42:35.000000000 +0200
+++ read.c 2010-09-13 13:42:11.000000000 +0200
@@ -3028,7 +3028,7 @@ parse_file_seq (char **stringp, unsigned
{
/* 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
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
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)
--- tests/ChangeLog 2010-09-13 13:42:35.000000000 +0200
+++ tests/ChangeLog 2010-09-13 13:42:10.000000000 +0200
@@ -1,3 +1,16 @@
+2010-08-13 Paul Smith <psmith@gnu.org>
+
+ * scripts/features/archives: New regression tests for archive
+ support. Test for fix to Savannah bug #30612.
+
+ * run_make_tests.pl (set_more_defaults): Set a %FEATURES hash to
+ the features available in $(.FEATURES).
+
+2010-08-10 Paul Smith <psmith@gnu.org>
+
+ * scripts/features/reinvoke: Ensure command line variable settings
+ are preserved across make re-exec. Tests Savannah bug #30723.
+
2010-07-28 Paul Smith <psmith@gnu.org>
* scripts/targets/POSIX: Compatibility issues with Solaris (and
--- tests/run_make_tests.pl 2010-09-13 13:42:35.000000000 +0200
+++ tests/run_make_tests.pl 2010-09-13 13:42:10.000000000 +0200
@@ -29,6 +29,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
+%FEATURES = ();
$valgrind = 0; # invoke make with valgrind
$valgrind_args = '';
@@ -367,6 +368,8 @@ sub set_more_defaults
$parallel_jobs = 1;
}
+ %FEATURES = map { $_ => 1 } split /\s+/, `sh -c "echo '\\\$(info \\\$(.FEATURES))' | $make_path -f- 2>/dev/null"`;
+
# Set up for valgrind, if requested.
if ($valgrind) {
--- tests/scripts/features/archives 1970-01-01 01:00:00.000000000 +0100
+++ tests/scripts/features/archives 2010-09-13 13:42:10.000000000 +0200
@@ -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;
--- tests/scripts/features/reinvoke 2010-09-13 13:42:35.000000000 +0200
+++ tests/scripts/features/reinvoke 2010-09-13 13:42:10.000000000 +0200
@@ -57,9 +57,24 @@ include $(F)',
# Now try with the file we're not updating being the actual file we're
# including: this and the previous one test different parts of the code.
-run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n")
+run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n")
&rmfiles('a','b','c');
+# Ensure command line variables are preserved properly across re-exec
+# Tests for Savannah bug #30723
+
+run_make_test('
+ifdef RECURSE
+-include foo30723
+endif
+recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test
+test: ; @echo F.O=$(F.O)
+foo30723: ; @touch $@
+',
+ '--no-print-directory F.O=bar', "F.O=bar\n");
+
+unlink('foo30723');
+
# This tells the test driver that the perl test script executed properly.
1;

View file

@ -0,0 +1,77 @@
From 2f661dc20617ba6fdeb2d7e243dc898653faafea Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Tue, 26 Apr 2011 21:50:26 +0200
Subject: [PATCH] Always copy the string before expanding it
It might get freed during expansion, e.g. with eval function.
A simple reproducer:
TRUE = $(eval TRUE := true)
all:
$(TRUE)
---
ChangeLog | 5 +++++
expand.c | 18 +++++++++---------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 91878fb..7519164 100644
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,8 @@
+2011-04-26 Lubomir Rintel <lkundrak@v3.sk>
+
+ * expand.c (variable_expand_string): Always copy the string
+ to expand.
+
2010-08-13 Paul Smith <psmith@gnu.org>
* NEWS: Accidentally forgot to back out the sorted wildcard
diff --git a/expand.c b/expand.c
index 2315b06..3e6e346 100644
--- expand.c
+++ expand.c
@@ -197,7 +197,7 @@ variable_expand_string (char *line, const char *string, long length)
{
struct variable *v;
const char *p, *p1;
- char *abuf = NULL;
+ char *abuf;
char *o;
unsigned int line_offset;
@@ -214,14 +214,15 @@ variable_expand_string (char *line, const char *string, long length)
/* If we want a subset of the string, allocate a temporary buffer for it.
Most of the functions we use here don't work with length limits. */
- if (length > 0 && string[length] != '\0')
+ if (length == -1)
{
- abuf = xmalloc(length+1);
- memcpy(abuf, string, length);
- abuf[length] = '\0';
- string = abuf;
+ length = strlen (string);
}
- p = string;
+
+ abuf = xmalloc(length+1);
+ memcpy(abuf, string, length);
+ abuf[length] = '\0';
+ p = abuf;
while (1)
{
@@ -411,8 +412,7 @@ variable_expand_string (char *line, const char *string, long length)
++p;
}
- if (abuf)
- free (abuf);
+ free (abuf);
variable_buffer_output (o, "", 1);
return (variable_buffer + line_offset);
--
1.7.4.1

View file

@ -0,0 +1,154 @@
--- misc.c 2010-07-19 09:10:54.000000000 +0200
+++ misc.c 2010-08-11 15:26:45.000000000 +0200
@@ -342,17 +342,31 @@ strerror (int errnum)
/* Print an error message from errno. */
void
+perror_with_name_err (const char *str, const char *name, int errnum)
+{
+ error (NILF, _("%s%s: %s"), str, name, strerror (errnum));
+}
+
+void
perror_with_name (const char *str, const char *name)
{
- error (NILF, _("%s%s: %s"), str, name, strerror (errno));
+ perror_with_name_err (str, name, errno);
}
/* Print an error message from errno and exit. */
void
+pfatal_with_name_err (const char *name, int errnum)
+{
+ fatal (NILF, _("%s: %s"), name, strerror (errnum));
+
+ /* NOTREACHED */
+}
+
+void
pfatal_with_name (const char *name)
{
- fatal (NILF, _("%s: %s"), name, strerror (errno));
+ pfatal_with_name_err (name, errno);
/* NOTREACHED */
}
--- main.c 2010-08-11 15:34:12.000000000 +0200
+++ main.c 2010-08-11 15:30:11.000000000 +0200
@@ -1536,13 +1536,13 @@ main (int argc, char **argv, char **envp
strcat (template, DEFAULT_TMPFILE);
outfile = open_tmpfile (&stdin_nm, template);
if (outfile == 0)
- pfatal_with_name (_("fopen (temporary file)"));
+ pfatal_with_name_err (_("fopen (temporary file)"), errno);
while (!feof (stdin) && ! ferror (stdin))
{
char buf[2048];
unsigned int n = fread (buf, 1, sizeof (buf), stdin);
if (n > 0 && fwrite (buf, 1, n, outfile) != n)
- pfatal_with_name (_("fwrite (temporary file)"));
+ pfatal_with_name_err (_("fwrite (temporary file)"), errno);
}
fclose (outfile);
@@ -1747,7 +1747,7 @@ main (int argc, char **argv, char **envp
else if ((job_rfd = dup (job_fds[0])) < 0)
{
if (errno != EBADF)
- pfatal_with_name (_("dup jobserver"));
+ pfatal_with_name_err (_("dup jobserver"), errno);
error (NILF,
_("warning: jobserver unavailable: using -j1. Add `+' to parent make rule."));
@@ -1788,7 +1788,7 @@ main (int argc, char **argv, char **envp
char c = '+';
if (pipe (job_fds) < 0 || (job_rfd = dup (job_fds[0])) < 0)
- pfatal_with_name (_("creating jobs pipe"));
+ pfatal_with_name_err (_("creating jobs pipe"), errno);
/* Every make assumes that it always has one job it can run. For the
submakes it's the token they were given by their parent. For the
@@ -1803,7 +1803,7 @@ main (int argc, char **argv, char **envp
EINTRLOOP (r, write (job_fds[1], &c, 1));
if (r != 1)
- pfatal_with_name (_("init jobserver pipe"));
+ pfatal_with_name_err (_("init jobserver pipe"), errno);
}
/* Fill in the jobserver_fds struct for our children. */
@@ -2226,7 +2226,7 @@ main (int argc, char **argv, char **envp
/* If there is a temp file from reading a makefile from stdin, get rid of
it now. */
if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT)
- perror_with_name (_("unlink (temporary file): "), stdin_nm);
+ perror_with_name_err (_("unlink (temporary file): "), stdin_nm, errno);
/* If there were no command-line goals, use the default. */
if (goals == 0)
Только в make-3.82-pm: job.c~
Только в make-3.82-pm: main.c~
--- make.h 2010-08-11 15:34:12.000000000 +0200
+++ make.h 2010-08-11 15:31:26.000000000 +0200
@@ -385,6 +385,8 @@ void die (int) __attribute__ ((noreturn)
void log_working_directory (int);
void pfatal_with_name (const char *) __attribute__ ((noreturn));
void perror_with_name (const char *, const char *);
+void pfatal_with_name_err (const char *, int errnum) __attribute__ ((noreturn));
+void perror_with_name_err (const char *, const char *, int errnum);
void *xmalloc (unsigned int);
void *xcalloc (unsigned int);
void *xrealloc (void *, unsigned int);
diff -urp make-3.82/job.c make-3.82-pm/job.c
--- job.c 2010-07-24 10:27:50.000000000 +0200
+++ job.c 2010-08-11 15:33:54.000000000 +0200
@@ -917,7 +917,7 @@ free_child (struct child *child)
EINTRLOOP (r, write (job_fds[1], &token, 1));
if (r != 1)
- pfatal_with_name (_("write jobserver"));
+ pfatal_with_name_err (_("write jobserver"), errno);
DB (DB_JOBS, (_("Released token for child %p (%s).\n"),
child, child->file->name));
@@ -1768,6 +1768,7 @@ new_job (struct file *file)
/* Set interruptible system calls, and read() for a job token. */
set_child_handler_action_flags (1, waiting_jobs != NULL);
+ errno = 0;
got_token = read (job_rfd, &token, 1);
saved_errno = errno;
set_child_handler_action_flags (0, waiting_jobs != NULL);
@@ -1782,10 +1783,14 @@ new_job (struct file *file)
/* If the error _wasn't_ expected (EINTR or EBADF), punt. Otherwise,
go back and reap_children(), and try again. */
- errno = saved_errno;
- if (errno != EINTR && errno != EBADF)
- pfatal_with_name (_("read jobs pipe"));
- if (errno == EBADF)
+ if (saved_errno != EINTR && saved_errno != EBADF)
+ {
+ if (got_token == 0)
+ fatal (NILF, _("read jobs pipe EOF"));
+ else
+ pfatal_with_name_err (_("read jobs pipe"), saved_errno);
+ }
+ if (saved_errno == EBADF)
DB (DB_JOBS, ("Read returned EBADF.\n"));
}
#endif
@@ -1909,7 +1914,8 @@ load_too_high (void)
error (NILF,
_("cannot enforce load limits on this operating system"));
else
- perror_with_name (_("cannot enforce load limit: "), "getloadavg");
+ perror_with_name_err (_("cannot enforce load limit: "),
+ "getloadavg", errno);
}
lossage = errno;
load = 0;
Только в make-3.82-pm: make.h~
Только в make-3.82-pm: misc.c.orig

View file

@ -0,0 +1,13 @@
--- make.h~ 2010-07-20 15:12:06.000000000 +0200
+++ make.h 2010-08-11 15:19:09.000000000 +0200
@@ -472,7 +472,7 @@ long int lseek ();
#endif /* Not GNU C library or POSIX. */
#ifdef HAVE_GETCWD
-# if !defined(VMS) && !defined(__DECC)
+# if !defined(VMS) && !defined(__DECC) && !defined(getcwd)
char *getcwd ();
# endif
#else
Diff finished. Wed Aug 11 15:19:12 2010

View file

@ -0,0 +1,25 @@
--- main.c~ 2010-07-19 09:10:53.000000000 +0200
+++ main.c 2010-08-11 15:12:09.000000000 +0200
@@ -1765,6 +1765,20 @@ main (int argc, char **argv, char **envp
}
}
+#ifdef PIPE_BUF
+ if (job_slots > PIPE_BUF)
+#elif defined _POSIX_PIPE_BUF
+ if (job_slots > _POSIX_PIPE_BUF)
+#else
+ if (job_slots > 512)
+#endif
+ {
+ error (NILF,
+ _("More parallel jobs (-jN) than this platform can handle requested."));
+ error (NILF, _("Resetting to single job (-j1) mode."));
+ job_slots = 1;
+ }
+
/* If we have >1 slot but no jobserver-fds, then we're a top-level make.
Set up the pipe and install the fds option for our children. */
Diff finished. Wed Aug 11 15:12:32 2010

View file

@ -0,0 +1,18 @@
--- main.c~ 2010-08-12 14:59:20.000000000 +0200
+++ main.c 2010-08-12 15:00:07.000000000 +0200
@@ -1756,8 +1756,11 @@ main (int argc, char **argv, char **envp
if (job_slots > 0)
{
- close (job_fds[0]);
- close (job_fds[1]);
+ if (restarts == 0)
+ {
+ close (job_fds[0]);
+ close (job_fds[1]);
+ }
job_fds[0] = job_fds[1] = -1;
free (jobserver_fds->list);
free (jobserver_fds);
Diff finished. Thu Aug 12 15:00:22 2010

View file

@ -1,38 +0,0 @@
https://savannah.gnu.org/bugs/?33873
Index: main.c
===================================================================
RCS file: /sources/make/make/main.c,v
retrieving revision 1.246
diff -u -r1.246 main.c
--- main.c 29 Aug 2010 23:05:27 -0000 1.246
+++ main.c 27 Jul 2011 22:03:12 -0000
@@ -2091,10 +2095,16 @@
/* Reset makeflags in case they were changed. */
{
+ if (master_job_slots)
+ {
+ assert (job_slots == default_job_slots);
+ job_slots = master_job_slots;
+ }
const char *pv = define_makeflags (1, 1);
char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1);
sprintf (p, "MAKEFLAGS=%s", pv);
putenv (allocated_variable_expand (p));
+ job_slots = default_job_slots;
}
if (ISDB (DB_BASIC))
@@ -2825,9 +2852,11 @@
&& (*(unsigned int *) cs->value_ptr ==
*(unsigned int *) cs->noarg_value))
ADD_FLAG ("", 0); /* Optional value omitted; see below. */
+#if 0
else if (cs->c == 'j')
/* Special case for `-j'. */
ADD_FLAG ("1", 1);
+#endif
else
{
char *buf = alloca (30);

View file

@ -0,0 +1,29 @@
--- job.c~ 2010-08-12 14:57:15.000000000 +0200
+++ job.c 2010-08-12 14:58:23.000000000 +0200
@@ -2876,7 +2876,7 @@ construct_command_argv_internal (char *l
}
new_line = alloca (shell_len + 1 + sflags_len + 1
- + (line_len*2) + 1);
+ + (line_len*4) + 1);
ap = new_line;
memcpy (ap, shell, shell_len);
ap += shell_len;
@@ -2904,13 +2904,14 @@ construct_command_argv_internal (char *l
#endif
if (PRESERVE_BSNL)
{
- *(ap++) = '\\';
+ *(ap++) = '\'';
/* Only non-batch execution needs another backslash,
because it will be passed through a recursive
invocation of this function. */
if (!batch_mode_shell)
*(ap++) = '\\';
*(ap++) = '\n';
+ *(ap++) = '\'';
}
++p;
continue;
Diff finished. Thu Aug 12 14:58:34 2010

View file

@ -0,0 +1,30 @@
Index: main.c
===================================================================
RCS file: /sources/make/make/main.c,v
retrieving revision 1.247
retrieving revision 1.246
diff -u -r1.247 -r1.246
--- main.c 18 Sep 2011 23:39:26 -0000 1.247
+++ main.c 29 Aug 2010 23:05:27 -0000 1.246
@@ -2089,6 +2089,11 @@
++restarts;
+ /* If we're re-exec'ing the first make, put back the number of
+ job slots so define_makefiles() will get it right. */
+ if (master_job_slots)
+ job_slots = master_job_slots;
+
/* Reset makeflags in case they were changed. */
{
const char *pv = define_makeflags (1, 1);
@@ -2830,9 +2825,6 @@
&& (*(unsigned int *) cs->value_ptr ==
*(unsigned int *) cs->noarg_value))
ADD_FLAG ("", 0); /* Optional value omitted; see below. */
- else if (cs->c == 'j')
- /* Special case for `-j'. */
- ADD_FLAG ("1", 1);
else
{
char *buf = alloca (30);

View file

@ -0,0 +1,108 @@
This patch add the support for --debug=c and --debug=e to make
this option when activated will trace in stdout the activity of $(call and $(eval in the Makefile
The trace use the format:
### xxx -->
### xxx <--
the number of space before ### is at least 1 and increase with the nesting of eval/call
usage: make --debug=c,e
--- debug.h 2010-07-12 20:20:38.000000000 -0500
+++ debug.h 2011-06-22 12:06:37.000000000 -0500
@@ -21,6 +21,8 @@
#define DB_JOBS (0x004)
#define DB_IMPLICIT (0x008)
#define DB_MAKEFILES (0x100)
+#define DB_CALL (0x01000)
+#define DB_EVAL (0x02000)
#define DB_ALL (0xfff)
--- function.c 2011-06-23 01:01:35.000000000 -0500
+++ function.c 2011-06-23 01:40:05.000000000 -0500
@@ -28,6 +28,8 @@
#include "amiga.h"
#endif
+static int depth = 0;
+
struct function_table_entry
{
@@ -1371,7 +1373,12 @@
install_variable_buffer (&buf, &len);
+ depth += 1;
+ DBS( DB_EVAL, ("### eval -->\n"));
+ DB( DB_EVAL, ("%s\n", argv[0]));
eval_buffer (argv[0]);
+ DBS( DB_EVAL, ("### eval <--\n"));
+ depth -= 1;
restore_variable_buffer (buf, len);
@@ -2338,6 +2345,7 @@
if (v == 0 || *v->value == '\0')
return o;
+ depth += 1;
body = alloca (flen + 4);
body[0] = '$';
body[1] = '(';
@@ -2345,6 +2353,7 @@
body[flen+2] = ')';
body[flen+3] = '\0';
+ DBS(DB_CALL, ("### call %s -->\n", body));
/* Set up arguments $(1) .. $(N). $(0) is the function name. */
push_new_variable_scope ();
@@ -2354,6 +2363,7 @@
char num[11];
sprintf (num, "%d", i);
+ DBS(DB_CALL, ("### arg %i for call %s is '%s'\n", i, body, *argv));
define_variable (num, strlen (num), *argv, o_automatic, 0);
}
@@ -2367,6 +2377,7 @@
char num[11];
sprintf (num, "%d", i);
+ DBS(DB_CALL, ("### arg %i for call %s is implicit\n", i, body));
define_variable (num, strlen (num), "", o_automatic, 0);
}
@@ -2377,7 +2388,14 @@
saved_args = max_args;
max_args = i;
+
o = variable_expand_string (o, body, flen+3);
+ DBS(DB_CALL, ("### call to %s expended into\n", body));
+ DB(DB_CALL, ("%s\n", o));
+ DBS(DB_CALL, ("### call %s <--\n", body));
+
+ depth -= 1;
+
max_args = saved_args;
v->exp_count = 0;
--- main.c 2010-07-19 02:10:53.000000000 -0500
+++ main.c 2011-06-22 11:46:39.000000000 -0500
@@ -634,6 +634,12 @@
case 'b':
db_level |= DB_BASIC;
break;
+ case 'c':
+ db_level |= DB_CALL;
+ break;
+ case 'e':
+ db_level |= DB_EVAL;
+ break;
case 'i':
db_level |= DB_BASIC | DB_IMPLICIT;
break;

View file

@ -0,0 +1,84 @@
diff --git a/make-3.82-gbuild/function.c b/make-3.82-gbuild/function.c
index e2f6c8c..ff0527f 100644
--- function.c
+++ function.c
@@ -2333,8 +2333,10 @@ func_call (char *o, char **argv, const char *funcname UNUSED)
v = lookup_variable (fname, flen);
if (v == 0)
- warn_undefined (fname, flen);
-
+ {
+ warn_undefined (fname, flen);
+ warn_undefined_function (fname, flen);
+ }
if (v == 0 || *v->value == '\0')
return o;
diff --git a/make-3.82-gbuild/main.c b/make-3.82-gbuild/main.c
index c6989e3..2f545a7 100644
--- main.c
+++ main.c
@@ -275,6 +275,11 @@ static int print_usage_flag = 0;
int warn_undefined_variables_flag;
+/* If nonzero, we should print a warning message
+ for each attemtp to call an undefined user function. */
+
+int warn_undefined_functions_flag;
+
/* If nonzero, always build all targets, regardless of whether
they appear out of date or not. */
@@ -368,6 +373,8 @@ static const char *const usage[] =
Consider FILE to be infinitely new.\n"),
N_("\
--warn-undefined-variables Warn when an undefined variable is referenced.\n"),
+ N_("\
+ --warn-undefined-functions Warn when an undefined user function is called.\n"),
NULL
};
@@ -424,6 +431,8 @@ static const struct command_switch switches[] =
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
"warn-undefined-variables" },
{ CHAR_MAX+6, string, &eval_strings, 1, 0, 0, 0, 0, "eval" },
+ { CHAR_MAX+7, flag, &warn_undefined_functions_flag, 1, 1, 0, 0, 0,
+ "warn-undefined-functions" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
diff --git a/make-3.82-gbuild/make.h b/make-3.82-gbuild/make.h
index 60ade4c..f2ebb56 100644
--- make.h
+++ make.h
@@ -513,7 +513,7 @@ extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
extern int print_version_flag, print_directory_flag, check_symlink_flag;
extern int warn_undefined_variables_flag, posix_pedantic, not_parallel;
extern int second_expansion, clock_skew_detected, rebuilding_makefiles;
-extern int one_shell;
+extern int one_shell, warn_undefined_functions_flag;
/* can we run commands via 'sh -c xxx' or must we use batch files? */
extern int batch_mode_shell;
diff --git a/make-3.82-gbuild/variable.h b/make-3.82-gbuild/variable.h
index c215867..02713c1 100644
--- variable.h
+++ variable.h
@@ -220,6 +220,13 @@ void undefine_variable_in_set (const char *name, unsigned int length,
(int)(l), (n)); \
}while(0)
+#define warn_undefined_function(n,l) do{\
+ if (warn_undefined_functions_flag) \
+ error (reading_file, \
+ _("warning: undefined function `%.*s'"), \
+ (int)(l), (n)); \
+ }while(0)
+
char **target_environment (struct file *file);
struct pattern_var *create_pattern_var (const char *target,
--
cgit v0.9.0.2-2-gbebe

View file

@ -0,0 +1,15 @@
--- job.c~ 2010-08-11 16:13:33.000000000 +0200
+++ job.c 2010-08-12 14:20:08.000000000 +0200
@@ -2442,7 +2442,11 @@ construct_command_argv_internal (char *l
/* See if it is safe to parse commands internally. */
if (shell == 0)
- shell = default_shell;
+ {
+ shell = default_shell;
+ if (shellflags == 0)
+ shellflags = "-c";
+ }
#ifdef WINDOWS32
else if (strcmp (shell, default_shell))
{

View file

@ -1,7 +1,7 @@
# Template build file for 'chroot-make'
pkgname=chroot-make
version=3.82
revision=2
revision=3
wrksrc="make-${version}"
build_style=gnu-configure
configure_args="--disable-nls"

View file

@ -1,7 +1,7 @@
# Template build file for 'make'
pkgname=make
version=3.82
revision=3
revision=4
build_style=gnu-configure
short_desc="The GNU make system"
maintainer="Juan RP <xtraeme@gmail.com>"