From 51f1f17b4aca9949dc8f364e85d569ecdbfc8dba Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 6 Jul 2020 10:40:37 -0400 Subject: [PATCH] commit bash-20200630 snapshot --- CWRU/CWRU.chlog | 33 +++++++++++++++++++++++++++++++++ doc/bash.1 | 4 +++- doc/bashref.texi | 15 +++++++++------ doc/version.texi | 6 +++--- eval.c | 7 +++++-- input.c | 2 +- jobs.c | 13 +++++++++---- lib/readline/vi_mode.c | 13 ++++++++----- subst.c | 2 +- 9 files changed, 72 insertions(+), 23 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index e524c62f..8c1f6a67 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -8629,3 +8629,36 @@ unwind_prot.c - unwind_protect_mem_internal: make sure we allocate at least as many bytes for an entire UNWIND_ELT. Fix from Jessica Clarke + + 7/1 + --- +eval.c + - alrm_catcher: use write(2) instead of fprintf to print the + auto-logout message to the terminal + +jobs.c + - UNQUEUE_SIGCHLD: set queue_sigchld to 1 around call to waitchld(), + since it is not being called from a signal handler and so SIGCHLD is + not blocked. Fixes report by Godmar Back + + 7/2 + --- +doc/{bash.1,bashref.texi} + - read: clarify that without any name arguments, the line assigned to + REPLY is not modified. From a question by M. Nejat AYDIN + with input from Eli Schwartz + + + 7/5 + --- +lib/readline/vi_mode.c + - _rl_vi_done_inserting: make sure to close out all undo groups when + the insert performed by a `c' command finishes. Report and fix from + David Fries + + 7/6 + --- +lib/readline/vi_mode.c + - _rl_vi_domove_motion_cleanup: the `c' and `C' commands should enter + insert mode even if the motion command doesn't delete any text. From + a report by David Fries diff --git a/doc/bash.1 b/doc/bash.1 index 6ad316ca..f998918a 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -9339,7 +9339,9 @@ Read input from file descriptor \fIfd\fP. .PP If no .I names -are supplied, the line read is assigned to the variable +are supplied, the line read, +without the ending delimiter but otherwise unmodified, +is assigned to the variable .SM .BR REPLY . The exit status is zero, unless end-of-file is encountered, \fBread\fP diff --git a/doc/bashref.texi b/doc/bashref.texi index 462116c2..8c18536b 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -4584,12 +4584,6 @@ are used to split the line into words using the same rules the shell uses for expansion (described above in @ref{Word Splitting}). The backslash character @samp{\} may be used to remove any special meaning for the next character read and for line continuation. -If no names are supplied, the line read is assigned to the -variable @env{REPLY}. -The exit status is zero, unless end-of-file is encountered, @code{read} -times out (in which case the status is greater than 128), -a variable assignment error (such as assigning to a readonly variable) occurs, -or an invalid file descriptor is supplied as the argument to @option{-u}. Options, if supplied, have the following meanings: @@ -4666,6 +4660,15 @@ The exit status is greater than 128 if the timeout is exceeded. Read input from file descriptor @var{fd}. @end table +If no @var{name}s are supplied, the line read, +without the ending delimiter but otherwise unmodified, +is assigned to the +variable @env{REPLY}. +The exit status is zero, unless end-of-file is encountered, @code{read} +times out (in which case the status is greater than 128), +a variable assignment error (such as assigning to a readonly variable) occurs, +or an invalid file descriptor is supplied as the argument to @option{-u}. + @item readarray @btindex readarray @example diff --git a/doc/version.texi b/doc/version.texi index 7b7e3090..330f7867 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2020 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Tue Jun 16 16:24:45 EDT 2020 +@set LASTCHANGE Thu Jul 2 09:04:32 EDT 2020 @set EDITION 5.1 @set VERSION 5.1 -@set UPDATED 16 June 2020 -@set UPDATED-MONTH June 2020 +@set UPDATED 2 July 2020 +@set UPDATED-MONTH July 2020 diff --git a/eval.c b/eval.c index 91bffaa2..6f28f89f 100644 --- a/eval.c +++ b/eval.c @@ -237,8 +237,11 @@ static sighandler alrm_catcher(i) int i; { - printf (_("\007timed out waiting for input: auto-logout\n")); - fflush (stdout); + char *msg; + + msg = _("\007timed out waiting for input: auto-logout\n"); + write (1, msg, strlen (msg)); + bash_logout (); /* run ~/.bash_logout if this is a login shell */ jump_to_top_level (EXITPROG); SIGRETURN (0); diff --git a/input.c b/input.c index b39c9abb..c57e81c3 100644 --- a/input.c +++ b/input.c @@ -132,7 +132,7 @@ ungetc_with_restart (c, stream) /* A facility similar to stdio, but input-only. */ #if defined (USING_BASH_MALLOC) -# define MAX_INPUT_BUFFER_SIZE 8176 +# define MAX_INPUT_BUFFER_SIZE 8172 #else # define MAX_INPUT_BUFFER_SIZE 8192 #endif diff --git a/jobs.c b/jobs.c index 1a3f3a47..b6c83802 100644 --- a/jobs.c +++ b/jobs.c @@ -319,11 +319,17 @@ static int queue_sigchld; #define QUEUE_SIGCHLD(os) (os) = sigchld, queue_sigchld++ +/* We set queue_sigchld around the call to waitchld to protect data structures + from a SIGCHLD arriving while waitchld is executing. */ #define UNQUEUE_SIGCHLD(os) \ do { \ queue_sigchld--; \ if (queue_sigchld == 0 && os != sigchld) \ - waitchld (-1, 0); \ + { \ + queue_sigchld = 1; \ + waitchld (-1, 0); \ + queue_sigchld = 0; \ + } \ } while (0) static SigHandler *old_tstp, *old_ttou, *old_ttin; @@ -2022,9 +2028,8 @@ print_pipeline (p, job_index, format, stream) reported asynchronously, so just add the CR if the shell is currently interactive and asynchronous notification is enabled. */ if (asynchronous_notification && interactive) - fprintf (stream, "\r\n"); - else - fprintf (stream, "\n"); + putc ('\r', stream); + fprintf (stream, "\n"); } if (p == last) diff --git a/lib/readline/vi_mode.c b/lib/readline/vi_mode.c index a5ec2f8b..cecb981c 100644 --- a/lib/readline/vi_mode.c +++ b/lib/readline/vi_mode.c @@ -875,7 +875,7 @@ _rl_vi_done_inserting (void) { if (_rl_vi_doing_insert) { - /* The `C', `s', and `S' commands set this. */ + /* The `c', `s', and `S' commands set this. */ rl_end_undo_group (); /* Now, the text between rl_undo_list->next->start and rl_undo_list->next->end is what was inserted while in insert @@ -887,7 +887,6 @@ _rl_vi_done_inserting (void) _rl_vi_save_replace (); /* Half the battle */ else _rl_vi_save_insert (rl_undo_list->next); - vi_continued_command = 1; } else { @@ -899,10 +898,10 @@ _rl_vi_done_inserting (void) /* XXX - Other keys probably need to be checked. */ else if (_rl_vi_last_key_before_insert == 'C') rl_end_undo_group (); - while (_rl_undo_group_level > 0) - rl_end_undo_group (); - vi_continued_command = 0; } + + while (_rl_undo_group_level > 0) + rl_end_undo_group (); } int @@ -1210,6 +1209,10 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m) /* No change in position means the command failed. */ if (rl_mark == rl_point) { + /* 'c' and 'C' enter insert mode after the delete even if the motion + didn't delete anything, as long as the motion command is valid. */ + if (_rl_to_upper (m->key) == 'C' && _rl_vi_motion_command (c)) + return (vidomove_dispatch (m)); RL_UNSETSTATE (RL_STATE_VIMOTION); return (-1); } diff --git a/subst.c b/subst.c index 5b1ba17d..bb51a7ba 100644 --- a/subst.c +++ b/subst.c @@ -8764,7 +8764,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta else #if defined (CASEMOD_EXPANSIONS) /* To enable case-toggling expansions using the `~' operator character - change the 1 to 0. */ + define CASEMOD_CAPCASE in config-top.h */ # if defined (CASEMOD_CAPCASE) name = string_extract (string, &t_index, "#%^,~:-=?+/@}", SX_VARNAME); # else