commit bash-20160108 snapshot

This commit is contained in:
Chet Ramey
2016-01-12 15:53:15 -05:00
parent 6f82653c5e
commit 725b284a48
17 changed files with 4898 additions and 3920 deletions
+57
View File
@@ -10282,3 +10282,60 @@ subst.c
be split on spaces (W_SPLITSPACE). Fix for issues reported back in
October 2014 as the result of an austin-group discussion, and just
re-reported by Martijn Dekker <martijn@inlv.org>
1/4/2016
--------
execute_cmd.c
- execute_simple_command: if autocd is set, invoke a function named
`cd' if one exists, instead of the shell builtin. Feature requested
by transl8czech@gmail.com
builtins/mkbuiltins.c
- if a command's short description is the same as its name (e.g., `true'),
don't mark the short doc to be translated. Report and fix from
Benno Schulenberg <bensberg@justemail.net>
1/6
---
subst.c
- command_substitute,process_substitute: before replacing the file
descriptor underlying stdout (fd 1), make sure to purge any pending
stdio output that hasn't been written successfully, even after a
call to fflush(). Fixes bug reported by cks@cs.toronto.edu
1/7
---
builtins/{echo,printf}.def
- echo_builtin,printf_builtin: don't use terminate_immediately; use
calls to QUIT in the body of the print loop after writes and flushes.
Fixes problem with running the signal handler and exit trap in a
signal context and other bug reported by cks@cs.toronto.edu
builtins/common.c
- sh_chkwrite: put in calls to QUIT to catch signals that interrupt
writes
shell.c
- get_current_user_info: protect endpwent() with #ifdef HAVE_GETPWENT.
Fixes bug reported by pb <p-bauer-schriesheim@t-online.de>
1/8
---
lib/readline/bind.c
- _rl_init_file_error: now a varargs function so it can take format
strings and arguments and pass them to vfprintf
- rl_parse_and_bind: print a warning if we encounter a key binding
string with one or more hyphens but we don't find a valid modifier
(`control', `meta', etc.). Prompted by a report from Andrew Kurn
<kurn@sfu.ca>
- rl_parse_and_bind: improve several existing error messages now that
_rl_init_file_error takes a variable number of arguments
- rl_variable_bind: print error message upon encountering unknown
variable
1/10
----
lib/readline/bind.c
- rl_parse_and_bind: if a `bare' keybinding is supplied without any
terminating `:' or whitespace separating it from the command to be
bound, signal an error
+2
View File
@@ -343,7 +343,9 @@ int
sh_chkwrite (s)
int s;
{
QUIT;
fflush (stdout);
QUIT;
if (ferror (stdout))
{
sh_wrerror ();
+2 -2
View File
@@ -161,7 +161,6 @@ just_echo:
clearerr (stdout); /* clear error before writing and testing success */
terminate_immediately++;
while (list)
{
i = len = 0;
@@ -180,6 +179,7 @@ just_echo:
fflush (stdout); /* Fix for bug in SunOS 5.5 printf(3) */
#endif
}
QUIT;
if (do_v9 && temp)
free (temp);
list = list->next;
@@ -190,11 +190,11 @@ just_echo:
}
if (list)
putchar(' ');
QUIT;
}
if (display_return)
putchar ('\n');
terminate_immediately--;
return (sh_chkwrite (EXECUTION_SUCCESS));
}
+1 -1
View File
@@ -31,7 +31,7 @@ entry with a `*'. An argument of N lists only the last N entries.
Options:
-c clear the history list by deleting all of the entries
-d offset delete the history entry at offset OFFSET.
-d offset delete the history entry at position OFFSET.
-a append history lines from this session to the history file
-n read all history lines not already read from the history file
+21 -9
View File
@@ -1258,16 +1258,28 @@ write_builtins (defs, structfile, externfile)
(builtin->flags & BUILTIN_FLAG_POSIX_BUILTIN) ? " | POSIX_BUILTIN" : "",
document_name (builtin));
if (inhibit_functions)
fprintf
(structfile, " N_(\"%s\"), \"%s\" },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name,
document_name (builtin));
/* Don't translate short document summaries that are identical
to command names */
if (builtin->shortdoc && strcmp (builtin->name, builtin->shortdoc) == 0)
{
if (inhibit_functions)
fprintf (structfile, " \"%s\", \"%s\" },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name,
document_name (builtin));
else
fprintf (structfile, " \"%s\", (char *)NULL },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name);
}
else
fprintf
(structfile, " N_(\"%s\"), (char *)NULL },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name);
{
if (inhibit_functions)
fprintf (structfile, " N_(\"%s\"), \"%s\" },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name,
document_name (builtin));
else
fprintf (structfile, " N_(\"%s\"), (char *)NULL },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name);
}
}
if (structfile || separate_helpfiles)
+5 -3
View File
@@ -116,6 +116,7 @@ extern int errno;
vbadd (b, 1); \
else \
putchar (c); \
QUIT; \
} while (0)
#define PF(f, func) \
@@ -131,6 +132,7 @@ extern int errno;
else \
nw = vflag ? vbprintf (f, func) : printf (f, func); \
tw += nw; \
QUIT; \
if (ferror (stdout)) \
{ \
sh_wrerror (); \
@@ -143,6 +145,7 @@ extern int errno;
#define PRETURN(value) \
do \
{ \
QUIT; \
if (vflag) \
{ \
bind_printf_variable (vname, vbuf, 0); \
@@ -162,9 +165,9 @@ extern int errno;
} \
else if (vbuf) \
vbuf[0] = 0; \
terminate_immediately--; \
if (ferror (stdout) == 0) \
fflush (stdout); \
QUIT; \
if (ferror (stdout)) \
{ \
sh_wrerror (); \
@@ -307,8 +310,6 @@ printf_builtin (list)
if (format == 0 || *format == 0)
return (EXECUTION_SUCCESS);
terminate_immediately++;
/* Basic algorithm is to scan the format string for conversion
specifications -- once one is found, find out if the field
width or precision is a '*'; if it is, gather up value. Note,
@@ -418,6 +419,7 @@ printf_builtin (list)
modstart[0] = convch;
modstart[1] = '\0';
QUIT;
switch(convch)
{
case 'c':
+843 -842
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -7125,7 +7125,8 @@ names are
\fIemacs, emacs\-standard, emacs\-meta, emacs\-ctlx, vi,
vi\-move, vi\-command\fP, and
.IR vi\-insert .
\fIvi\fP is equivalent to \fIvi\-command\fP; \fIemacs\fP is
\fIvi\fP is equivalent to \fIvi\-command\fP (\fIvi\-move\fP is also
a synonym); \fIemacs\fP is
equivalent to \fIemacs\-standard\fP.
.TP
.B \-l
@@ -8378,7 +8379,7 @@ associated with each history entry is written to the history file,
marked with the history comment character.
When the history file is read, lines beginning with the history
comment character followed immediately by a digit are interpreted
as timestamps for the previous history line.
as timestamps for the following history entry.
The return value is 0 unless an invalid option is encountered, an
error occurs while reading or writing the history file, an invalid
\fIoffset\fP is supplied as an argument to \fB\-d\fP, or the
+2 -2
View File
@@ -3866,8 +3866,8 @@ names are
@code{vi-move},
@code{vi-command}, and
@code{vi-insert}.
@code{vi} is equivalent to @code{vi-command};
@code{emacs} is equivalent to @code{emacs-standard}.
@code{vi} is equivalent to @code{vi-command} (@code{vi-move} is also a
synonym); @code{emacs} is equivalent to @code{emacs-standard}.
@item -l
List the names of all Readline functions.
+1
View File
@@ -4294,6 +4294,7 @@ run_builtin:
words = make_word_list (make_word ("--"), words);
words = make_word_list (make_word ("cd"), words);
xtrace_print_word_list (words, 0);
func = find_function ("cd");
goto run_builtin;
}
+67 -15
View File
@@ -74,8 +74,13 @@ Keymap rl_binding_keymap;
static int _rl_skip_to_delim PARAMS((char *, int, int));
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
static void _rl_init_file_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
static void _rl_init_file_error ();
#endif
static char *_rl_read_file PARAMS((char *, size_t *));
static void _rl_init_file_error PARAMS((const char *));
static int _rl_read_init_file PARAMS((const char *, int));
static int glean_key_from_name PARAMS((char *));
@@ -989,14 +994,35 @@ _rl_read_init_file (filename, include_level)
}
static void
_rl_init_file_error (msg)
const char *msg;
#if defined (PREFER_STDARG)
_rl_init_file_error (const char *format, ...)
#else
_rl_init_file_error (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
fprintf (stderr, "readline: ");
if (currently_reading_init_file)
_rl_errmsg ("%s: line %d: %s\n", current_readline_init_file,
current_readline_init_lineno, msg);
else
_rl_errmsg ("%s", msg);
fprintf (stderr, "%s: line %d: ", current_readline_init_file,
current_readline_init_lineno);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
}
/* **************************************************************** */
@@ -1216,7 +1242,7 @@ handle_parser_directive (statement)
}
/* display an error message about the unknown parser directive */
_rl_init_file_error ("unknown parser directive");
_rl_init_file_error ("%s: unknown parser directive", directive);
return (1);
}
@@ -1262,7 +1288,7 @@ rl_parse_and_bind (string)
{
char *funname, *kname;
register int c, i;
int key, equivalency;
int key, equivalency, foundmod, foundsep;
while (string && whitespace (*string))
string++;
@@ -1292,7 +1318,7 @@ rl_parse_and_bind (string)
/* If we didn't find a closing quote, abort the line. */
if (string[i] == '\0')
{
_rl_init_file_error ("no closing `\"' in key binding");
_rl_init_file_error ("%s: no closing `\"' in key binding", string);
return 1;
}
else
@@ -1304,6 +1330,8 @@ rl_parse_and_bind (string)
equivalency = (c == ':' && string[i + 1] == '=');
foundsep = c != 0;
/* Mark the end of the command (or keyname). */
if (string[i])
string[i++] = '\0';
@@ -1393,6 +1421,12 @@ remove_trailing:
return 0;
}
if (foundsep == 0)
{
_rl_init_file_error ("%s: no key sequence terminator", string);
return 1;
}
/* If this is a new-style key-binding, then do the binding with
rl_bind_keyseq (). Otherwise, let the older code deal with it. */
if (*string == '"')
@@ -1449,11 +1483,24 @@ remove_trailing:
key = glean_key_from_name (kname);
/* Add in control and meta bits. */
foundmod = 0;
if (substring_member_of_array (string, _rl_possible_control_prefixes))
key = CTRL (_rl_to_upper (key));
{
key = CTRL (_rl_to_upper (key));
foundmod = 1;
}
if (substring_member_of_array (string, _rl_possible_meta_prefixes))
key = META (key);
{
key = META (key);
foundmod = 1;
}
if (foundmod == 0 && kname != string)
{
_rl_init_file_error ("%s: unknown key modifier", string);
return 1;
}
/* Temporary. Handle old-style keyname with macro-binding. */
if (*funname == '\'' || *funname == '"')
@@ -1480,6 +1527,7 @@ remove_trailing:
#endif /* PREFIX_META_HACK */
else
rl_bind_key (key, rl_named_function (funname));
return 0;
}
@@ -1681,10 +1729,14 @@ rl_variable_bind (name, value)
i = find_string_var (name);
/* For the time being, unknown variable names or string names without a
handler function are simply ignored. */
/* For the time being, string names without a handler function are simply
ignored. */
if (i < 0 || string_varlist[i].set_func == 0)
return 0;
{
if (i < 0)
_rl_init_file_error ("%s: unknown variable name", name);
return 0;
}
v = (*string_varlist[i].set_func) (value);
return v;
+1 -1
View File
@@ -102,7 +102,7 @@ associated with each history entry is written to the history file,
marked with the history comment character.
When the history file is read, lines beginning with the history
comment character followed immediately by a digit are interpreted
as timestamps for the previous history line.
as timestamps for the following history entry.
The builtin command @code{fc} may be used to list or edit and re-execute
a portion of the history list.
+3 -2
View File
@@ -608,8 +608,9 @@ Acceptable @code{keymap} names are
@code{vi-move},
@code{vi-command}, and
@code{vi-insert}.
@code{vi} is equivalent to @code{vi-command}; @code{emacs} is
equivalent to @code{emacs-standard}. The default value is @code{emacs}.
@code{vi} is equivalent to @code{vi-command} (@code{vi-move} is also a
synonym); @code{emacs} is equivalent to @code{emacs-standard}.
The default value is @code{emacs}.
The value of the @code{editing-mode} variable also affects the
default keymap.
+909 -1079
View File
File diff suppressed because it is too large Load Diff
+2970 -1962
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -1754,7 +1754,9 @@ get_current_user_info ()
current_user.shell = savestring ("/bin/sh");
current_user.home_dir = savestring ("/");
}
#if defined (HAVE_GETPWENT)
endpwent ();
#endif
}
}
+9
View File
@@ -5766,6 +5766,11 @@ process_substitute (string, open_for_read_in_child)
fd = child_pipe_fd;
#endif /* HAVE_DEV_FD */
/* Discard buffered stdio output before replacing the underlying file
descriptor. */
if (open_for_read_in_child == 0)
fpurge (stdout);
if (dup2 (fd, open_for_read_in_child ? 0 : 1) < 0)
{
sys_error (_("cannot duplicate named pipe %s as fd %d"), pathname,
@@ -6034,6 +6039,10 @@ command_substitute (string, quoted)
free_pushed_string_input ();
/* Discard buffered stdio output before replacing the underlying file
descriptor. */
fpurge (stdout);
if (dup2 (fildes[1], 1) < 0)
{
sys_error (_("command_substitute: cannot duplicate pipe as fd 1"));