- Upstream 3.81:

- Contains several backwards incompatible changes. See NEWS inside the
    source package to find out more.
- memory patch and error reporting patch were ported to this version.
This commit is contained in:
Petr Machata 2006-05-23 14:18:17 +00:00
parent 6611600d86
commit 0146d90ab4
5 changed files with 424 additions and 13 deletions

View File

@ -1 +1 @@
make-3.80.tar.bz2
make-3.81.tar.bz2

View File

@ -0,0 +1,151 @@
--- make-3.80/misc.c.jj 2002-09-12 18:15:58.000000000 -0400
+++ make-3.80/misc.c 2005-08-22 05:46:05.000000000 -0400
@@ -311,17 +311,31 @@ strerror (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 */
}
--- make-3.81/main.c.jj 2006-05-23 12:51:25.000000000 +0200
+++ make-3.81/main.c 2006-05-23 12:50:48.000000000 +0200
@@ -1502,13 +1502,13 @@
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);
}
(void) fclose (outfile);
@@ -1681,7 +1681,7 @@
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."));
@@ -1721,7 +1721,7 @@
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
@@ -1736,7 +1736,7 @@
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. */
@@ -2151,8 +2151,8 @@
/* 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);
{
int status;
--- make-3.81/make.h.jj 2006-05-23 12:54:45.000000000 +0200
+++ make-3.81/make.h 2006-05-23 12:55:00.000000000 +0200
@@ -414,6 +414,8 @@
extern void log_working_directory PARAMS ((int));
extern void pfatal_with_name PARAMS ((const char *)) __attribute__ ((noreturn));
extern void perror_with_name PARAMS ((const char *, const char *));
+extern void pfatal_with_name_err PARAMS ((const char *, int errnum)) __attribute__ ((noreturn));
+extern void perror_with_name_err PARAMS ((const char *, const char *, int errnum));
extern char *savestring PARAMS ((const char *, unsigned int));
extern char *concat PARAMS ((const char *, const char *, const char *));
extern char *xmalloc PARAMS ((unsigned int));
--- make-3.81/job.c.jj 2006-05-23 13:01:35.000000000 +0200
+++ make-3.81/job.c 2006-05-23 13:50:44.000000000 +0200
@@ -859,7 +859,7 @@
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 0x%08lx (%s).\n"),
(unsigned long int) child, child->file->name));
@@ -1699,6 +1699,7 @@
/* 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);
@@ -1713,10 +1714,14 @@
/* 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
@@ -1831,7 +1836,7 @@
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;

261
make-3.81-memory.patch Normal file
View File

@ -0,0 +1,261 @@
diff -Bburpd make-3.81_orig/file.c make-3.81/file.c
--- make-3.81_orig/file.c 2006-05-23 13:59:11.000000000 +0200
+++ make-3.81/file.c 2006-05-23 14:39:34.000000000 +0200
@@ -490,7 +490,7 @@ expand_deps (struct file *f)
o = subst_expand (buffer, d->name, "%", "$*", 1, 2, 0);
- free (d->name);
+ hash_strfree (d->name);
d->name = savestring (buffer, o - buffer);
d->staticpattern = 0; /* Clear staticpattern so that we don't
re-expand %s below. */
@@ -549,7 +549,7 @@ expand_deps (struct file *f)
dp->name[0] = '\0';
else
{
- free (dp->name);
+ hash_strfree (dp->name);
dp->name = savestring (buffer, o - buffer);
}
}
@@ -580,7 +580,7 @@ expand_deps (struct file *f)
if (d1->file == 0)
d1->file = enter_file (d1->name);
else
- free (d1->name);
+ hash_strfree (d1->name);
d1->name = 0;
d1->staticpattern = 0;
d1->need_2nd_expansion = 0;
Only in make-3.81: file.c~
diff -Bburpd make-3.81_orig/implicit.c make-3.81/implicit.c
--- make-3.81_orig/implicit.c 2006-05-23 13:59:11.000000000 +0200
+++ make-3.81/implicit.c 2006-05-23 14:40:01.000000000 +0200
@@ -864,7 +864,7 @@ pattern_search (struct file *file, int a
dep->file = enter_file (dep->name);
/* enter_file uses dep->name _if_ we created a new file. */
if (dep->name != dep->file->name)
- free (dep->name);
+ hash_strfree (dep->name);
dep->name = 0;
dep->file->tried_implicit |= dep->changed;
}
Only in make-3.81: implicit.c~
diff -Bburpd make-3.81_orig/main.c make-3.81/main.c
--- make-3.81_orig/main.c 2006-05-23 13:59:11.000000000 +0200
+++ make-3.81/main.c 2006-05-23 14:40:49.000000000 +0200
@@ -540,6 +540,7 @@ initialize_global_hash_tables (void)
init_hash_files ();
hash_init_directories ();
hash_init_function_table ();
+ init_hash_strings ();
}
static struct file *
Only in make-3.81: main.c~
diff -Bburpd make-3.81_orig/make.h make-3.81/make.h
--- make-3.81_orig/make.h 2006-05-23 13:59:11.000000000 +0200
+++ make-3.81/make.h 2006-05-23 14:41:21.000000000 +0200
@@ -431,6 +431,11 @@ extern void print_spaces PARAMS ((unsign
extern char *find_percent PARAMS ((char *));
extern FILE *open_tmpfile PARAMS ((char **, const char *));
+extern void init_hash_strings PARAMS ((void));
+extern char *hash_strdup PARAMS ((const char *));
+extern char *hash_savestring PARAMS ((const char *, unsigned int));
+extern void hash_strfree PARAMS ((char *));
+
#ifndef NO_ARCHIVES
extern int ar_name PARAMS ((char *));
extern void ar_parse_name PARAMS ((char *, char **, char **));
Only in make-3.81: make.h~
diff -Bburpd make-3.81_orig/misc.c make-3.81/misc.c
--- make-3.81_orig/misc.c 2006-05-23 13:59:11.000000000 +0200
+++ make-3.81/misc.c 2006-05-23 14:42:59.000000000 +0200
@@ -16,8 +16,10 @@ You should have received a copy of the G
GNU Make; see the file COPYING. If not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */
+#include <assert.h>
#include "make.h"
#include "dep.h"
+#include "hash.h"
#include "debug.h"
/* Variadic functions. We go through contortions to allow proper function
@@ -511,7 +513,7 @@ void
free_dep (struct dep *d)
{
if (d->name != 0)
- free (d->name);
+ hash_strfree (d->name);
if (d->stem != 0)
free (d->stem);
@@ -535,7 +537,7 @@ copy_dep_chain (const struct dep *d)
bcopy ((char *) d, (char *) c, sizeof (struct dep));
if (c->name != 0)
- c->name = xstrdup (c->name);
+ c->name = hash_strdup (c->name);
if (c->stem != 0)
c->stem = xstrdup (c->stem);
@@ -909,3 +911,154 @@ close_stdout (void)
exit (EXIT_FAILURE);
}
}
+
+/* Hash table of duplicated strings. */
+
+struct hash_string
+{
+ char *string;
+ unsigned int count;
+};
+
+static unsigned long
+string_hash_1 (key)
+ const void *key;
+{
+ return_ISTRING_HASH_1 (((const struct hash_string *) key)->string);
+}
+
+static unsigned long
+string_hash_2 (key)
+ const void *key;
+{
+ return_ISTRING_HASH_2 (((const struct hash_string *) key)->string);
+}
+
+static int
+string_hash_cmp (x, y)
+ const void *x;
+ const void *y;
+{
+ return_ISTRING_COMPARE (((const struct hash_string *) x)->string,
+ ((const struct hash_string *) y)->string);
+}
+
+static struct hash_table strings;
+
+void
+init_hash_strings ()
+{
+ hash_init (&strings, 1000, string_hash_1, string_hash_2,
+ string_hash_cmp);
+}
+
+/* Keep track duplicated string and return the old one if exists. */
+
+char *
+hash_strdup (ptr)
+ const char *ptr;
+{
+ struct hash_string *h, key;
+
+ if (*ptr == '\0')
+ return "";
+
+ key.string = (char *) ptr;
+ key.count = 0;
+ h = (struct hash_string *) hash_find_item (&strings, &key);
+ if (h == NULL)
+ {
+ char *result = (char *) malloc (strlen (ptr) + 1);
+
+ if (result == NULL)
+ fatal (NILF, _("virtual memory exhausted"));
+
+ strcpy (result, ptr);
+
+ h = (struct hash_string *) malloc (sizeof (struct hash_string));
+ if (h == NULL)
+ fatal (NILF, _("virtual memory exhausted"));
+
+ h->string = result;
+ h->count = 1;
+ hash_insert (&strings, h);
+ }
+ else
+ {
+ h->count++;
+ assert (h->count != 0);
+ }
+
+ return h->string;
+}
+
+char *
+hash_savestring (str, length)
+ const char *str;
+ unsigned int length;
+{
+ struct hash_string *h, key;
+
+ if (length == 0 || *str == '\0')
+ return "";
+
+ key.string = alloca (length + 1);
+ key.count = 0;
+ bcopy (str, key.string, length);
+ key.string [length] = '\0';
+
+ h = (struct hash_string *) hash_find_item (&strings, &key);
+ if (h == NULL)
+ {
+ char *out = (char *) xmalloc (length + 1);
+ bcopy (str, out, length);
+ out[length] = '\0';
+
+ h = (struct hash_string *) malloc (sizeof (struct hash_string));
+ if (h == NULL)
+ fatal (NILF, _("virtual memory exhausted"));
+
+ h->string = out;
+ h->count = 1;
+ hash_insert (&strings, h);
+ }
+ else
+ {
+ h->count++;
+ assert (h->count != 0);
+ }
+
+ return h->string;
+}
+
+void
+hash_strfree (ptr)
+ char *ptr;
+{
+ struct hash_string *h, key;
+
+ if (*ptr == '\0')
+ return;
+
+ key.string = ptr;
+ key.count = 0;
+ h = (struct hash_string *) hash_find_item (&strings, &key);
+
+ /* Check if string comes from hash_strdup or hash_savestring. */
+ if (h == NULL || h->string != ptr)
+ {
+ free (ptr);
+ return;
+ }
+
+ h->count--;
+ if (h->count == 0)
+ {
+ struct hash_string *d;
+
+ d = hash_delete (&strings, h);
+ assert (d == h);
+ free (h->string);
+ free (h);
+ }
+}
Only in make-3.81: misc.c~
Only in make-3.81: read.c~

View File

@ -1,21 +1,17 @@
Summary: A GNU tool which simplifies the build process for users.
Name: make
Epoch: 1
Version: 3.80
Release: 11
Version: 3.81
Release: 1
License: GPL
Group: Development/Tools
URL: http://www.gnu.org/software/make/
Source: ftp://ftp.gnu.org/gnu/make/make-%{version}.tar.bz2
Patch: make-3.79.1-noclock_gettime.patch
#Patch2: make-3.79.1-siglist.patch
Patch3: make-3.80-cvs.patch
Patch4: make-3.80-j8k.patch
Patch5: make-3.80-getcwd.patch
Patch6: make-3.80-err-reporting.patch
#Patch7: make-3.80-memory-1.patch #buggy, fixed in memory-2.patch
Patch7: make-3.80-memory-2.patch
Patch8: make-3.80-patvar-2.patch
Patch6: make-3.81-err-reporting.patch
Patch7: make-3.81-memory.patch
Prereq: /sbin/install-info
Prefix: %{_prefix}
Buildroot: %{_tmppath}/%{name}-root
@ -34,13 +30,10 @@ commonly used to simplify the process of installing programs.
%prep
%setup -q
%patch -p1
#%patch2 -p1
%patch3 -p0
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
config/missing --run aclocal -I config
@ -88,6 +81,12 @@ fi
%{_infodir}/*.info*
%changelog
* Tue May 23 2006 Petr Machata <pmachata@redhat.com> - 1:3.81-1
- Upstream 3.81:
- Contains several backwards incompatible changes. See NEWS inside
the source package to find out more.
- memory patch and error reporting patch were ported to this version.
* Wed Mar 15 2006 Petr Machata <pmachata@redhat.com> 1:3.80-11
- Applied (five years old) patch from Jonathan Kamens to allow make to
handle several pattern-specific variables (#52962).

View File

@ -1 +1 @@
0bbd1df101bc0294d440471e50feca71 make-3.80.tar.bz2
354853e0b2da90c527e35aabb8d6f1e6 make-3.81.tar.bz2