]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
fix problem with completing filenames with user-supplied double quotes containing...
authorChet Ramey <chet.ramey@case.edu>
Wed, 1 Oct 2025 15:14:27 +0000 (11:14 -0400)
committerChet Ramey <chet.ramey@case.edu>
Wed, 1 Oct 2025 15:14:27 +0000 (11:14 -0400)
CWRU/CWRU.chlog
bashline.c
builtins/printf.def
doc/bash.1
doc/bashref.texi
doc/version.texi
examples/loadables/fltexpr.c
execute_cmd.c
parse.y
tests/execscript

index c223fbb04f994cddf4f361604ad98b388a979b21..4114d6770d5cab1ce462df94e952c1719b2d18f4 100644 (file)
@@ -11832,4 +11832,33 @@ builtins/read.def
          -n/-N/-d options
        - read_builtin: call check_read_input instead of input_avail if we
          have a zero timeout
-         From a report by pourko@tutamail.com
+         Report from pourko@tutamail.com
+
+bashline.c
+       - bash_quote_filename: if the user supplies an opening double quote
+         and the word being completed contains a `$' or ``', make sure there
+         is a single match and it doesn't exist as a filename before setting
+         the quoting style to COMPLETE_DQUOTE2.
+         This is similar to the change from 8/22.
+         Report from Koichi Murase <myoga.murase@gmail.com>
+
+                                  9/25
+                                  ----
+builtins/printf.def
+       - printwidestr: handle precision < 0 as an overflow return from
+         decodeint; don't adjust pr in this case so the string gets printed.
+         Same as fix to printstr from 7/8
+         Report from pourko@tutamail.com
+
+                                  9/29
+                                  ----
+execute_cmd.c
+       - time_command: if we don't have gettimeofday or getrusage, and we're
+         using times(3), make sure we convert from seconds to CLK_TCKs
+         when assigning tbefore from shell_start_time (use get_clk_tck())
+         Report from pourko2@tutamail.com
+
+parse.y
+       - reset_parser: reset shell_eof_token to 0, rely on callers to restore
+         it if they need to
+         Report from Grisha Levit <grishalevit@gmail.com>
index 1ee70358ff8aacd3d3202edc32531e1f8d3748c2..e4f9975b454781456e95408a7592edeef833b487 100644 (file)
@@ -4442,7 +4442,7 @@ bash_quote_filename (char *s, int rtype, char *qcp)
     cs = COMPLETE_SQUOTE;
   else if (*qcp == '"')
     {
-      if ((expchar = bash_check_expchar (s, 0, &nextch, &closer)) == '$' || expchar == '`')
+      if (((expchar = bash_check_expchar (s, 0, &nextch, &closer)) == '$' || expchar == '`') && rtype == SINGLE_MATCH && file_exists (s) == 0)
        cs = COMPLETE_DQUOTE2;
       else
        cs = COMPLETE_DQUOTE;
index 3c4335c42e3250d27b4a78fd91f91c2cdf5ecd34..2de73b54aaa091af040e0fe0993e37ee978a8bea 100644 (file)
@@ -1016,7 +1016,11 @@ printwidestr (char *fmt, wchar_t *wstring, size_t len, int fieldwidth, int preci
          pr = decodeint (&fmt, 1, -1);
          /* pr < precision means we adjusted precision in printf_builtin
             for the quoted string length (%Q), so we use the adjusted value */
+#if 1 /*TAG:bash-5.4 20250702 */
+         if (pr >= 0 && pr < precision)
+#else
          if (pr < precision)
+#endif
            pr = precision;
        }
       else
index a00d41876a1aec746ce8b1b49dd7a6e9af93ab63..f82c130c2c1d6bc41a45482aee3d756be78020de 100644 (file)
@@ -5,7 +5,7 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Fri Sep 19 12:19:06 EDT 2025
+.\"    Last Change: Wed Sep 24 09:35:41 EDT 2025
 .\"
 .\" For bash_builtins, strip all but "SHELL BUILTIN COMMANDS" section
 .\" For rbash, strip all but "RESTRICTED SHELL" section
@@ -21,7 +21,7 @@
 .ds zY \" empty
 .if \n(zZ=1 .ig zZ
 .if \n(zY=1 .ig zY
-.TH BASH 1 "2025 September 19" "GNU Bash 5.3"
+.TH BASH 1 "2025 September 24" "GNU Bash 5.3"
 .\"
 .ie \n(.g \{\
 .ds ' \(aq
@@ -4544,13 +4544,27 @@ include it as the first character in the set.
 .IP
 The sorting order of characters in range expressions,
 and the characters included in the range,
-are determined by the current locale and the values of the
+are determined by the collating sequence of the
+current locale and the values of the
 .SM
 .B LC_COLLATE
 or
 .SM
 .B LC_ALL
 shell variables, if set.
+.IP
+For example, in the C locale,
+.B [a\-d]
+is equivalent to
+.BR [abcd] .
+Many locales sort characters in dictionary order, and in these locales
+.B [a\-d]
+is typically not equivalent to
+.BR [abcd] ;
+it might be equivalent to
+.B [aBbCcDd]
+or
+.BR [aAbBcCd] .
 To obtain the traditional interpretation of range expressions, where
 .B [a\-d]
 is equivalent to
index 29908ca14d976c071a02f7797512f1c2a8a2b8b1..0ac623d1bbe9c4f1ec4b98c47794f79b8bd79006 100644 (file)
@@ -3190,18 +3190,26 @@ character in the set.
 
 The sorting order of characters in range expressions,
 and the characters included in the range,
-are determined by the current locale and the values of the
+are determined by the collating sequence of the
+current locale and the values of the
 @env{LC_COLLATE} and @env{LC_ALL} shell variables, if set.
 
-For example, in the default C locale, @samp{[a-dx-z]} is equivalent to
+For example, in the default C locale,
+@samp{[a-dx-z]}
+is equivalent to
 @samp{[abcdxyz]}.
 Many locales sort characters in dictionary order, and in these locales
-@samp{[a-dx-z]} is typically not equivalent to @samp{[abcdxyz]};
-it might be equivalent to @samp{[aBbCcDdxYyZz]}, for example.
-To obtain
-the traditional interpretation of ranges in bracket expressions, you can
-force the use of the C locale by setting the @env{LC_COLLATE} or
-@env{LC_ALL} environment variable to the value @samp{C}, or enable the
+@samp{[a-dx-z]}
+is typically not equivalent to
+@samp{[abcdxyz]};
+it might be equivalent to
+@samp{[aBbCcDdxYyZz]}
+or
+@samp{[aAbBcCdxXyYz]}.
+To obtain the traditional interpretation of ranges in bracket expressions,
+you can force the use of the C locale by setting the
+@env{LC_COLLATE} or @env{LC_ALL}
+environment variables to the value @samp{C}, or enable the
 @code{globasciiranges} shell option.
 
 Within a bracket expression, @dfn{character classes} can be specified
index ae5d44499ad1940086108ebf854210515a5e72c5..7bf929f58490ecc653565c8e437e5aff90ceb632 100644 (file)
@@ -2,10 +2,10 @@
 Copyright (C) 1988-2025 Free Software Foundation, Inc.
 @end ignore
 
-@set LASTCHANGE Fri Sep 19 12:19:29 EDT 2025
+@set LASTCHANGE Wed Sep 24 09:35:21 EDT 2025
 
 @set EDITION 5.3
 @set VERSION 5.3
 
-@set UPDATED 19 September 2025
+@set UPDATED 24 September 2025
 @set UPDATED-MONTH September 2025
index 4576f3d28358c342ef6231eaebce622f4feddf16..5af6eeb84ceeef6d8fe752d461295aa7cb8beda5 100644 (file)
@@ -1744,11 +1744,15 @@ fltexpr_builtin_unload (char *s)
 
 char *fltexpr_doc[] =
 {
-  "Evaluate floating-point arithmetic expression.",
+  "Evaluate floating-point arithmetic expression.",
   "",
   "Evaluate EXPRESSION as a floating-point arithmetic expression and,",
   "if the -p option is supplied, print the value to the standard output.",
   "",
+  "Operators and precedence are similar to the let builtin (bitwise",
+  "operators and the modulus operator are not available). Calculations",
+  "are performed using C double-precision floating point values.",
+  "",
   "Exit Status:",
   "If the EXPRESSION evaluates to 0, the return status is 1; 0 otherwise.",
   (char *)NULL
index 006312d368821e3972baa5562dd89fafa8aedee8..3a1c169edbb0c93c96366281af783c0fdedbdfc4 100644 (file)
@@ -1505,7 +1505,7 @@ time_command (COMMAND *command, int asynchronous, int pipe_in, int pipe_out, str
       before = shellstart;
 #else
       before.tms_utime = before.tms_stime = before.tms_cutime = before.tms_cstime = 0;
-      tbefore = shell_start_time;
+      tbefore = shell_start_time * get_clk_tck ();
 #endif
     }
 
diff --git a/parse.y b/parse.y
index b698f86bc7f2863430cbad6d2371d2978b601dff..615c3fe026a25c8f740ad273500904807a0e508a 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -3558,6 +3558,8 @@ reset_parser (void)
 
   simplecmd_lineno = line_number;
 
+  shell_eof_token = 0;         /* no longer parsing command substitution */
+
   current_token = '\n';                /* XXX */
   last_read_token = '\n';
   token_to_read = '\n';
index 0e652b1a964c9f42d17b507eb16ef957d73f049f..15a9da8f01156f913070597adb5be4e0807c8d2f 100644 (file)
@@ -167,7 +167,8 @@ ${THIS_SH} -c 'VAR=0; VAR=1 command exec; exit ${VAR}'
         exec /var/empty/nosuch
         echo bad
 ) 2>/dev/null
-[ $? = 127 ] || echo FAIL: bad exit status $? at $LINENO
+r=$?
+[ $r = 127 ] || echo FAIL: bad exit status $r at $LINENO
 
 unset FALSE
 if [ -x /bin/false ]; then