1 --- make-dfsg-4.1.orig/ar.c
5 /* This function is called by 'ar_scan' to find which member to look at. */
7 +struct member_date_lookup
10 + time_t *member_date;
15 ar_member_date_1 (int desc UNUSED, const char *mem, int truncated,
16 long int hdrpos UNUSED, long int datapos UNUSED,
17 long int size UNUSED, long int date,
18 int uid UNUSED, int gid UNUSED, int mode UNUSED,
22 - return ar_name_equal (name, mem, truncated) ? date : 0;
23 + const struct member_date_lookup *lookup_data = data;
24 + if (ar_name_equal (lookup_data->name, mem, truncated))
26 + *lookup_data->member_date = date;
32 -/* Return the modtime of NAME. */
33 +/* Read the modtime of NAME in MEMBER_DATE.
34 + Returns 1 if NAME exists, 0 otherwise. */
37 -ar_member_date (const char *name)
39 +ar_member_date (const char *name, time_t *member_date)
45 + struct member_date_lookup lookup_data;
47 ar_parse_name (name, &arname, &memname);
50 (void) f_mtime (arfile, 0);
53 - val = ar_scan (arname, ar_member_date_1, memname);
54 + lookup_data.name = memname;
55 + lookup_data.member_date = member_date;
56 + found = ar_scan (arname, ar_member_date_1, &lookup_data);
60 - return (val <= 0 ? (time_t) -1 : (time_t) val);
61 + /* return 0 (not found) if the archive does not exist or has invalid format. */
62 + return (found == 1) ? 1 : 0;
65 /* Set the archive-member NAME's modtime to now. */
66 --- make-dfsg-4.1.orig/commands.c
67 +++ make-dfsg-4.1/commands.c
69 time_t file_date = (file->last_mtime == NONEXISTENT_MTIME
71 : (time_t) FILE_TIMESTAMP_S (file->last_mtime));
72 - if (ar_member_date (file->name) != file_date)
73 + time_t member_date = NONEXISTENT_MTIME;
75 + found = ar_member_date (file->name, &member_date);
76 + if (found && member_date != file_date)
80 --- make-dfsg-4.1.orig/configure
81 +++ make-dfsg-4.1/configure
82 @@ -11060,10 +11061,9 @@
86 -#define GLOB_INTERFACE_VERSION 1
87 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
88 # include <gnu-versions.h>
89 -# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
90 +# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2
94 --- make-dfsg-4.1.orig/dir.c
95 +++ make-dfsg-4.1/dir.c
100 - if (ar_name (name))
101 - return ar_member_date (name) != (time_t) -1;
103 + time_t member_date;
104 + if (ar_name (name))
105 + return ar_member_date (name, &member_date);
110 @@ -1212,15 +1215,40 @@
114 +/* Similarly for lstat. */
115 +#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
117 +# ifndef HAVE_SYS_STAT_H
118 +int lstat (const char *path, struct stat *sbuf);
121 + /* We are done with the fake lstat. Go back to the real lstat */
126 +# define local_lstat lstat
127 +#elif defined(WINDOWS32)
128 +/* Windows doesn't support lstat(). */
129 +# define local_lstat local_stat
132 +local_lstat (const char *path, struct stat *buf)
135 + EINTRLOOP (e, lstat (path, buf));
141 dir_setup_glob (glob_t *gl)
143 gl->gl_opendir = open_dirstream;
144 gl->gl_readdir = read_dirstream;
145 gl->gl_closedir = free;
146 + gl->gl_lstat = local_lstat;
147 gl->gl_stat = local_stat;
148 - /* We don't bother setting gl_lstat, since glob never calls it.
149 - The slot is only there for compatibility with 4.4 BSD. */
153 --- make-dfsg-4.1.orig/job.c
154 +++ make-dfsg-4.1/job.c
159 +#if defined (HAVE_LINUX_BINFMTS_H) && defined (HAVE_SYS_USER_H)
160 +#include <sys/user.h>
161 +#include <linux/binfmts.h>
164 +# define PAGE_SIZE (sysconf(_SC_PAGESIZE))
167 /* Default shell to use. */
174 - child_failed = exit_sig != 0 || exit_code != 0;
176 /* Search for a child matching the deceased one. */
178 for (c = children; c != 0; lastc = c, c = c->next)
180 Ignore it; it was inherited from our invoker. */
183 + /* Determine the failure status: 0 for success, 1 for updating target in
184 + question mode, 2 for anything else. */
185 + if (exit_sig == 0 && exit_code == 0)
186 + child_failed = MAKE_SUCCESS;
187 + else if (exit_sig == 0 && exit_code == 1 && question_flag && c->recursive)
188 + child_failed = MAKE_TROUBLE;
190 + child_failed = MAKE_FAILURE;
192 DB (DB_JOBS, (child_failed
193 ? _("Reaping losing child %p PID %s %s\n")
194 : _("Reaping winning child %p PID %s %s\n"),
195 @@ -872,10 +887,10 @@
196 delete non-precious targets, and abort. */
197 static int delete_on_error = -1;
200 + if (!dontcare && child_failed == MAKE_FAILURE)
201 child_error (c, exit_code, exit_sig, coredump, 0);
203 - c->file->update_status = us_failed;
204 + c->file->update_status = child_failed == MAKE_FAILURE ? us_failed : us_question;
205 if (delete_on_error == -1)
207 struct file *f = lookup_file (".DELETE_ON_ERROR");
209 if (!err && child_failed && !dontcare && !keep_going_flag &&
210 /* fatal_error_signal will die with the right signal. */
211 !handling_fatal_signal)
212 - die (MAKE_FAILURE);
213 + die (child_failed);
215 /* Only block for one child. */
217 @@ -1189,14 +1204,15 @@
221 + child->recursive = ((flags & COMMANDS_RECURSE) != 0);
223 /* Update the file's command flags with any new ones we found. We only
224 keep the COMMANDS_RECURSE setting. Even this isn't 100% correct; we are
225 now marking more commands recursive than should be in the case of
226 multiline define/endef scripts where only one line is marked "+". In
227 order to really fix this, we'll have to keep a lines_flags for every
228 actual line, after expansion. */
229 - child->file->cmds->lines_flags[child->command_line - 1]
230 - |= flags & COMMANDS_RECURSE;
231 + child->file->cmds->lines_flags[child->command_line - 1] |= flags & COMMANDS_RECURSE;
233 /* POSIX requires that a recipe prefix after a backslash-newline should
234 be ignored. Remove it now so the output is correct. */
235 @@ -3115,6 +3131,7 @@
237 char *command_ptr = NULL; /* used for batch_mode_shell mode */
241 # ifdef __EMX__ /* is this necessary? */
242 if (!unixy_shell && shellflags)
243 @@ -3280,8 +3297,17 @@
247 +#ifdef MAX_ARG_STRLEN
248 + static char eval_line[] = "eval\\ \\\"set\\ x\\;\\ shift\\;\\ ";
249 +#define ARG_NUMBER_DIGITS 5
250 +#define EVAL_LEN (sizeof(eval_line)-1 + shell_len + 4 \
251 + + (7 + ARG_NUMBER_DIGITS) * 2 * line_len / (MAX_ARG_STRLEN - 2))
256 new_line = xmalloc ((shell_len*2) + 1 + sflags_len + 1
257 - + (line_len*2) + 1);
258 + + (line_len*2) + 1 + EVAL_LEN);
260 /* Copy SHELL, escaping any characters special to the shell. If
261 we don't escape them, construct_command_argv_internal will
262 @@ -3301,6 +3327,30 @@
267 +#if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN)
268 + if (unixy_shell && line_len > MAX_ARG_STRLEN)
271 + memcpy (ap, eval_line, sizeof (eval_line) - 1);
272 + ap += sizeof (eval_line) - 1;
273 + for (j = 1; j <= 2 * line_len / (MAX_ARG_STRLEN - 2); j++)
274 + ap += sprintf (ap, "\\$\\{%u\\}", j);
278 + /* Copy only the first word of SHELL to $0. */
279 + for (p = shell; *p != '\0'; ++p)
281 + if (isspace ((unsigned char)*p))
290 for (p = line; *p != '\0'; ++p)
292 if (restp != NULL && *p == '\n')
293 @@ -3348,6 +3398,13 @@
297 +#if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN)
298 + if (unixy_shell && line_len > MAX_ARG_STRLEN && (ap - args_ptr > MAX_ARG_STRLEN - 2))
305 if (ap == new_line + shell_len + sflags_len + 2)
307 --- make-dfsg-4.1.orig/job.h
308 +++ make-dfsg-4.1/job.h
310 unsigned int noerror:1; /* Nonzero if commands contained a '-'. */
311 unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */
312 unsigned int deleted:1; /* Nonzero if targets have been deleted. */
313 + unsigned int recursive:1; /* Nonzero for recursive command ('+' etc.) */
314 unsigned int dontcare:1; /* Saved dontcare flag. */
317 --- make-dfsg-4.1.orig/main.c
318 +++ make-dfsg-4.1/main.c
319 @@ -1401,13 +1401,18 @@
321 if (isatty (fileno (stdout)))
322 if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMOUT")))
323 - define_variable_cname ("MAKE_TERMOUT", TTYNAME (fileno (stdout)),
324 - o_default, 0)->export = v_export;
327 + const char *tty = TTYNAME (fileno (stdout));
328 + define_variable_cname ("MAKE_TERMOUT", tty ? tty : DEFAULT_TTYNAME,
329 + o_default, 0)->export = v_export;
331 if (isatty (fileno (stderr)))
332 if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMERR")))
333 - define_variable_cname ("MAKE_TERMERR", TTYNAME (fileno (stderr)),
334 - o_default, 0)->export = v_export;
336 + const char *tty = TTYNAME (fileno (stderr));
337 + define_variable_cname ("MAKE_TERMERR", tty ? tty : DEFAULT_TTYNAME,
338 + o_default, 0)->export = v_export;
342 /* Reset in case the switches changed our minds. */
343 @@ -2418,6 +2423,11 @@
344 exit (WIFEXITED(r) ? WEXITSTATUS(r) : EXIT_FAILURE);
347 +#ifdef SET_STACK_SIZE
348 + /* Reset limits, if necessary. */
349 + if (stack_limit.rlim_cur)
350 + setrlimit (RLIMIT_STACK, &stack_limit);
352 exec_command ((char **)nargv, environ);
355 --- make-dfsg-4.1.orig/makeint.h
356 +++ make-dfsg-4.1/makeint.h
357 @@ -424,10 +424,11 @@
358 /* The number of bytes needed to represent the largest integer as a string. */
359 #define INTSTR_LENGTH CSTRLEN ("18446744073709551616")
361 +#define DEFAULT_TTYNAME "true"
363 # define TTYNAME(_f) ttyname (_f)
365 -# define TTYNAME(_f) "true"
366 +# define TTYNAME(_f) DEFAULT_TTYNAME
371 int ar_name (const char *);
372 void ar_parse_name (const char *, char **, char **);
373 int ar_touch (const char *);
374 -time_t ar_member_date (const char *);
375 +int ar_member_date (const char *, time_t *);
377 typedef long int (*ar_member_func_t) (int desc, const char *mem, int truncated,
378 long int hdrpos, long int datapos,
379 --- make-dfsg-4.1.orig/remake.c
380 +++ make-dfsg-4.1/remake.c
381 @@ -1259,6 +1259,7 @@
383 char *arname, *memname;
388 /* Find the archive's name. */
389 @@ -1306,10 +1307,15 @@
390 /* The archive doesn't exist, so its members don't exist either. */
391 return NONEXISTENT_MTIME;
393 - member_date = ar_member_date (file->hname);
394 - mtime = (member_date == (time_t) -1
395 - ? NONEXISTENT_MTIME
396 - : file_timestamp_cons (file->hname, member_date, 0));
397 + found = ar_member_date (file->hname, &member_date);
398 + if (found && member_date == (time_t) 0)
401 + _("Warning: Archive '%s' seems to have been created in deterministic mode. '%s' will always be updated. Please consider passing the U flag to ar to avoid the problem."),
402 + arfile->name, memname);
405 + mtime = found ? file_timestamp_cons (file->hname, member_date, 0) : NONEXISTENT_MTIME;
409 @@ -1548,9 +1554,11 @@
411 static const char *dirs[] =
413 +#ifdef MULTIARCH_DIRS
420 #if defined(WINDOWS32) && !defined(LIBDIR)
422 @@ -1559,7 +1567,19 @@
426 - LIBDIR, /* Defined by configuration. */
427 + LIBDIR, /* Defined by configuration. */
430 + * In the Debian binaries, PREFIX is /usr and thus this searches /lib,
431 + * /usr/lib and /usr/lib again and therefore misses any libraries that
432 + * are not packaged and were installed by the site admin. The ideal
433 + * behaviour would be to have the search path set by a Makefile
434 + * variable (other than the VPATH blunt object) but even absent that,
435 + * it would be more useful if it looked in /usr/local/lib even though
436 + * make itself hasn't been installed in the /usr/local tree -- manoj