]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20181005 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 8 Oct 2018 13:19:14 +0000 (09:19 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 8 Oct 2018 13:19:14 +0000 (09:19 -0400)
24 files changed:
CWRU/CWRU.chlog
arrayfunc.c
builtins/setattr.def
builtins/shopt.def
doc/bash.1
doc/bashref.texi
doc/version.texi
execute_cmd.c
jobs.c
lib/readline/doc/rluser.texi
lib/readline/isearch.c
lib/readline/kill.c
lib/readline/rlprivate.h
lib/readline/vi_mode.c
parse.y
pcomplete.c
sig.c
subst.c
tests/RUN-ONE-TEST
tests/new-exp.right
tests/new-exp10.sub
tests/shopt.right
trap.c
variables.c

index 7624fc0719109a137bfa957a05b5b99b949ffe96..db59b332d6b37b034a9ed63e078288543f12bb5a 100644 (file)
@@ -4492,3 +4492,61 @@ lib/readline/input.c
        - win32_isatty: win32-specific changes from GDB. Patch submitted by
          Tom Tromey <tom@tromey.com>, originally from Eli Zaretskii
          <eliz@gnu.org>
+
+                                  10/1
+                                  ----
+lib/readline/vi_mode.c
+       - rl_vi_start_inserting: start an undo group so we can grab the text
+         inserted here as a single unit, avoiding any insert coalescing
+         performed by rl_insert_text. Report and fix from Richard Todd
+         <richard.w.todd@outlook.com>
+
+                                  10/3
+                                  ----
+subst.c
+       - parameter_brace_transform: if we're asked to display the attributes
+         of an unset variable, check that the variable exists even if
+         get_var_and_type returns NULL (it checks invisible_p). Requested by
+         Michal Pesa <pesathem@gmail.com>
+
+lib/readline/kill.c
+       - _rl_bracketed_text: new function, collects the text pasted in
+         bracketed paste mode and consumes the bracketed paste end marker;
+         returns the pasted text and its length
+       - rl_bracketed_paste_begin: call _rl_bracketed_text to collect the
+         text
+
+lib/readline/isearch.c
+       - _rl_isearch_dispatch: set cxt->lastc to -7 if the input resolves to
+         rl_bracketed_paste_begin
+       - _rl_isearch_dispatch: if cxt->lastc == -7, call _rl_bracketed_text
+         to collect the pasted text and add it to the accumulating search
+         string. Only works if ESC is not one of the isearch terminators.
+         Fixes issue reported in Debian bug report 891780,
+         https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891780
+
+                                  10/5
+                                  ----
+variables.c
+       - push_posix_tempvar_internal: new function, body of push_func_var
+         with additional argument saying whether it's being called from a
+         function or (special) builtin code path
+       - push_builtin_var: new function, calls push_posix_tempvar_internal
+         with second argument indicating builtin code path
+       - push_func_var: now a stub that calls push_posix_tempvar_internal
+         with second argument indicating function code path
+       - pop_scope: if called from a special builtin, call push_builtin_var
+         instead of push_func_var to do the right variable propagation
+
+builtins/shopt.def
+       - progcomp_alias: uncomment, make available to users
+
+doc/{bash.1,bashref.texi},lib/readline/doc/rluser.texi
+       - progcomp_alias: document shopt option, describe its use in
+         the section on programmable completion
+
+trap.c
+       - decode_signal: handle SIGRTMIN+n at runtime, with the `SIG' prefix
+         or without, case-insensitively if requested, and return SIGRTMIN+n.
+         These values could be different than what was available at compile
+         time. Report and patch from Rasmus Villemoes <rv@rasumsvillemoes.dk>
index 8f4719d07dde5a84ad8a812926a182f39d3e3815..c635e74c3ba2444be10b08763fa6c812a2fd7fa3 100644 (file)
@@ -902,11 +902,13 @@ valid_array_reference (name, flags)
   SHELL_VAR *entry;
 
   t = mbschr (name, '[');      /* ] */
+  isassoc = 0;
   if (t)
     {
       *t = '\0';
       r = legal_identifier (name);
-      isassoc = (entry = find_variable (name)) && assoc_p (entry);      
+      if (flags & VA_NOEXPAND) /* Don't waste a lookup if we don't need one */
+       isassoc = (entry = find_variable (name)) && assoc_p (entry);      
       *t = '[';
       if (r == 0)
        return 0;
@@ -949,7 +951,7 @@ array_expand_index (var, s, len, flags)
   exp = (char *)xmalloc (len);
   strncpy (exp, s, len - 1);
   exp[len - 1] = '\0';
-#if 0  /* XXX - not yet -- maybe bash-5.0 */
+#if 0  /* XXX - not yet -- maybe bash-5.1 */
   if ((flags & AV_NOEXPAND) == 0)
     t = expand_arith_string (exp, Q_DOUBLE_QUOTES|Q_ARITH|Q_ARRAYSUB); /* XXX - Q_ARRAYSUB for future use */
   else
@@ -1126,7 +1128,6 @@ array_value_internal (s, quoted, flags, rtype, indp)
          free (temp);
        }
       else     /* ${name[@]} or unquoted ${name[*]} */
-        /* XXX - bash-4.4/bash-5.0 test AV_ASSIGNRHS and pass PF_ASSIGNRHS */
        retval = string_list_dollar_at (l, quoted, (flags & AV_ASSIGNRHS) ? PF_ASSIGNRHS : 0);
 
       dispose_words (l);
index c756964a0549669ec17721d8e1cd24e444596bc1..1e35afcacc57e5972ac8ba7c2d3fc6bda95de6dc 100644 (file)
@@ -504,7 +504,7 @@ show_name_attributes (name, nodefs)
   var = find_variable_noref (name);
 #endif
 
-  if (var /* && invisible_p (var) == 0 */)     /* XXX bash-4.4/bash-5.0 */
+  if (var /* && invisible_p (var) == 0 */)
     {
       show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
       return (0);
index b1dc5e0ebbf777a523ec52b9639ce968238d00f9..f6dc6f97cf3c2c4921b8a837076bcdc0b63a210b 100644 (file)
@@ -231,7 +231,7 @@ static struct {
   { "nullglob",        &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
 #if defined (PROGRAMMABLE_COMPLETION)
   { "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
-#  if 0        /* bash-5.0-beta */
+#  if defined (ALIAS)
   { "progcomp_alias", &progcomp_alias, (shopt_set_func_t *)NULL },
 #  endif
 #endif
index 5be92a52ad9b440885df8e9a010350d4f8e5db6f..a22768ac5a038f61a82c7cbbc1d000b6e6b2ad38 100644 (file)
@@ -5,12 +5,12 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Sat Sep 29 13:38:24 EDT 2018
+.\"    Last Change: Fri Oct  5 14:53:12 EDT 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 September 29" "GNU Bash 5.0"
+.TH BASH 1 "2018 October 5" "GNU Bash 5.0"
 .\"
 .\" There's some problem with having a `@'
 .\" in a tagged paragraph with the BSD man macros.
@@ -6710,6 +6710,9 @@ If no compspec is found for the full pathname, an attempt is made to
 find a compspec for the portion following the final slash.
 If those searches do not result in a compspec, any compspec defined with
 the \fB\-D\fP option to \fBcomplete\fP is used as the default.
+If there is no default compspec, \fBbash\fP attempts alias expansion
+on the command word as a final resort, and attempts to find a compspec
+for the command word from any successful expansion.
 .PP
 Once a compspec has been found, it is used to generate the list of
 matching words.
@@ -10165,6 +10168,12 @@ If set, the programmable completion facilities (see
 \fBProgrammable Completion\fP above) are enabled.
 This option is enabled by default.
 .TP 8
+.B progcomp_alias
+If set, and programmable completion is enabled, \fBbash\fP treats a command
+name that doesn't have any completions as a possible alias and attempts
+alias expansion. If it has an alias, \fBbash\fP attempts programmable
+completion using the command word resulting from the expanded alias.
+.TP 8
 .B promptvars
 If set, prompt strings undergo
 parameter expansion, command substitution, arithmetic
index 451208c768aa664d82149fe09e36cb0248897eec..7d1b53bbcfcdfcde91fc7fd1704fa9e92ee68e3a 100644 (file)
@@ -5451,6 +5451,12 @@ If set, the programmable completion facilities
 (@pxref{Programmable Completion}) are enabled.
 This option is enabled by default.
 
+@item progcomp_alias
+If set, and programmable completion is enabled, Bash treats a command
+name that doesn't have any completions as a possible alias and attempts
+alias expansion. If it has an alias, Bash attempts programmable
+completion using the command word resulting from the expanded alias.
+
 @item promptvars
 If set, prompt strings undergo
 parameter expansion, command substitution, arithmetic
index 68440ea83d2019420a45d8ce71d2980bca27279a..f7eab2bbc2f38872988ec969197a4dc65dd3c65e 100644 (file)
@@ -2,10 +2,10 @@
 Copyright (C) 1988-2018 Free Software Foundation, Inc.
 @end ignore
 
-@set LASTCHANGE Sat Sep 29 13:41:44 EDT 2018
+@set LASTCHANGE Fri Oct  5 14:52:51 EDT 2018
 
 @set EDITION 5.0
 @set VERSION 5.0
 
-@set UPDATED 29 September 2018
-@set UPDATED-MONTH September 2018
+@set UPDATED 5 October 2018
+@set UPDATED-MONTH October 2018
index 3735b5529deb8f74119daf7f7f1823245da4f3aa..a418bbb58b02713701881e7617ae31ba9a29792a 100644 (file)
@@ -282,7 +282,7 @@ int line_number_for_err_trap;
 int funcnest = 0;
 int funcnest_max = 0;
 
-int evalnest = 0;              /* bash-4.4/bash-5.0 */
+int evalnest = 0;
 int evalnest_max = EVALNEST_MAX;
 
 int sourcenest = 0;
@@ -1605,7 +1605,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
     async_redirect_stdin ();
 
 #if 0
-  /* bash-5.0 */
+  /* XXX - TAG: bash-5.1 */
   if (user_subshell && command->type == cm_subshell)
     optimize_subshell_command (command->value.Subshell->command);
 #endif
@@ -2353,10 +2353,9 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
 
   invert = (command->flags & CMD_INVERT_RETURN) != 0;
 
-  /* XXX - expand coproc name without splitting -- bash-5.0 */
-  /* could make this dependent on a shopt option */
+  /* expand name without splitting - could make this dependent on a shopt option */
   name = expand_string_unsplit_to_string (command->value.Coproc->name, 0);
-  /* Optional check -- bash-5.0. */
+  /* Optional check -- could be relaxed */
   if (legal_identifier (name) == 0)
     {
       internal_error (_("`%s': not a valid identifier"), name);
@@ -2399,7 +2398,6 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
   close (rpipe[1]);
   close (wpipe[0]);
 
-  /* XXX - run Coproc->name through word expansion above -- bash-5.0 */
   cp = coproc_alloc (command->value.Coproc->name, coproc_pid);
   cp->c_rfd = rpipe[0];
   cp->c_wfd = wpipe[1];
diff --git a/jobs.c b/jobs.c
index 1f6c80916b0163b7bf170ae61c8276ba1c417f52..abf398e0da360ee4aea6bf99b3ead1a30e85d6cb 100644 (file)
--- a/jobs.c
+++ b/jobs.c
@@ -3003,7 +3003,6 @@ if (job == NO_JOB)
        {
          s = job_signal_status (job);
 
-         /* XXX - bash-5.0 */
          /* If we are non-interactive, but job control is enabled, and the job
             died due to SIGINT, pretend we got the SIGINT */
          if (job_control && IS_JOBCONTROL (job) && WIFSIGNALED (s) && WTERMSIG (s) == SIGINT)
@@ -3728,7 +3727,6 @@ itrace("waitchld: waitpid returns %d block = %d children_exited = %d", pid, bloc
     }
 
   /* Call a SIGCHLD trap handler for each child that exits, if one is set. */
-  /* XXX - bash-5.0 removes test for job_control */
   if (children_exited &&
       (signal_is_trapped (SIGCHLD) || trap_list[SIGCHLD] == (char *)IMPOSSIBLE_TRAP_HANDLER) &&
       trap_list[SIGCHLD] != (char *)IGNORE_SIG)
index 48b32e91d77198456e64e53745607a48a9f20871..a59bd144633f9707506b822828d070575607c719 100644 (file)
@@ -1851,6 +1851,9 @@ If no compspec is found for the full pathname, an attempt is made to
 find a compspec for the portion following the final slash.
 If those searches do not result in a compspec, any compspec defined with
 the @option{-D} option to @code{complete} is used as the default.
+If there is no default compspec, Bash attempts alias expansion
+on the command word as a final resort, and attempts to find a compspec
+for the command word from any successful expansion 
 
 Once a compspec has been found, it is used to generate the list of
 matching words.
index 3c5f74b23d562689dcfe012fefdbd10a1717387f..d6c59041772cdb539db2076c7615328d47bbcc9b 100644 (file)
@@ -328,6 +328,9 @@ int
 _rl_isearch_dispatch (_rl_search_cxt *cxt, int c)
 {
   int n, wstart, wlen, limit, cval, incr;
+  char *paste;
+  size_t pastelen;
+  int j;
   rl_command_func_t *f;
 
   f = (rl_command_func_t *)NULL;
@@ -398,6 +401,8 @@ add_character:
        cxt->lastc = -5;
       else if (c == CTRL ('Y') || f == rl_yank)        /* XXX */
        cxt->lastc = -6;
+      else if (f == rl_bracketed_paste_begin)
+       cxt->lastc = -7;
     }
 
   /* If we changed the keymap earlier while translating a key sequence into
@@ -620,6 +625,23 @@ add_character:
       cxt->search_string[cxt->search_string_index] = '\0';
       break;
 
+    case -7:   /* bracketed paste */
+      paste = _rl_bracketed_text (&pastelen);
+      if (paste == 0 || *paste == 0)
+       {
+         free (paste);
+         break;
+       }
+      if (cxt->search_string_index + pastelen + 1 >= cxt->search_string_size)
+       {
+         cxt->search_string_size += pastelen + 2;
+         cxt->search_string = (char *)xrealloc (cxt->search_string, cxt->search_string_size);
+       }
+      strcpy (cxt->search_string + cxt->search_string_index, paste);
+      cxt->search_string_index += pastelen;
+      free (paste);
+      break;
+
     /* Add character to search string and continue search. */
     default:
 #if defined (HANDLE_MULTIBYTE)
index 9fdfc77280cc43c23fdb42fbb493eea446bf9fea..cf8ca93243b8b282f70c2f0b3ea7657e34c1b49c 100644 (file)
@@ -670,16 +670,16 @@ rl_yank_last_arg (int count, int key)
    `bracketed paste' sequence, read the rest of the pasted input until the
    closing sequence and insert the pasted text as a single unit without
    interpretation. */
-int
-rl_bracketed_paste_begin (int count, int key)
+char *
+_rl_bracketed_text (size_t *lenp)
 {
-  int retval, c;
+  int c;
   size_t len, cap;
   char *buf;
 
-  retval = 0;
   len = 0;
   buf = xmalloc (cap = 64);
+  buf[0] = '\0';
 
   RL_SETSTATE (RL_STATE_MOREINPUT);
   while ((c = rl_read_key ()) >= 0)
@@ -708,9 +708,23 @@ rl_bracketed_paste_begin (int count, int key)
       if (len == cap)
        buf = xrealloc (buf, cap + 1);
       buf[len] = '\0';
-      retval = rl_insert_text (buf) == len ? 0 : 1;
     }
 
+  if (lenp)
+    *lenp = len;
+  return (buf);
+}
+
+int
+rl_bracketed_paste_begin (int count, int key)
+{
+  int retval, c;
+  size_t len, cap;
+  char *buf;
+
+  buf = _rl_bracketed_text (&len);
+  retval = rl_insert_text (buf) == len ? 0 : 1;
+
   xfree (buf);
   return (retval);
 }
index 69943de5270eac2316a4730b6a413002294866d8..e85e4d8124da028bd27cb8794e6c41e3089b16b1 100644 (file)
@@ -309,6 +309,8 @@ extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
 #define BRACK_PASTE_INIT       "\033[?2004h"
 #define BRACK_PASTE_FINI       "\033[?2004l\r"
 
+extern char *_rl_bracketed_text PARAMS((size_t *));
+
 /* macro.c */
 extern void _rl_with_macro_input PARAMS((char *));
 extern int _rl_peek_macro_key PARAMS((void));
index d6fa38e9779e16b42ba7209e8424b6ce54dd10f8..836371c95fff755e5bb9fc2faf8998310ef286ae 100644 (file)
@@ -198,6 +198,7 @@ void
 rl_vi_start_inserting (int key, int repeat, int sign)
 {
   _rl_vi_set_last (key, repeat, sign);
+  rl_begin_undo_group ();              /* ensure inserts aren't concatenated */
   rl_vi_insertion_mode (1, key);
 }
 
diff --git a/parse.y b/parse.y
index 2013d2492e2718675345fef040b51435eaeb5e03..4747408e681cc33d6e4a13ad00b7edb15e6548e9 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -3033,7 +3033,7 @@ special_case_tokens (tokstr)
       return (IN);
     }
 
-  /* bash-5.0: leaving above code intact for now, but it should eventually be
+  /* XXX - leaving above code intact for now, but it should eventually be
      removed in favor of this clause. */
   /* Posix grammar rule 6 */
   if (expecting_in_token && (last_read_token == WORD || last_read_token == '\n') &&
index 8f0b4808340f5ba7c253ba3f29cffa54da81dc4e..5014c21a2469a2f294497a8a99626102b1c2401e 100644 (file)
@@ -151,7 +151,7 @@ static int progcomp_debug = 0;
 
 int prog_completion_enabled = 1;
 
-#ifdef ALIAS   /* bash-5.0-beta */
+#ifdef ALIAS
 int progcomp_alias = 0;        /* unavailable to user code for now */
 #endif
 
diff --git a/sig.c b/sig.c
index 6f3249819df022fa4e25878faf0e2faa1f2f3745..f8a0e0f7083ac0064b8d5b27668d48cbe3c2ae32 100644 (file)
--- a/sig.c
+++ b/sig.c
@@ -761,7 +761,6 @@ set_signal_handler (sig, handler)
   if (sig == SIGCHLD)
     act.sa_flags |= SA_RESTART;                /* XXX */
 #endif
-  /* XXX - bash-5.0 */
   /* Let's see if we can keep SIGWINCH from interrupting interruptible system
      calls, like open(2)/read(2)/write(2) */
 #if defined (SIGWINCH)
diff --git a/subst.c b/subst.c
index 6dc6c8754c5c9d7bd574dacd58a5309da5597ff5..34be5ff9d22d83111664bcb7ea814e3ab39793ca 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -1603,7 +1603,6 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
        }
 
 #if defined (ARRAY_VARS)
-      /* XXX - bash-5.0 */
       if (c == LBRACK && dolbrace_state == DOLBRACE_PARAM)
        {
          si = skipsubscript (string, i, 0);
@@ -2625,7 +2624,8 @@ string_list_dollar_at (list, quoted, flags)
 #  if !defined (__GNUC__)
   sep = (char *)xmalloc (MB_CUR_MAX + 1);
 #  endif /* !__GNUC__ */
-  /* XXX - bash-4.4/bash-5.0 testing PF_ASSIGNRHS */
+  /* XXX - testing PF_ASSIGNRHS to make sure positional parameters are
+     separated with a space even when word splitting will not occur. */
   if (flags & PF_ASSIGNRHS)
     {
       sep[0] = ' ';
@@ -2650,7 +2650,8 @@ string_list_dollar_at (list, quoted, flags)
       sep[1] = '\0';
     }
 #else  /* !HANDLE_MULTIBYTE */
-  /* XXX - bash-4.4/bash-5.0 test PF_ASSIGNRHS */
+  /* XXX - PF_ASSIGNRHS means no word splitting, so we want positional
+     parameters separated by a space. */
   sep[0] = ((flags & PF_ASSIGNRHS) || ifs == 0 || *ifs == 0) ? ' ' : *ifs;
   sep[1] = '\0';
 #endif /* !HANDLE_MULTIBYTE */
@@ -6581,7 +6582,6 @@ expand_arrayref:
            {
              /* Only treat as double quoted if array variable */
              if (var && (array_p (var) || assoc_p (var)))
-               /* XXX - bash-4.4/bash-5.0 pass AV_ASSIGNRHS */
                temp = array_value (name, quoted|Q_DOUBLE_QUOTES, AV_ASSIGNRHS, &atype, &ind);
              else              
                temp = array_value (name, quoted, 0, &atype, &ind);
@@ -7228,7 +7228,7 @@ verify_substring_values (v, value, substr, vtype, e1p, e2p)
 #if 1
       if ((vtype == VT_ARRAYVAR || vtype == VT_POSPARMS) && *e2p < 0)
 #else
-      /* XXX - bash-5.0 */
+      /* XXX - TAG: bash-5.1 */
       if (vtype == VT_ARRAYVAR && *e2p < 0)
 #endif
        {
@@ -7631,6 +7631,11 @@ parameter_brace_transform (varname, value, ind, xform, rtype, quoted, pflags, fl
       return &expand_param_error;
     }
 
+  /* If we are asked to display the attributes of an unset variable, V will
+     be NULL after the call to get_var_and_type. Double-check here. */
+  if (xc == 'a' && vtype == VT_VARIABLE && varname && v == 0)
+    v = find_variable (varname);
+
   temp1 = (char *)NULL;                /* shut up gcc */
   switch (vtype & ~VT_STARSUB)
     {
@@ -9753,8 +9758,7 @@ add_string:
        case '<':
        case '>':
          {
-           /* bash-4.4/bash-5.0
-              XXX - technically this should only be expanded at the start
+              /* XXX - technically this should only be expanded at the start
               of a word */
            if (string[++sindex] != LPAREN || (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (word->flags & (W_DQUOTE|W_NOPROCSUB)) || posixly_correct)
              {
@@ -9813,7 +9817,6 @@ add_string:
            word->flags |= W_ITILDE;
 #endif
 
-         /* XXX - bash-4.4/bash-5.0 */
          if (word->flags & W_ASSIGNARG)
            word->flags |= W_ASSIGNRHS;         /* affects $@ */
 
@@ -10070,9 +10073,8 @@ add_twochars:
              tword = alloc_word_desc ();
              tword->word = temp;
 
-             /* XXX - bash-4.4/bash-5.0 */
              if (word->flags & W_ASSIGNARG)
-               tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS);        /* affects $@ */
+               tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS); /* affects $@ */
              if (word->flags & W_COMPLETE)
                tword->flags |= W_COMPLETE;     /* for command substitutions */
              if (word->flags & W_NOCOMSUB)
index 554f3d6ecc09d7149b13daa2d36a6bab1480269f..58c375b70d886bcff86f789ae4a15eee397f87c8 100755 (executable)
@@ -1,4 +1,4 @@
-BUILD_DIR=/usr/local/build/bash/bash-current
+BUILD_DIR=/usr/local/build/chet/bash/bash-current
 THIS_SH=$BUILD_DIR/bash
 PATH=$PATH:$BUILD_DIR
 
index 12fc18ddc6882aa357234e7d95d5020ed968eb3b..b2337bd89102651e0b79ea5c98b6ac8b713902ed 100644 (file)
@@ -643,6 +643,10 @@ ir
 a b c d e
 5
 a5b
+i
+declare -i foo
+A
+declare -A foo
 abcxxxdef
 abcÃ¥def
 ḅć
index e07e5581a28d0908bf795c54f2d70ec395523b33..9e89a701092e7e2ebf2675355860b59b2b34f51e 100644 (file)
@@ -84,3 +84,17 @@ set -- a b c d e
 echo ${@}
 echo ${#@}
 echo a${#@}b
+
+# new feature in bash-5.0: display attributes of even unset variables
+unset -v foo
+
+declare -i foo
+echo ${foo@a}
+
+declare -p foo
+
+unset foo
+declare -A foo
+echo ${foo@a}
+
+declare -p foo
index 64c718c8ddde154110c641d2b745ce3eae313292..08db75f1724128959230e1dc3645ad2147d3f11a 100644 (file)
@@ -40,6 +40,7 @@ shopt -s interactive_comments
 shopt -u lastpipe
 shopt -u lithist
 shopt -u localvar_inherit
+shopt -u localvar_unset
 shopt -u login_shell
 shopt -u mailwarn
 shopt -u no_empty_cmd_completion
@@ -47,6 +48,7 @@ shopt -u nocaseglob
 shopt -u nocasematch
 shopt -u nullglob
 shopt -s progcomp
+shopt -u progcomp_alias
 shopt -s promptvars
 shopt -u restricted_shell
 shopt -u shift_verbose
@@ -100,12 +102,14 @@ shopt -u inherit_errexit
 shopt -u lastpipe
 shopt -u lithist
 shopt -u localvar_inherit
+shopt -u localvar_unset
 shopt -u login_shell
 shopt -u mailwarn
 shopt -u no_empty_cmd_completion
 shopt -u nocaseglob
 shopt -u nocasematch
 shopt -u nullglob
+shopt -u progcomp_alias
 shopt -u restricted_shell
 shopt -u shift_verbose
 shopt -u xpg_echo
@@ -140,12 +144,14 @@ inherit_errexit   off
 lastpipe               off
 lithist                off
 localvar_inherit       off
+localvar_unset         off
 login_shell            off
 mailwarn               off
 no_empty_cmd_completion        off
 nocaseglob             off
 nocasematch            off
 nullglob               off
+progcomp_alias         off
 restricted_shell       off
 shift_verbose          off
 xpg_echo               off
diff --git a/trap.c b/trap.c
index 01404d1d7a7aef18e85da0608d9635daff44e989..6c74478765f910d5ed48edcb589a0e0929997342 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -234,6 +234,23 @@ decode_signal (string, flags)
   if (legal_number (string, &sig))
     return ((sig >= 0 && sig < NSIG) ? (int)sig : NO_SIG);
 
+#if defined (SIGRTMIN) && defined (SIGRTMAX)
+  if (STREQN (string, "SIGRTMIN+", 9) || ((flags & DSIG_NOCASE) && strncasecmp (string, "SIGRTMIN+", 9) == 0))
+    {
+      if (legal_number (string+9, &sig) && sig >= 0 && sig <= SIGRTMAX - SIGRTMIN)
+       return (SIGRTMIN + sig);
+      else
+       return NO_SIG;
+    }
+  else if (STREQN (string, "RTMIN+", 6) || ((flags & DSIG_NOCASE) && strncasecmp (string, "RTMIN+", 6) == 0))
+    {
+      if (legal_number (string+6, &sig) && sig >= 0 && sig <= SIGRTMAX - SIGRTMIN)
+       return (SIGRTMIN + sig);
+      else
+       return NO_SIG;
+    }
+#endif /* SIGRTMIN && SIGRTMAX */
+
   /* A leading `SIG' may be omitted. */
   for (sig = 0; sig < BASH_NSIG; sig++)
     {
index c7429fcaccd72a29c3bd3c4f609ce3bf94becd5e..638d6ecd4111d643ae99fb5e8f609e6d7593e5b8 100644 (file)
@@ -303,8 +303,11 @@ static int n_shell_variables __P((void));
 static int set_context __P((SHELL_VAR *));
 
 static void push_func_var __P((PTR_T));
+static void push_builtin_var __P((PTR_T));
 static void push_exported_var __P((PTR_T));
 
+static inline void push_posix_tempvar_internal __P((SHELL_VAR *, int));
+
 static inline int find_special_var __P((const char *));
 
 static void
@@ -2059,7 +2062,7 @@ find_variable_nameref (v)
        {
          internal_warning (_("%s: circular name reference"), orig->name);
 #if 1
-         /* XXX - provisional change - bash-5.0 - circular refs go to
+         /* XXX - provisional change - circular refs go to
             global scope for resolution, without namerefs. */
          if (variable_context && v->context)
            return (find_global_variable_noref (v->name));
@@ -4543,9 +4546,6 @@ dispose_temporary_env (pushf)
 
   array_needs_making = 1;
 
-#if 0
-  sv_ifs ("IFS");              /* XXX here for now -- check setifs in assign_in_env */  
-#endif
   for (i = 0; i < tvlist_ind; i++)
     stupidly_hack_special_variables (tempvar_list[i]);
 
@@ -5078,7 +5078,11 @@ push_var_context (name, flags, tempvars)
      functions no longer behave like assignment statements preceding
      special builtins, and do not persist in the current shell environment.
      This is austin group interp #654, though nobody implements it yet. */
+#if 0  /* XXX - TAG: bash-5.1 */
+  posix_func_behavior = 0;
+#else
   posix_func_behavior = posixly_correct;
+#endif
 
   vc = new_var_context (name, flags);
   /* Posix interp 1009, temporary assignments preceding function calls modify
@@ -5101,27 +5105,33 @@ push_var_context (name, flags, tempvars)
 
 /* This can be called from one of two code paths:
        1. pop_scope, which implements the posix rules for propagating variable
-          assignments preceding special builtins to the surrounding scope.
+          assignments preceding special builtins to the surrounding scope
+          (push_builtin_var);
        2. pop_var_context, which is called from pop_context and implements the
           posix rules for propagating variable assignments preceding function
-          calls to the surrounding scope.
+          calls to the surrounding scope (push_func_var).
 
   It takes variables out of a temporary environment hash table. We take the
   variable in data.
 */
-static void
-push_func_var (data)
-     PTR_T data;
+
+static inline void
+push_posix_tempvar_internal (var, isbltin)
+     SHELL_VAR *var;
+     int isbltin;
 {
-  SHELL_VAR *var, *v;
+  SHELL_VAR *v;
   int posix_var_behavior;
 
-  var = (SHELL_VAR *)data;
   /* As of IEEE Std 1003.1-2017, assignment statements preceding shell
      functions no longer behave like assignment statements preceding
      special builtins, and do not persist in the current shell environment.
      This is austin group interp #654, though nobody implements it yet. */
-  posix_var_behavior = posixly_correct;  
+#if 0  /* XXX - TAG: bash-5.1 */
+  posix_var_behavior = posixly_correct && isbltin;
+#else
+  posix_var_behavior = posixly_correct;
+#endif
 
   if (local_p (var) && STREQ (var->name, "-"))
     set_current_options (value_cell (var));
@@ -5159,6 +5169,26 @@ push_func_var (data)
   dispose_variable (var);
 }
 
+static void
+push_func_var (data)
+     PTR_T data;
+{
+  SHELL_VAR *var;
+
+  var = (SHELL_VAR *)data;
+  push_posix_tempvar_internal (var, 0);
+}
+
+static void
+push_builtin_var (data)
+     PTR_T data;
+{
+  SHELL_VAR *var;
+
+  var = (SHELL_VAR *)data;
+  push_posix_tempvar_internal (var, 1);
+}
+
 /* Pop the top context off of VCXT and dispose of it, returning the rest of
    the stack. */
 void
@@ -5251,7 +5281,7 @@ push_exported_var (data)
    special builtin (if IS_SPECIAL != 0) or exported variables that are the
    result of a builtin like `source' or `command' that can operate on the
    variables in its temporary environment. In the first case, we call
-   push_func_var, which does the right thing (for now) */
+   push_builtin_var, which does the right thing. */
 void
 pop_scope (is_special)
      int is_special;
@@ -5279,7 +5309,7 @@ pop_scope (is_special)
   if (vcxt->table)
     {
       if (is_special)
-       hash_flush (vcxt->table, push_func_var);
+       hash_flush (vcxt->table, push_builtin_var);
       else
        hash_flush (vcxt->table, push_exported_var);
       hash_dispose (vcxt->table);