]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
fix problem with saving tty state after running a command with 'bind -x'; builtins...
authorChet Ramey <chet.ramey@case.edu>
Fri, 11 Mar 2022 21:09:24 +0000 (16:09 -0500)
committerChet Ramey <chet.ramey@case.edu>
Fri, 11 Mar 2022 21:09:24 +0000 (16:09 -0500)
CWRU/CWRU.chlog
arrayfunc.c
doc/bash.1
doc/bashref.texi
examples/loadables/csv.c
examples/loadables/stat.c
jobs.c
lib/readline/doc/readline.3
lib/readline/doc/rluser.texi
lib/readline/doc/version.texi

index ef39921ff6d9a3b2d624c6484745bb436da67365..f86f0cbe6f29a907429679c53a3727d2b4e1fb1a 100644 (file)
@@ -3341,3 +3341,21 @@ parse.y
          `make visible' flag or through sh_strvis if we're not running the
          prompt string through word expansions. Fixes issue reported by
          Josh Harcome <joshharc@gmail.com> back in mid-January
+
+                                  3/10
+                                  ----
+arrayfunc.c
+       - convert_var_to_array: if we're being asked to create an associative
+         array (flags & 2), and we have an existing variable that is not an
+         assoc array (and not an existing indexed array), call
+         convert_var_to_assoc to make it one
+
+                                  3/11
+                                  ----
+jobs.c
+       - wait_for: don't call get_tty_state() if readline is dispatching
+         (RL_STATE_DISPATCHING) with the terminal settings changed
+         (RL_STATE_TERMPREPPED), the same way we don't if we are running a
+         command for programmable completion. Fixes bug with SIGINT reverting
+         to the saved readline terminal settings reported by
+         Markus Napierkowski <markus.napierkowski@cyberus-technology.de>
index 303a4a597e6144043401e7781c245d7dad744f7a..2ab172c702784c05d2dda0f2542e35e931a23782 100644 (file)
@@ -504,6 +504,8 @@ find_or_make_array_variable (name, flags)
       report_error (_("%s: cannot convert indexed to associative array"), name);
       return ((SHELL_VAR *)NULL);
     }
+  else if (flags & 2)
+    var = assoc_p (var) ? var : convert_var_to_assoc (var);
   else if (array_p (var) == 0 && assoc_p (var) == 0)
     var = convert_var_to_array (var);
 
index d5d0e2730fafb7a31fab945a71fcb2d4697b957d..d37bed8b8e6c5c92b23b8d846b53cb7df02d603b 100644 (file)
@@ -5,12 +5,12 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Thu Feb 24 14:43:14 EST 2022
+.\"    Last Change: Fri Mar 11 10:16:50 EST 2022
 .\"
 .\" bash_builtins, strip all but Built-Ins section
 .if \n(zZ=1 .ig zZ
 .if \n(zY=1 .ig zY
-.TH BASH 1 "2022 February 24" "GNU Bash 5.2"
+.TH BASH 1 "2022 March 11" "GNU Bash 5.2"
 .\"
 .\" There's some problem with having a `@'
 .\" in a tagged paragraph with the BSD man macros.
@@ -2774,6 +2774,12 @@ interpreted as relative to one greater than the maximum index of
 \fIname\fP, so negative indices count back from the end of the
 array, and an index of \-1 references the last element.
 .PP
+The += operator will append to a array variable when assigning
+using the compound assignment syntax; see
+.SM
+.B PARAMETERS
+above.
+.PP
 Any element of an array may be referenced using
 ${\fIname\fP[\fIsubscript\fP]}.  The braces are required to avoid
 conflicts with pathname expansion.  If
@@ -6081,13 +6087,11 @@ The active region shows the text inserted by bracketed-paste and any
 matching text found by incremental and non-incremental history searches.
 .TP
 .B enable\-bracketed\-paste (On)
-When set to \fBOn\fP, readline will configure the terminal in a way
-that will enable it to insert each paste into the editing buffer as a
-single string of characters, instead of treating each character as if
-it had been read from the keyboard
-and executing any editing commands
-bound to key sequences appearing in the pasted text.
-This will prevent pasted characters from being interpreted as editing commands.
+When set to \fBOn\fP, readline configures the terminal to insert each
+paste into the editing buffer as a single string of characters, instead
+of treating each character as if it had been read from the keyboard.
+This prevents readline from executing any editing commands bound to key
+sequences appearing in the pasted text.
 .TP
 .B enable\-keypad (Off)
 When set to \fBOn\fP, readline will try to enable the application
index 94f97ab1a6a39cc8a7cb88d09e92bcd3c1212eb2..f0f95c0197f673439880f08d4dbf3bc0c81c7f23 100644 (file)
@@ -7701,6 +7701,9 @@ interpreted as relative to one greater than the maximum index of
 @var{name}, so negative indices count back from the end of the
 array, and an index of -1 references the last element.
 
+The @samp{+=} operator will append to a array variable when assigning
+using the compound assignment syntax; see @ref{Shell Parameters} above.
+
 Any element of an array may be referenced using
 @code{$@{@var{name}[@var{subscript}]@}}.
 The braces are required to avoid
index 11228f1ab30daa8ea7d83d6aa85991079aa99249..75b37725733ee63ba61f019a104bf17aed9e9b98 100644 (file)
@@ -39,9 +39,9 @@
    element of array variable CSV, starting at index 0. The format of LINE is
    as described in RFC 4180. */
 static int
-csvsplit (csv, line)
+csvsplit (csv, line, dstring)
      SHELL_VAR *csv;
-     char *line;
+     char *line, *dstring;
 {
   arrayind_t ind;
   char *field, *prev, *buf, *xbuf;
@@ -67,7 +67,7 @@ csvsplit (csv, line)
                buf[b++] = *field++;    /* skip double quote */
              else if (qstate == DQUOTE && *field == '"')
                qstate = NQUOTE;
-             else if (qstate == NQUOTE && *field == ',')
+             else if (qstate == NQUOTE && *field == *dstring)
                break;
              else
                /* This copies any text between a closing double quote and the
@@ -80,7 +80,7 @@ csvsplit (csv, line)
       else
        {
          buf = prev;
-         field = prev + strcspn (prev, ",");
+         field = prev + strcspn (prev, dstring);
        }
 
       delim = *field;
@@ -91,10 +91,10 @@ csvsplit (csv, line)
 
       *field = delim;
 
-      if (delim == ',')
+      if (delim == *dstring)
        prev = field + 1;
     }
-  while (delim == ',');
+  while (delim == *dstring);
 
   if (xbuf)
     free (xbuf);
@@ -165,7 +165,7 @@ csv_builtin (list)
   if (csvstring == 0 || *csvstring == 0)
     return (EXECUTION_SUCCESS);
 
-  opt = csvsplit (v, csvstring);
+  opt = csvsplit (v, csvstring, ",");
   /* Maybe do something with OPT here, it's the number of fields */
 
   return (rval);
index 3725a9cb619d3e4ca531734ce3721a7e5048b7f9..1e60e7b6d005e5c65317cc2294432855fd5b09c6 100644 (file)
@@ -3,7 +3,7 @@
 /* See Makefile for compilation details. */
 
 /*
-   Copyright (C) 2016 Free Software Foundation, Inc.
+   Copyright (C) 2016,2022 Free Software Foundation, Inc.
 
    This file is part of GNU Bash.
    Bash is free software: you can redistribute it and/or modify
@@ -390,6 +390,12 @@ stat_builtin (list)
        }
     }
 
+  if (legal_identifier (aname) == 0)
+    {
+      sh_invalidid (aname);
+      return (EXECUTION_FAILURE);
+    }
+
   list = loptend;
   if (list == 0)
     {
@@ -397,6 +403,10 @@ stat_builtin (list)
       return (EX_USAGE);
     }
 
+
+#if 0
+  unbind_variable (aname);
+#endif
   fname = list->word->word;
 
   if (getstat (fname, flags, &st) < 0)
@@ -405,8 +415,7 @@ stat_builtin (list)
       return (EXECUTION_FAILURE);
     }
 
-  unbind_variable (aname);
-  v = make_new_assoc_variable (aname);
+  v = find_or_make_array_variable (aname, 3);
   if (v == 0)
     {
       builtin_error ("%s: cannot create variable", aname);
@@ -430,9 +439,10 @@ char *stat_doc[] = {
        "",
        "Take a filename and load the status information returned by a",
        "stat(2) call on that file into the associative array specified",
-       "by the -A option.  The default array name is STAT.  If the -L",
-       "option is supplied, stat does not resolve symbolic links and",
-       "reports information about the link itself.  The -l option results",
+       "by the -A option.  The default array name is STAT.",
+       "",
+       "If the -L option is supplied, stat does not resolve symbolic links",
+       "and reports information about the link itself.  The -l option results",
        "in longer-form listings for some of the fields. When -l is used,",
        "the -F option supplies a format string passed to strftime(3) to",
        "display the file time information.",
diff --git a/jobs.c b/jobs.c
index 25289f4a8111e3aed1c5341043804fdc82060fd7..77d9dc351fbdb7a44b777f50955798025233f5a7 100644 (file)
--- a/jobs.c
+++ b/jobs.c
@@ -3117,8 +3117,8 @@ if (job == NO_JOB)
          else
 #if defined (READLINE)
            /* We don't want to do this if we are running a process during
-              programmable completion. */
-           if (RL_ISSTATE (RL_STATE_COMPLETING) == 0)
+              programmable completion or a command bound to `bind -x'. */
+           if (RL_ISSTATE (RL_STATE_COMPLETING|RL_STATE_DISPATCHING|RL_STATE_TERMPREPPED) == 0)
 #endif
            get_tty_state ();
 
index b61d5421eda738d5166c13824520ae97a0084a7c..912718d452fe9e00d9e99149ecd706c4f6a3858e 100644 (file)
@@ -6,9 +6,9 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Thu Feb 10 10:58:32 EST 2022
+.\"    Last Change: Fri Mar 11 10:14:10 EST 2022
 .\"
-.TH READLINE 3 "2022 February 10" "GNU Readline 8.2"
+.TH READLINE 3 "2022 March 11" "GNU Readline 8.2"
 .\"
 .\" File Name macro.  This used to be `.PN', for Path Name,
 .\" but Sun doesn't seem to like that very much.
@@ -489,13 +489,11 @@ The active region shows the text inserted by bracketed-paste and any
 matching text found by incremental and non-incremental history searches.
 .TP
 .B enable\-bracketed\-paste (On)
-When set to \fBOn\fP, readline will configure the terminal in a way
-that will enable it to insert each paste into the editing buffer as a
-single string of characters, instead of treating each character as if
-it had been read from the keyboard
-and executing any editing commands
-bound to key sequences appearing in the pasted text.
-This will prevent pasted characters from being interpreted as editing commands.
+When set to \fBOn\fP, readline configures the terminal to insert each
+paste into the editing buffer as a single string of characters, instead
+of treating each character as if it had been read from the keyboard.
+This prevents readline from executing any editing commands bound to key
+sequences appearing in the pasted text.
 .TP
 .B enable\-keypad (Off)
 When set to \fBOn\fP, readline will try to enable the application
index deaff14d4ecb4421f3e75caddc3734b177e3f349..0921d24d150ef7bde955be864555e0e519993298 100644 (file)
@@ -588,13 +588,12 @@ The default is @samp{On}.
 
 @item enable-bracketed-paste
 @vindex enable-bracketed-paste
-When set to @samp{On}, Readline will configure the terminal in a way
-that will enable it to insert each paste into the editing buffer as a
-single string of characters, instead of treating each character as if
-it had been read from the keyboard
-and executing any editing commands
-bound to key sequences appearing in the pasted text.
-This will prevent pasted characters from being interpreted as editing commands.
+When set to @samp{On}, Readline configures the terminal to insert each
+paste into the editing buffer as a single string of characters, instead
+of treating each character as if it had been read from the keyboard.
+This is called putting the terminal into @dfn{bracketed paste mode};
+it prevents Readline from executing any editing commands bound to key
+sequences appearing in the pasted text.
 The default is @samp{On}.
 
 @item enable-keypad
index 42ead150df73fd185562ec4cdbe9b7e58b5fb5e7..cd3f8d85d4d036536538cddf78a2334f29c2124a 100644 (file)
@@ -5,7 +5,7 @@ Copyright (C) 1988-2022 Free Software Foundation, Inc.
 @set EDITION 8.2
 @set VERSION 8.2
 
-@set UPDATED 18 February 2022
-@set UPDATED-MONTH February 2022
+@set UPDATED 11 March 2022
+@set UPDATED-MONTH March 2022
 
-@set LASTCHANGE Fri Feb 18 11:12:48 EST 2022
+@set LASTCHANGE Fri Mar 11 10:13:51 EST 2022