commit bash-20120622 snapshot

This commit is contained in:
Chet Ramey
2012-07-07 12:25:38 -04:00
parent 66773245d7
commit c74f63f39f
10 changed files with 1387 additions and 20 deletions
+48
View File
@@ -14007,3 +14007,51 @@ lib/readline/complete.c
multibyte characters, even when doing case-sensitive or case-mapping
comparisons. Fixes problem reported by Nikolay Shirokovskiy
<nshyrokovskiy@gmail.com>
6/20
----
builtins/mapfile.def
- mapfile: move the line count increment and check for having read
the specified number of lines to the end of the loop to avoid
reading an additional line with zgetline. Fixes bug reported by
Dan Douglas <ormaaj@gmail.com>
6/21
----
execute_cmd.c
- execute_pipeline: make sure `lastpipe_flag' is initialized to 0 on
all systems, since it's tested later in the function. Fixes bug
reported by John E. Malmberg <wb8tyw@qsl.net>
6/22
----
mailcheck.c
- file_mod_date_changed: return 0 right away if mailstat() does not
return success. Fixes bug with using uninitialized values reported
by szymon.kalasz@uj.edu.pl
builtins/set.def
- the `monitor' option is not available when the shell is compiled
without job control, since the underlying `m' flag is not available
nojobs.c
- job_control: now declared as int variable, initialized to 0, never
modified
jobs.h
- job_control: extern declaration no longer dependent on JOB_CONTROL
execute_cmd.c
- execute_pipeline: made necessary changes so `lastpipe' shell option
is now available in all shells, even those compiled without
JOB_CONTROL defined
6/23
----
lib/glob/glob.c
- glob_filename: check for interrupts before returning if glob_vector
returns NULL or an error. Bug reported by Serge van den Boom
<svdb@stack.nl>, fix from Andreas Schwab <schwab@linux-m68k.org>
- call run_pending_traps after each call to QUIT or test of
interrupt_state, like we do in mainline shell code
+60 -1
View File
@@ -13992,5 +13992,64 @@ execute_cmd.c
and restore it with unwind-protect
builtins/evalstring.c
- parse_and_execute: save and restore line_number_for_err_trap along
- parse_prologue: save and restore line_number_for_err_trap along
with line_number
- restore_lastcom: new function, unwind-protect to restore
the_printed_command_except_trap
- parse_prologue: use restore_lastcom to save and restore the value
of the_printed_command_except_trap around calls to parse_and_execute
(eval/source/.)
6/15
----
lib/readline/complete.c
- complete_fncmp: change filename comparison code to understand
multibyte characters, even when doing case-sensitive or case-mapping
comparisons. Fixes problem reported by Nikolay Shirokovskiy
<nshyrokovskiy@gmail.com>
6/20
----
builtins/mapfile.def
- mapfile: move the line count increment and check for having read
the specified number of lines to the end of the loop to avoid
reading an additional line with zgetline. Fixes bug reported by
Dan Douglas <ormaaj@gmail.com>
6/21
----
execute_cmd.c
- execute_pipeline: make sure `lastpipe_flag' is initialized to 0 on
all systems, since it's tested later in the function. Fixes bug
reported by John E. Malmberg <wb8tyw@qsl.net>
6/22
----
mailcheck.c
- file_mod_date_changed: return 0 right away if mailstat() does not
return success. Fixes bug with using uninitialized values reported
by szymon.kalasz@uj.edu.pl
builtins/set.def
- the `monitor' option is not available when the shell is compiled
without job control, since the underlying `m' flag is not available
nojobs.c
- job_control: now declared as int variable, initialized to 0, never
modified
jobs.h
- job_control: extern declaration no longer dependent on JOB_CONTROL
execute_cmd.c
- execute_pipeline: made necessary changes so `lastpipe' shell option
is now available in all shells, even those compiled without
JOB_CONTROL defined
6/23
----
lib/glob/glob.c
- glob_filename: check for interrupts before returning if glob_vector
returns NULL or an error. Bug reported by Serge van den Boom
<svdb@stack.nl>, fix from Andreas Schwab <schwab@linux-m68k.org>
+8 -7
View File
@@ -2,7 +2,7 @@ This file is mapfile.def, from which is created mapfile.c.
It implements the builtin "mapfile" in Bash.
Copyright (C) 2005-2006 Rocky Bernstein for Free Software Foundation, Inc.
Copyright (C) 2008-2010 Free Software Foundation, Inc.
Copyright (C) 2008-2012 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -195,13 +195,9 @@ mapfile (fd, line_count_goal, origin, nskip, callback_quantum, callback, array_n
/* Reset the buffer for bash own stream */
interrupt_immediately++;
for (array_index = origin, line_count = 1;
zgetline (fd, &line, &line_length, unbuffered_read) != -1;
array_index++, line_count++)
zgetline (fd, &line, &line_length, unbuffered_read) != -1;
array_index++)
{
/* Have we exceeded # of lines to store? */
if (line_count_goal != 0 && line_count > line_count_goal)
break;
/* Remove trailing newlines? */
if (flags & MAPF_CHOP)
do_chop (line);
@@ -217,6 +213,11 @@ mapfile (fd, line_count_goal, origin, nskip, callback_quantum, callback, array_n
}
bind_array_element (entry, array_index, line, 0);
/* Have we exceeded # of lines to store? */
line_count++;
if (line_count_goal != 0 && line_count > line_count_goal)
break;
}
xfree (line);
+6
View File
@@ -96,12 +96,16 @@ Options:
interactive-comments
allow comments to appear in interactive commands
keyword same as -k
#if defined (JOB_CONTROL)
monitor same as -m
#endif
noclobber same as -C
noexec same as -n
noglob same as -f
nolog currently accepted but ignored
#if defined (JOB_CONTROL)
notify same as -b
#endif
nounset same as -u
onecmd same as -t
physical same as -P
@@ -205,7 +209,9 @@ const struct {
{ "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
{ "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "keyword", 'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#if defined (JOB_CONTROL)
{ "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
#endif
{ "noclobber", 'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "noexec", 'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
{ "noglob", 'f', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+3 -6
View File
@@ -118,6 +118,8 @@ extern time_t shell_start_time;
extern char *glob_argv_flags;
#endif
extern int job_control; /* XXX */
extern int close __P((int));
/* Static functions defined and used in this file. */
@@ -2317,8 +2319,8 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
if (ignore_return && cmd)
cmd->flags |= CMD_IGNORE_RETURN;
#if defined (JOB_CONTROL)
lastpipe_flag = 0;
begin_unwind_frame ("lastpipe-exec");
lstdin = -1;
/* If the `lastpipe' option is set with shopt, and job control is not
@@ -2342,14 +2344,11 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
}
if (prev >= 0)
add_unwind_protect (close, prev);
#endif
exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close);
#if defined (JOB_CONTROL)
if (lstdin > 0)
restore_stdin (lstdin);
#endif
if (prev >= 0)
close (prev);
@@ -2372,9 +2371,7 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
unfreeze_jobs_list ();
}
#if defined (JOB_CONTROL)
discard_unwind_frame ("lastpipe-exec");
#endif
return (exec_result);
}
+1 -3
View File
@@ -243,8 +243,6 @@ extern void close_pgrp_pipe __P((void));
extern void save_pgrp_pipe __P((int *, int));
extern void restore_pgrp_pipe __P((int *));
#if defined (JOB_CONTROL)
extern int job_control;
#endif
extern int job_control; /* set to 0 in nojobs.c */
#endif /* _JOBS_H_ */
+6 -1
View File
@@ -683,7 +683,8 @@ glob_vector (pat, dir, flags)
lose = 1;
break;
}
run_pending_traps ();
dp = readdir (d);
if (dp == NULL)
break;
@@ -857,6 +858,7 @@ glob_vector (pat, dir, flags)
}
QUIT;
run_pending_traps ();
return ((char **)NULL);
}
@@ -1186,6 +1188,8 @@ glob_filename (pathname, flags)
{
if (free_dirname)
free (directory_name);
QUIT; /* XXX - shell */
run_pending_traps ();
return (temp_results);
}
@@ -1210,6 +1214,7 @@ glob_filename (pathname, flags)
free (directory_name);
QUIT;
run_pending_traps ();
return (NULL);
}
+1244
View File
File diff suppressed because it is too large Load Diff
+8 -2
View File
@@ -267,7 +267,10 @@ file_mod_date_changed (i)
file = mailfiles[i]->name;
mtime = mailfiles[i]->mod_time;
if ((mailstat (file, &finfo) == 0) && (finfo.st_size > 0))
if (mailstat (file, &finfo) != 0)
return (0);
if (finfo.st_size > 0)
return (mtime < finfo.st_mtime);
if (finfo.st_size == 0 && mailfiles[i]->file_size > 0)
@@ -288,7 +291,10 @@ file_access_date_changed (i)
file = mailfiles[i]->name;
atime = mailfiles[i]->access_time;
if ((mailstat (file, &finfo) == 0) && (finfo.st_size > 0))
if (mailstat (file, &finfo) != 0)
return (0);
if (finfo.st_size > 0)
return (atime < finfo.st_atime);
return (0);
+3
View File
@@ -96,6 +96,9 @@ int shell_tty = -1;
exits from get_tty_state(). */
int check_window_size = CHECKWINSIZE_DEFAULT;
/* We don't have job control. */
int job_control = 0;
/* STATUS and FLAGS are only valid if pid != NO_PID
STATUS is only valid if (flags & PROC_RUNNING) == 0 */
struct proc_status {