commit bash-20180126 snapshot

This commit is contained in:
Chet Ramey
2018-01-29 08:55:47 -05:00
parent e7e095ceb3
commit 661f4c20c3
10 changed files with 99 additions and 20 deletions
+36
View File
@@ -14866,3 +14866,39 @@ lib/readline/rltty.c
bound to the VDISCARD character in the current keymap, set VDISCARD
to _POSIX_VDISABLE while readline is active. From a report from
Rhialto <rhialto@falu.nl>
1/22
----
builtins/history.def
- histtime: check whether or not localtime() returns NULL, and make
sure we only call strftime() with a valid struct tm. This can happen
when the timestamps in the history file overflow a time_t. Fixes bug
reported by Luke Dashjr <luke@dashjr.org>
bashline.c
- edit_and_execute_command: if we're in vi editing mode, make sure
we end up in insert mode after executing the commands from the
edited file. This seems to be what other shells do. Report from
Stan Marsh <gazelle@xmission.com>
1/26
----
bashline.c
- command_word_completion_function: match alias and shell function
names case-insensitively if the readline completion-ignore-case
variable is set. Inspired by report from <odnehel@gmail.com>
lib/readline/display.c
- update_line: when performing a dumb update after wrapping the line
(usually due to printing the prompt), make sure we adjust
_rl_last_c_pos if there are invisible characters in prompt lines
other than the first (we assume those invisible characters are in
the last line, which is nearly always the case). We adjust by the
total number of invisible chars less the number of invisible chars
in the first prompt line. From a report in
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1745273
execute_cmd.c
- execute_command_internal: if redirections attached to a compound
command fail, make sure we discard the `internal_fifos' unwind-
protect frame after freeing the copied fifo_list and before returning
+8 -1
View File
@@ -902,16 +902,23 @@ valid_array_reference (name, flags)
*t = '[';
if (r == 0)
return 0;
/* Check for a properly-terminated non-blank subscript. */
/* Check for a properly-terminated non-null subscript. */
len = skipsubscript (t, 0, flags);
if (t[len] != ']' || len == 1)
return 0;
if (t[len+1] != '\0')
return 0;
#if 1
/* Could check and allow subscripts consisting only of whitespace for
existing associative arrays. */
for (r = 1; r < len; r++)
if (whitespace (t[r]) == 0)
return 1;
return 0;
#else
/* This allows blank subscripts */
return 1;
#endif
}
return 0;
}
+12 -2
View File
@@ -992,6 +992,11 @@ edit_and_execute_command (count, c, editing_mode, edit_command)
rl_done = 0;
rl_readline_state = rrs;
#if defined (VI_MODE)
if (editing_mode == VI_EDITING_MODE)
rl_vi_insertion_mode (1, c);
#endif
rl_forced_update_display ();
return r;
@@ -1942,7 +1947,9 @@ command_word_completion_function (hint_text, state)
alias = alias_list[local_index++]->name;
if (STREQN (alias, hint, hint_len))
if (igncase == 0 && (STREQN (alias, hint, hint_len)))
return (savestring (alias));
else if (igncase && strncasecmp (alias, hint, hint_len) == 0)
return (savestring (alias));
}
#endif /* ALIAS */
@@ -1971,7 +1978,10 @@ command_word_completion_function (hint_text, state)
varname = varlist[local_index++]->name;
if (STREQN (varname, hint, hint_len))
/* Honor completion-ignore-case for shell function names. */
if (igncase == 0 && (STREQN (varname, hint, hint_len)))
return (savestring (varname));
else if (igncase && strncasecmp (varname, hint, hint_len) == 0)
return (savestring (varname));
}
local_index = 0;
+4 -2
View File
@@ -321,10 +321,12 @@ histtime (hlist, histtimefmt)
{
static char timestr[128];
time_t t;
struct tm *tm;
t = history_get_time (hlist);
if (t)
strftime (timestr, sizeof (timestr), histtimefmt, localtime (&t));
tm = t ? localtime (&t) : 0;
if (t && tm)
strftime (timestr, sizeof (timestr), histtimefmt, tm);
else if (hlist->timestamp && hlist->timestamp[0])
snprintf (timestr, sizeof (timestr), _("%s: invalid timestamp"),
(hlist->timestamp[0] == '#') ? hlist->timestamp + 1: hlist->timestamp);
+4 -3
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Jan 4 15:29:06 EST 2018
.\" Last Change: Thu Jan 25 10:51:45 EST 2018
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2018 January 4" "GNU Bash 4.4"
.TH BASH 1 "2018 January 25" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -963,7 +963,8 @@ command (see
below).
The file descriptors can be utilized as arguments to shell commands
and redirections using standard word expansions.
The file descriptors are not available in subshells.
Other than those created to execute command and process substitutions,
the file descriptors are not available in subshells.
The process ID of the shell spawned to execute the coprocess is
available as the value of the variable \fINAME\fP_PID.
The \fBwait\fP
+2 -1
View File
@@ -1208,7 +1208,8 @@ This pipe is established before any redirections specified by the
command (@pxref{Redirections}).
The file descriptors can be utilized as arguments to shell commands
and redirections using standard word expansions.
The file descriptors are not available in subshells.
Other than those created to execute command and process substitutions,
the file descriptors are not available in subshells.
The process ID of the shell spawned to execute the coprocess is
available as the value of the variable @env{NAME}_PID.
+2 -2
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Jan 4 15:30:21 EST 2018
@set LASTCHANGE Thu Jan 25 10:51:29 EST 2018
@set EDITION 4.4
@set VERSION 4.4
@set UPDATED 4 January 2018
@set UPDATED 25 January 2018
@set UPDATED-MONTH January 2018
+4 -1
View File
@@ -764,7 +764,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
dispose_exec_redirects ();
#if defined (PROCESS_SUBSTITUTION)
if (saved_fifo)
free ((void *)ofifo_list);
{
free ((void *)ofifo_list);
discard_unwind_frame ("internal_fifos");
}
#endif
return (last_command_exit_value = EXECUTION_FAILURE);
}
+2
View File
@@ -380,6 +380,8 @@ assignment (string, flags)
if (c == '[')
{
newi = skipsubscript (string, indx, (flags & 2) ? 1 : 0);
/* XXX - why not check for blank subscripts here, if we do in
valid_array_reference? */
if (string[newi++] != ']')
return (0);
if (string[newi] == '+' && string[newi+1] == '=')
+25 -8
View File
@@ -1168,11 +1168,12 @@ rl_redisplay (void)
wrap_offset. */
if (linenum == 0 && (mb_cur_max > 1 && rl_byte_oriented == 0) && OLD_CPOS_IN_PROMPT())
_rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
else if (linenum == prompt_last_screen_line &&
prompt_physical_chars > _rl_screenwidth &&
(mb_cur_max > 1 && rl_byte_oriented == 0) &&
cpos_adjusted == 0 &&
_rl_last_c_pos != o_cpos &&
_rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
_rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line)) /* XXX - rethink this last one */
/* This assumes that all the invisible characters are split
between the first and last lines of the prompt, if the
prompt consumes more than two lines. It's usually right */
@@ -1896,7 +1897,23 @@ dumb_update:
{
_rl_output_some_chars (nfd, temp);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
{
_rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
/* Need to adjust here based on wrap_offset. Guess that if
this is the line containing the last line of the prompt
we need to adjust by
wrap_offset-prompt_invis_chars_first_line
on the assumption that this is the number of invisible
characters in the last line of the prompt. */
if (wrap_offset > prompt_invis_chars_first_line &&
current_line == prompt_last_screen_line &&
prompt_physical_chars > _rl_screenwidth &&
_rl_horizontal_scroll_mode == 0)
{
_rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
cpos_adjusted = 1;
}
}
else
_rl_last_c_pos += temp;
}
@@ -1987,7 +2004,7 @@ dumb_update:
cpos_adjusted to let the caller know. */
if (current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
_rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
cpos_adjusted = 1;
}
return;
@@ -2040,7 +2057,7 @@ dumb_update:
and set cpos_adjusted to let the caller know. */
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
_rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
cpos_adjusted = 1;
}
return;
@@ -2053,7 +2070,7 @@ dumb_update:
and set cpos_adjusted to let the caller know. */
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
_rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
cpos_adjusted = 1;
}
}
@@ -2123,7 +2140,7 @@ dumb_update:
_rl_last_c_pos >= wrap_offset && /* XXX was > */
((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
_rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
cpos_adjusted = 1;
}
@@ -2171,7 +2188,7 @@ dumb_update:
_rl_last_c_pos > wrap_offset &&
((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
_rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
cpos_adjusted = 1;
}
}