]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20190614 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 17 Jun 2019 15:20:22 +0000 (11:20 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 17 Jun 2019 15:20:22 +0000 (11:20 -0400)
CWRU/CWRU.chlog
builtins/set.def
doc/builtins.0
execute_cmd.c
expr.c

index f3639b01b764e4ea4edfe06be7d1fa0ea2743955..c23914a872d11c912f3539d0e076ad396a0961a9 100644 (file)
@@ -6104,3 +6104,29 @@ variables.c
          <coung.manhle.vn@gmail.com>
        - initialize_shell_variables: call set_argv0() as part of shell
          initialization
+
+                                  6/14
+                                  ----
+execute_cmd.c
+       - execute_for_command: make sure to call stupidly_hack_special_variables
+         on the index variable each time bind_variable is called on it. If
+         someone does something nonsensical like `for OPTIND in ...' we want
+         the side effects to happen. Reported by Stephane Chazelas
+         <stephane.chazelas@gmail.com>
+       - execute_select_command: do the same thing for the selection variable
+         after calling bind_variable
+
+                                  6/15
+                                  ----
+builtins/set.def
+       - unset_builtin: if neither -f nor -v is supplied, and a NAME cannot
+         be a shell variable because it's not a shell identifier, try to
+         unset a shell function whether we're in posix mode or not. Suggested
+         back in 1/2019 by PePa65 <solusos@passchier.net> and Robert Elz       
+         <kre@bmunnari.oz.au>
+
+execute_cmd.c
+       - execute_simple_command: if this is being executed by the command
+         builtin (flags&CMD_COMMAND_BUILTIN), don't bother to print the
+         command words if set -x is enabled. From a report by Martijn Dekker
+         <martijn@inlv.org> back in 4/2018
index d2bba434dd4ea03a6c733f216a6c6e3e3d6803cd..29703999281bdbd6782b661fdfc0ea3b3ccb4f65 100644 (file)
@@ -818,7 +818,7 @@ unset_builtin (list)
   WORD_LIST *list;
 {
   int unset_function, unset_variable, unset_array, opt, nameref, any_failed;
-  int global_unset_func, global_unset_var, vflags;
+  int global_unset_func, global_unset_var, vflags, valid_id;
   char *name, *tname;
 
   unset_function = unset_variable = unset_array = nameref = any_failed = 0;
@@ -884,17 +884,28 @@ unset_builtin (list)
 #endif
       /* Get error checking out of the way first.  The low-level functions
         just perform the unset, relying on the caller to verify. */
+      valid_id = legal_identifier (name);
+
+      /* Whether or not we are in posix mode, if neither -f nor -v appears,
+        skip over trying to unset variables with invalid names and just
+        treat them as potential shell function names. */
+      if (global_unset_func == 0 && global_unset_var == 0 && valid_id == 0)
+       {
+         unset_variable = unset_array = 0;
+         unset_function = 1;
+       }
 
       /* Bash allows functions with names which are not valid identifiers
         to be created when not in posix mode, so check only when in posix
         mode when unsetting a function. */
-      if (((unset_function && posixly_correct) || !unset_function) && legal_identifier (name) == 0)
+      if (unset_function == 0 && valid_id == 0)
        {
          sh_invalidid (name);
          NEXT_VARIABLE ();
        }
 
-      /* Only search for functions here if -f supplied. */
+      /* Search for functions here if -f supplied or if NAME cannot be a
+        variable name. */
       var = unset_function ? find_function (name)
                           : (nameref ? find_variable_last_nameref (name, 0) : find_variable (name));
 
index 6cdf6e4818f327abeedc9875b0a34118b2bee6fe..77d4d5ea86384a28fd264ca911ce7f47533391d1 100644 (file)
@@ -1615,18 +1615,17 @@ B\bBA\bAS\bSH\bH B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
               Return a status of 0 (true) or 1 (false) depending on the evalu-
               ation of the conditional expression _\be_\bx_\bp_\br.  Each operator and op-
               erand  must be a separate argument.  Expressions are composed of
-              the primaries described in the b\bba\bas\bsh\bh  manual  page  under  C\bCO\bON\bND\bDI\bI-\b-
-              T\bTI\bIO\bON\bNA\bAL\bL  E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS.  t\bte\bes\bst\bt does not accept any options, nor does
-              it accept and ignore an argument of -\b--\b- as signifying the end  of
-              options.
+              the primaries described  above  under  C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL  E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS.
+              t\bte\bes\bst\bt  does not accept any options, nor does it accept and ignore
+              an argument of -\b--\b- as signifying the end of options.
 
-              Expressions  may  be  combined  using  the  following operators,
+              Expressions may  be  combined  using  the  following  operators,
               listed  in  decreasing  order  of  precedence.   The  evaluation
-              depends  on the number of arguments; see below.  Operator prece-
+              depends on the number of arguments; see below.  Operator  prece-
               dence is used when there are five or more arguments.
               !\b! _\be_\bx_\bp_\br True if _\be_\bx_\bp_\br is false.
               (\b( _\be_\bx_\bp_\br )\b)
-                     Returns the value of _\be_\bx_\bp_\br.  This may be used to  override
+                     Returns  the value of _\be_\bx_\bp_\br.  This may be used to override
                      the normal precedence of operators.
               _\be_\bx_\bp_\br_\b1 -a\ba _\be_\bx_\bp_\br_\b2
                      True if both _\be_\bx_\bp_\br_\b1 and _\be_\bx_\bp_\br_\b2 are true.
@@ -1643,120 +1642,120 @@ B\bBA\bAS\bSH\bH B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
                      null.
               2 arguments
                      If the first argument is !\b!, the expression is true if and
-                     only if the second argument is null.  If the first  argu-
-                     ment  is  one  of  the unary conditional operators listed
-                     above under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS,  the  expression  is
+                     only  if the second argument is null.  If the first argu-
+                     ment is one of the  unary  conditional  operators  listed
+                     above  under  C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL  E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS, the expression is
                      true if the unary test is true.  If the first argument is
                      not a valid unary conditional operator, the expression is
                      false.
               3 arguments
                      The following conditions are applied in the order listed.
-                     If the second argument is one of the  binary  conditional
+                     If  the  second argument is one of the binary conditional
                      operators listed above under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS, the
                      result of the expression is the result of the binary test
-                     using  the first and third arguments as operands.  The -\b-a\ba
-                     and -\b-o\bo operators are  considered  binary  operators  when
-                     there  are  three arguments.  If the first argument is !\b!,
-                     the value is the negation of the two-argument test  using
+                     using the first and third arguments as operands.  The  -\b-a\ba
+                     and  -\b-o\bo  operators  are  considered binary operators when
+                     there are three arguments.  If the first argument  is  !\b!,
+                     the  value is the negation of the two-argument test using
                      the second and third arguments.  If the first argument is
                      exactly (\b( and the third argument is exactly )\b), the result
-                     is  the one-argument test of the second argument.  Other-
+                     is the one-argument test of the second argument.   Other-
                      wise, the expression is false.
               4 arguments
                      If the first argument is !\b!, the result is the negation of
-                     the  three-argument  expression composed of the remaining
+                     the three-argument expression composed of  the  remaining
                      arguments.  Otherwise, the expression is parsed and eval-
-                     uated  according  to  precedence  using  the rules listed
+                     uated according to  precedence  using  the  rules  listed
                      above.
               5 or more arguments
-                     The expression  is  parsed  and  evaluated  according  to
+                     The  expression  is  parsed  and  evaluated  according to
                      precedence using the rules listed above.
 
-              When  used  with  t\bte\bes\bst\bt  or [\b[, the <\b< and >\b> operators sort lexico-
+              When used with t\bte\bes\bst\bt or [\b[, the <\b< and  >\b>  operators  sort  lexico-
               graphically using ASCII ordering.
 
-       t\bti\bim\bme\bes\bs  Print the accumulated user and system times for  the  shell  and
+       t\bti\bim\bme\bes\bs  Print  the  accumulated  user and system times for the shell and
               for processes run from the shell.  The return status is 0.
 
        t\btr\bra\bap\bp [-\b-l\blp\bp] [[_\ba_\br_\bg] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
-              The  command  _\ba_\br_\bg  is  to  be  read  and executed when the shell
-              receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc.  If _\ba_\br_\bg is absent (and  there  is  a
-              single  _\bs_\bi_\bg_\bs_\bp_\be_\bc)  or  -\b-,  each  specified signal is reset to its
-              original disposition (the value it  had  upon  entrance  to  the
-              shell).   If _\ba_\br_\bg is the null string the signal specified by each
-              _\bs_\bi_\bg_\bs_\bp_\be_\bis ignored by the shell and by the commands it  invokes.
-              If  _\ba_\br_\bg  is  not present and -\b-p\bp has been supplied, then the trap
-              commands associated with each  _\bs_\bi_\bg_\bs_\bp_\be_\bc  are  displayed.   If  no
-              arguments  are  supplied or if only -\b-p\bp is given, t\btr\bra\bap\bp prints the
-              list of commands associated with each  signal.   The  -\b-l\b option
-              causes  the shell to print a list of signal names and their cor-
-              responding numbers.   Each  _\bs_\bi_\bg_\bs_\bp_\be_\bc  is  either  a  signal  name
-              defined  in  <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>,  or  a signal number.  Signal names are
+              The command _\ba_\br_\bg is to  be  read  and  executed  when  the  shell
+              receives  signal(s)  _\bs_\bi_\bg_\bs_\bp_\be_\bc.   If _\ba_\br_\bg is absent (and there is a
+              single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified  signal  is  reset  to  its
+              original  disposition  (the  value  it  had upon entrance to the
+              shell).  If _\ba_\br_\bg is the null string the signal specified by  each
+              _\bs_\bi_\bg_\bs_\bp_\be_\b is ignored by the shell and by the commands it invokes.
+              If _\ba_\br_\bg is not present and -\b-p\bp has been supplied,  then  the  trap
+              commands  associated  with  each  _\bs_\bi_\bg_\bs_\bp_\be_\bc  are displayed.  If no
+              arguments are supplied or if only -\b-p\bp is given, t\btr\bra\bap\bp  prints  the
+              list  of  commands  associated  with each signal.  The -\b-l\bl option
+              causes the shell to print a list of signal names and their  cor-
+              responding  numbers.   Each  _\bs_\bi_\bg_\bs_\bp_\be_\bc  is  either  a  signal name
+              defined in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal  number.   Signal  names  are
               case insensitive and the S\bSI\bIG\bG prefix is optional.
 
-              If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bEX\bXI\bIT\bT (0) the command _\ba_\br_\bg  is  executed  on  exit
-              from  the shell.  If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is D\bDE\bEB\bBU\bUG\bG, the command _\ba_\br_\bg is exe-
-              cuted before every _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, _\bf_\bo_\br  command,  _\bc_\ba_\bs_\b command,
-              _\bs_\be_\bl_\be_\bc_\b command,  every  arithmetic  _\bf_\bo_\br command, and before the
-              first command executes in a shell function  (see  S\bSH\bHE\bEL\bLL\b G\bGR\bRA\bAM\bMM\bMA\bAR\bR
-              above).   Refer to the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the
+              If  a  _\bs_\bi_\bg_\bs_\bp_\be_\bc  is  E\bEX\bXI\bIT\bT (0) the command _\ba_\br_\bg is executed on exit
+              from the shell.  If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is D\bDE\bEB\bBU\bUG\bG, the command _\ba_\br_\bg is  exe-
+              cuted  before  every  _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, _\bf_\bo_\br command, _\bc_\ba_\bs_\be command,
+              _\bs_\be_\bl_\be_\bc_\bcommand, every arithmetic _\bf_\bo_\br  command,  and  before  the
+              first  command  executes  in a shell function (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
+              above).  Refer to the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to  the
               s\bsh\bho\bop\bpt\bt builtin for details of its effect on the D\bDE\bEB\bBU\bUG\bG trap.  If a
               _\bs_\bi_\bg_\bs_\bp_\be_\bc is R\bRE\bET\bTU\bUR\bRN\bN, the command _\ba_\br_\bg is executed each time a shell
               function or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins fin-
               ishes executing.
 
-              If  a  _\bs_\bi_\bg_\bs_\bp_\be_\bc  is  E\bER\bRR\bR,  the command _\ba_\br_\bg is executed whenever a
+              If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, the command  _\ba_\br_\bg  is  executed  whenever  a
               pipeline (which may consist of a single simple command), a list,
               or a compound command returns a non-zero exit status, subject to
-              the following conditions.  The E\bER\bRR\bR trap is not executed  if  the
+              the  following  conditions.  The E\bER\bRR\bR trap is not executed if the
               failed command is part of the command list immediately following
-              a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword, part of the test in an  _\bi_\b statement,
+              a  w\bwh\bhi\bil\ble\be  or u\bun\bnt\bti\bil\bl keyword, part of the test in an _\bi_\bf statement,
               part of a command executed in a &\b&&\b& or |\b||\b| list except the command
-              following the final &\b&&\b& or |\b||\b|, any command in a pipeline but  the
-              last,  or  if the command's return value is being inverted using
-              !\b!.  These are the same conditions obeyed  by  the  e\ber\brr\bre\bex\bxi\bit\b (-\b-e\be)
+              following  the final &\b&&\b& or |\b||\b|, any command in a pipeline but the
+              last, or if the command's return value is being  inverted  using
+              !\b!.   These  are  the  same conditions obeyed by the e\ber\brr\bre\bex\bxi\bit\bt (-\b-e\be)
               option.
 
-              Signals  ignored  upon  entry  to the shell cannot be trapped or
-              reset.  Trapped signals that are not being ignored are reset  to
+              Signals ignored upon entry to the shell  cannot  be  trapped  or
+              reset.   Trapped signals that are not being ignored are reset to
               their original values in a subshell or subshell environment when
-              one is created.  The return status is false if  any  _\bs_\bi_\bg_\bs_\bp_\be_\b is
+              one  is  created.   The return status is false if any _\bs_\bi_\bg_\bs_\bp_\be_\bc is
               invalid; otherwise t\btr\bra\bap\bp returns true.
 
        t\bty\byp\bpe\be [-\b-a\baf\bft\btp\bpP\bP] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be ...]
-              With  no options, indicate how each _\bn_\ba_\bm_\be would be interpreted if
+              With no options, indicate how each _\bn_\ba_\bm_\be would be interpreted  if
               used as a command name.  If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a
-              string  which  is  one  of _\ba_\bl_\bi_\ba_\bs, _\bk_\be_\by_\bw_\bo_\br_\bd, _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn, _\bb_\bu_\bi_\bl_\bt_\bi_\bn, or
-              _\bf_\bi_\bl_\bif  _\bn_\ba_\bm_\be  is  an  alias,  shell  reserved  word,  function,
-              builtin,  or disk file, respectively.  If the _\bn_\ba_\bm_\be is not found,
-              then nothing  is  printed,  and  an  exit  status  of  false  is
-              returned.   If  the  -\b-p\bp  option is used, t\bty\byp\bpe\be either returns the
+              string which is one of _\ba_\bl_\bi_\ba_\bs,  _\bk_\be_\by_\bw_\bo_\br_\bd,  _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn,  _\bb_\bu_\bi_\bl_\bt_\bi_\bn,  or
+              _\bf_\bi_\bl_\b if  _\bn_\ba_\bm_\be  is  an  alias,  shell  reserved  word, function,
+              builtin, or disk file, respectively.  If the _\bn_\ba_\bm_\be is not  found,
+              then  nothing  is  printed,  and  an  exit  status  of  false is
+              returned.  If the -\b-p\bp option is used,  t\bty\byp\bpe\be  either  returns  the
               name of the disk file that would be executed if _\bn_\ba_\bm_\be were speci-
               fied as a command name, or nothing if ``type -t name'' would not
-              return _\bf_\bi_\bl_\be.  The -\b-P\bP option forces a P\bPA\bAT\bTH\bH search for each  _\bn_\ba_\bm_\be,
+              return  _\bf_\bi_\bl_\be.  The -\b-P\bP option forces a P\bPA\bAT\bTH\bH search for each _\bn_\ba_\bm_\be,
               even if ``type -t name'' would not return _\bf_\bi_\bl_\be.  If a command is
               hashed, -\b-p\bp and -\b-P\bP print the hashed value, which is not necessar-
-              ily  the  file  that appears first in P\bPA\bAT\bTH\bH.  If the -\b-a\ba option is
-              used, t\bty\byp\bpe\be prints all of the places that contain  an  executable
+              ily the file that appears first in P\bPA\bAT\bTH\bH.  If the  -\b-a\ba  option  is
+              used,  t\bty\byp\bpe\be  prints all of the places that contain an executable
               named _\bn_\ba_\bm_\be.  This includes aliases and functions, if and only if
               the -\b-p\bp option is not also used.  The table of hashed commands is
-              not  consulted  when  using  -\b-a\ba.  The -\b-f\bf option suppresses shell
+              not consulted when using -\b-a\ba.  The  -\b-f\bf  option  suppresses  shell
               function lookup, as with the c\bco\bom\bmm\bma\ban\bnd\bd builtin.  t\bty\byp\bpe\be returns true
               if all of the arguments are found, false if any are not found.
 
        u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bSa\bab\bbc\bcd\bde\bef\bfi\bik\bkl\blm\bmn\bnp\bpq\bqr\brs\bst\btu\buv\bvx\bxP\bPT\bT [_\bl_\bi_\bm_\bi_\bt]]
-              Provides  control  over the resources available to the shell and
-              to processes started by it, on systems that allow such  control.
+              Provides control over the resources available to the  shell  and
+              to  processes started by it, on systems that allow such control.
               The -\b-H\bH and -\b-S\bS options specify that the hard or soft limit is set
-              for the given resource.  A hard limit cannot be increased  by  a
-              non-root  user  once it is set; a soft limit may be increased up
-              to the value of the hard limit.  If neither -\b-H\bH nor -\b-S\bS is  speci-
+              for  the  given resource.  A hard limit cannot be increased by a
+              non-root user once it is set; a soft limit may be  increased  up
+              to  the value of the hard limit.  If neither -\b-H\bH nor -\b-S\bS is speci-
               fied, both the soft and hard limits are set.  The value of _\bl_\bi_\bm_\bi_\bt
               can be a number in the unit specified for the resource or one of
               the special values h\bha\bar\brd\bd, s\bso\bof\bft\bt, or u\bun\bnl\bli\bim\bmi\bit\bte\bed\bd, which stand for the
-              current hard limit,  the  current  soft  limit,  and  no  limit,
-              respectively.   If  _\bl_\bi_\bm_\bi_\bt  is  omitted, the current value of the
-              soft limit of the resource is printed, unless the -\b-H\bH  option  is
+              current  hard  limit,  the  current  soft  limit,  and no limit,
+              respectively.  If _\bl_\bi_\bm_\bi_\bt is omitted, the  current  value  of  the
+              soft  limit  of the resource is printed, unless the -\b-H\bH option is
               given.  When more than one resource is specified, the limit name
               and unit are printed before the value.  Other options are inter-
               preted as follows:
@@ -1765,12 +1764,12 @@ B\bBA\bAS\bSH\bH B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
               -\b-c\bc     The maximum size of core files created
               -\b-d\bd     The maximum size of a process's data segment
               -\b-e\be     The maximum scheduling priority ("nice")
-              -\b-f\bf     The  maximum  size  of files written by the shell and its
+              -\b-f\bf     The maximum size of files written by the  shell  and  its
                      children
               -\b-i\bi     The maximum number of pending signals
               -\b-k\bk     The maximum number of kqueues that may be allocated
               -\b-l\bl     The maximum size that may be locked into memory
-              -\b-m\bm     The maximum resident set size (many systems do not  honor
+              -\b-m\bm     The  maximum resident set size (many systems do not honor
                      this limit)
               -\b-n\bn     The maximum number of open file descriptors (most systems
                      do not allow this value to be set)
@@ -1779,53 +1778,53 @@ B\bBA\bAS\bSH\bH B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
               -\b-r\br     The maximum real-time scheduling priority
               -\b-s\bs     The maximum stack size
               -\b-t\bt     The maximum amount of cpu time in seconds
-              -\b-u\bu     The maximum number of processes  available  to  a  single
+              -\b-u\bu     The  maximum  number  of  processes available to a single
                      user
-              -\b-v\bv     The  maximum  amount  of  virtual memory available to the
+              -\b-v\bv     The maximum amount of virtual  memory  available  to  the
                      shell and, on some systems, to its children
               -\b-x\bx     The maximum number of file locks
               -\b-P\bP     The maximum number of pseudoterminals
               -\b-T\bT     The maximum number of threads
 
-              If _\bl_\bi_\bm_\bi_\bt is given, and the -\b-a\ba option is not used, _\bl_\bi_\bm_\bi_\bt  is  the
-              new  value  of  the  specified resource.  If no option is given,
-              then -\b-f\bf is assumed.  Values are in 1024-byte increments,  except
-              for  -\b-t\bt,  which is in seconds; -\b-p\bp, which is in units of 512-byte
-              blocks; -\b-P\bP, -\b-T\bT, -\b-b\bb, -\b-k\bk, -\b-n\bn, and -\b-u\bu, which are  unscaled  values;
+              If  _\bl_\bi_\bm_\bi_\bt  is given, and the -\b-a\ba option is not used, _\bl_\bi_\bm_\bi_\bt is the
+              new value of the specified resource.  If  no  option  is  given,
+              then  -\b-f\bf is assumed.  Values are in 1024-byte increments, except
+              for -\b-t\bt, which is in seconds; -\b-p\bp, which is in units  of  512-byte
+              blocks;  -\b-P\bP,  -\b-T\bT, -\b-b\bb, -\b-k\bk, -\b-n\bn, and -\b-u\bu, which are unscaled values;
               and, when in posix mode, -\b-c\bc and -\b-f\bf, which are in 512-byte incre-
               ments.  The return status is 0 unless an invalid option or argu-
               ment is supplied, or an error occurs while setting a new limit.
 
        u\bum\bma\bas\bsk\bk [-\b-p\bp] [-\b-S\bS] [_\bm_\bo_\bd_\be]
               The user file-creation mask is set to _\bm_\bo_\bd_\be.  If _\bm_\bo_\bd_\be begins with
-              a digit, it is interpreted as an octal number; otherwise  it  is
-              interpreted  as a symbolic mode mask similar to that accepted by
-              _\bc_\bh_\bm_\bo_\bd(1).  If _\bm_\bo_\bd_\be is omitted, the current value of the mask  is
-              printed.   The  -\b-S\bS  option causes the mask to be printed in sym-
-              bolic form; the default output is an octal number.   If  the  -\b-p\bp
+              a  digit,  it is interpreted as an octal number; otherwise it is
+              interpreted as a symbolic mode mask similar to that accepted  by
+              _\bc_\bh_\bm_\bo_\bd(1).   If _\bm_\bo_\bd_\be is omitted, the current value of the mask is
+              printed.  The -\b-S\bS option causes the mask to be  printed  in  sym-
+              bolic  form;  the  default output is an octal number.  If the -\b-p\bp
               option is supplied, and _\bm_\bo_\bd_\be is omitted, the output is in a form
               that may be reused as input.  The return status is 0 if the mode
-              was  successfully  changed  or if no _\bm_\bo_\bd_\be argument was supplied,
+              was successfully changed or if no _\bm_\bo_\bd_\be  argument  was  supplied,
               and false otherwise.
 
        u\bun\bna\bal\bli\bia\bas\bs [-a\ba] [_\bn_\ba_\bm_\be ...]
-              Remove each _\bn_\ba_\bm_\be from the list of defined  aliases.   If  -\b-a\b is
-              supplied,  all  alias definitions are removed.  The return value
+              Remove  each  _\bn_\ba_\bm_\be  from  the list of defined aliases.  If -\b-a\ba is
+              supplied, all alias definitions are removed.  The  return  value
               is true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
 
        u\bun\bns\bse\bet\bt [-f\bfv\bv] [-n\bn] [_\bn_\ba_\bm_\be ...]
-              For each _\bn_\ba_\bm_\be, remove the corresponding  variable  or  function.
+              For  each  _\bn_\ba_\bm_\be,  remove the corresponding variable or function.
               If the -\b-v\bv option is given, each _\bn_\ba_\bm_\be refers to a shell variable,
-              and that variable is removed.  Read-only variables  may  not  be
-              unset.   If  -\b-f\bf  is specified, each _\bn_\ba_\bm_\be refers to a shell func-
-              tion, and the function definition is removed.  If the -\b-n\b option
-              is  supplied, and _\bn_\ba_\bm_\be is a variable with the _\bn_\ba_\bm_\be_\br_\be_\bf attribute,
-              _\bn_\ba_\bm_\bwill be unset rather than the variable it  references.   -\b-n\bn
-              has  no  effect if the -\b-f\bf option is supplied.  If no options are
-              supplied, each _\bn_\ba_\bm_\be refers to a variable; if there is  no  vari-
-              able  by  that name, any function with that name is unset.  Each
-              unset variable or  function  is  removed  from  the  environment
-              passed  to subsequent commands.  If any of C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, R\bRA\bAN\bN-\b-
+              and  that  variable  is removed.  Read-only variables may not be
+              unset.  If -\b-f\bf is specified, each _\bn_\ba_\bm_\be refers to  a  shell  func-
+              tion,  and the function definition is removed.  If the -\b-n\bn option
+              is supplied, and _\bn_\ba_\bm_\be is a variable with the _\bn_\ba_\bm_\be_\br_\be_\b attribute,
+              _\bn_\ba_\bm_\b will  be unset rather than the variable it references.  -\b-n\bn
+              has no effect if the -\b-f\bf option is supplied.  If no  options  are
+              supplied,  each  _\bn_\ba_\bm_\be refers to a variable; if there is no vari-
+              able by that name, any function with that name is  unset.   Each
+              unset  variable  or  function  is  removed  from the environment
+              passed to subsequent commands.  If any of C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS,  R\bRA\bAN\bN-\b-
               D\bDO\bOM\bM, S\bSE\bEC\bCO\bON\bND\bDS\bS, L\bLI\bIN\bNE\bEN\bNO\bO, H\bHI\bIS\bST\bTC\bCM\bMD\bD, F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, or D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK are
               unset, they lose their special properties, even if they are sub-
               sequently reset.  The exit status is true unless a _\bn_\ba_\bm_\be is read-
@@ -1833,17 +1832,17 @@ B\bBA\bAS\bSH\bH B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
 
        w\bwa\bai\bit\bt [-\b-f\bfn\bn] [_\bi_\bd _\b._\b._\b.]
               Wait for each specified child process and return its termination
-              status.  Each _\bi_\bd may be a process ID or a job specification;  if
-              a  job  spec  is given, all processes in that job's pipeline are
-              waited for.  If _\bi_\bd is not given,  w\bwa\bai\bit\bt  waits  for  all  running
-              background  jobs  and the last-executed process substitution, if
+              status.   Each _\bi_\bd may be a process ID or a job specification; if
+              a job spec is given, all processes in that  job's  pipeline  are
+              waited  for.   If  _\bi_\bd  is  not given, w\bwa\bai\bit\bt waits for all running
+              background jobs and the last-executed process  substitution,  if
               its process id is the same as $\b$!\b!, and the return status is zero.
-              If  the  -\b-n\bn  option  is supplied, w\bwa\bai\bit\bt waits for a single job to
+              If the -\b-n\bn option is supplied, w\bwa\bai\bit\bt waits for  a  single  job  to
               terminate and returns its exit status.  Supplying the -\b-f\bf option,
-              when  job control is enabled, forces w\bwa\bai\bit\bt to wait for _\bi_\bd to ter-
+              when job control is enabled, forces w\bwa\bai\bit\bt to wait for _\bi_\bd to  ter-
               minate before returning its status, instead of returning when it
-              changes  status.  If _\bi_\bd specifies a non-existent process or job,
-              the return status is 127.  Otherwise, the return status  is  the
+              changes status.  If _\bi_\bd specifies a non-existent process or  job,
+              the  return  status is 127.  Otherwise, the return status is the
               exit status of the last process or job waited for.
 
 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
index 2ef9137203f4632c5089c34080cc998b4094b382..e094bddb0d7ca56482f44d9f80884162f9d5476e 100644 (file)
@@ -2929,6 +2929,8 @@ execute_for_command (for_command)
 
       if (ifsname (identifier))
        setifs (v);
+      else
+       stupidly_hack_special_variables (identifier);
 
       retval = execute_command (for_command->action);
       REAP ();
@@ -3428,6 +3430,8 @@ execute_select_command (select_command)
            }
        }
 
+      stupidly_hack_special_variables (identifier);
+
       retval = execute_command (select_command->action);
 
       REAP ();
@@ -4368,7 +4372,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
 
   begin_unwind_frame ("simple-command");
 
-  if (echo_command_at_execute)
+  if (echo_command_at_execute && (simple_command->flags & CMD_COMMAND_BUILTIN) == 0)
     xtrace_print_word_list (words, 1);
 
   builtin = (sh_builtin_func_t *)NULL;
diff --git a/expr.c b/expr.c
index 9edc8d9cddbe9f39db2c1d79dfa11a23a9653ac5..d1092297cbff7ef73ad43e59efad0ad2f142c7de 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -1524,6 +1524,8 @@ evalerror (msg)
    from [0-9][a-z][A-Z]_@ (a = 10, z = 35, A = 36, Z = 61, @ = 62, _ = 63 --
    you get the picture). */
 
+#define VALID_NUMCHAR(c)       (ISALNUM(c) || ((c) == '_') || ((c) == '@'))
+
 static intmax_t
 strlong (num)
      char *num;
@@ -1570,8 +1572,15 @@ strlong (num)
          base = val;
          val = 0;
          foundbase++;
+
+#if 0  /* TAG:bash-5.1 */
+         /* Make sure a base# is followed by a character that can compose a
+            valid integer constant. Jeremy Townshend <jeremy.townshend@gmail.com> */
+         if (VALID_NUMCHAR (*s) == 0)
+           evalerror (_("invalid integer constant"));
+#endif
        }
-      else if (ISALNUM(c) || (c == '_') || (c == '@'))
+      else if (VALID_NUMCHAR (c))
        {
          if (DIGIT(c))
            c = TODIGIT(c);