mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-11 14:10:49 +02:00
fix issue with reserved words in case clauses in command substitution; fix issue with double free in compound assignment
This commit is contained in:
@@ -8235,3 +8235,28 @@ shell.c
|
||||
- execute_bashrc_file: execute whatever find_bashrc_file() returns
|
||||
if bashrc_file is NULL
|
||||
From a patch from Allison Karlitskaya <allison.karlitskaya@redhat.com>
|
||||
|
||||
1/3/2024
|
||||
--------
|
||||
print_cmd.c
|
||||
- print_case_clauses: if we're printing a comsub for subsequent parsing,
|
||||
don't add a newline before the first case clause, since it adds a
|
||||
token after the `in' that will allow reserved words to be parsed.
|
||||
Report from Oguz <oguzismailuysal@gmail.com>
|
||||
|
||||
1/5
|
||||
---
|
||||
lib/readline/doc/rltech.texi,lib/readline/doc/readline.3
|
||||
- Note that since quoted characters are possible, the line readline()
|
||||
returns may contain embedded newlines.
|
||||
From a report by Martin Buck <mb-tmp-tah.bet@gromit.dyndns.org>
|
||||
|
||||
1/8
|
||||
---
|
||||
parse.y
|
||||
- parse_compound_assignment,parse_string_to_word_list: if we call
|
||||
reset_parser, directly or indirectly via yyerror, make sure to set
|
||||
the pushed_strings member of the saved parser state to NULL, since
|
||||
reset_parser already freed it and we don't want to try and restore
|
||||
it in restore_parser_state.
|
||||
From a report by Nathan Mills <the.true.nathan.mills@gmail.com>
|
||||
|
||||
+16
@@ -172,6 +172,11 @@ UBSAN_XLDFLAGS = -fsanitize=undefined
|
||||
GCOV_XCFLAGS = -fprofile-arcs -ftest-coverage
|
||||
GCOV_XLDFLAGS = -fprofile-arcs -ftest-coverage
|
||||
|
||||
# these need CC=clang
|
||||
LSAN_CC = clang
|
||||
LSAN_XCFLAGS = -fsanitize=leak -fno-common -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
||||
LSAN_XLDFLAGS = -fsanitize=leak
|
||||
|
||||
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
|
||||
|
||||
# Maybe add: -Wextra
|
||||
@@ -634,10 +639,14 @@ ubsan:
|
||||
valgrind:
|
||||
${MAKE} ${MFLAGS} ADDON_CFLAGS='-DDISABLE_MALLOC_WRAPPERS' ADDON_LDFLAGS= .made
|
||||
|
||||
lsan:
|
||||
${MAKE} ${MFLAGS} CC=${LSAN_CC} ADDON_CFLAGS='${LSAN_XCFLAGS}' ADDON_LDFLAGS='${LSAN_XLDFLAGS}' .made
|
||||
|
||||
# cheating
|
||||
gcov:
|
||||
${MAKE} ${MFLAGS} CFLAGS=-g ADDON_CFLAGS='${GCOV_XCFLAGS}' ADDON_LDFLAGS='${GCOV_XLDFLAGS}' .made
|
||||
|
||||
|
||||
# have to make this separate because making tests depend on $(PROGRAM)
|
||||
asan-tests: asan $(TESTS_SUPPORT)
|
||||
@-test -d tests || mkdir tests
|
||||
@@ -645,6 +654,13 @@ asan-tests: asan $(TESTS_SUPPORT)
|
||||
@( cd $(srcdir)/tests && \
|
||||
BUILD_DIR=$(BUILD_DIR) PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
|
||||
|
||||
# have to make this separate because making tests depend on $(PROGRAM)
|
||||
lsan-tests: lsan $(TESTS_SUPPORT)
|
||||
@-test -d tests || mkdir tests
|
||||
@cp $(TESTS_SUPPORT) tests
|
||||
@( cd $(srcdir)/tests && \
|
||||
BUILD_DIR=$(BUILD_DIR) PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
|
||||
|
||||
profiling-tests: ${PROGRAM}
|
||||
@test "X$$PROFILE_FLAGS" == "X" && { echo "profiling-tests: must be built with profiling enabled" >&2; exit 1; }
|
||||
@${MAKE} ${MFLAGS} tests TESTSCRIPT=run-gprof
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Thu Dec 21 09:29:52 EST 2023
|
||||
.\" Last Change: Fri Jan 5 11:02:00 EST 2024
|
||||
.\"
|
||||
.TH READLINE 3 "2023 December 21" "GNU Readline 8.3"
|
||||
.TH READLINE 3 "2024 January 5" "GNU Readline 8.3"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -34,8 +34,8 @@ readline \- get a line from a user with editing
|
||||
\fBreadline\fP (\fIconst char *prompt\fP);
|
||||
.fi
|
||||
.SH COPYRIGHT
|
||||
.if n Readline is Copyright (C) 1989\-2023 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2023 Free Software Foundation, Inc.
|
||||
.if n Readline is Copyright (C) 1989\-2024 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2024 Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
.LP
|
||||
.B readline
|
||||
@@ -50,6 +50,9 @@ The line returned is allocated with
|
||||
the caller must free it when finished. The line returned
|
||||
has the final newline removed, so only the text of the line
|
||||
remains.
|
||||
Since it's possible to enter characters into the line while quoting
|
||||
them to disable any \fBreadline\fP editing function they might normally have,
|
||||
this line may include embedded newlines and other special characters.
|
||||
.LP
|
||||
.B readline
|
||||
offers editing capabilities while the user is entering the
|
||||
|
||||
@@ -67,6 +67,9 @@ the simplest way possible, perhaps to replace calls in your code to
|
||||
|
||||
The function @code{readline()} prints a prompt @var{prompt}
|
||||
and then reads and returns a single line of text from the user.
|
||||
Since it's possible to enter characters into the line while quoting
|
||||
them to disable any Readline editing function they might normally have,
|
||||
this line may include embedded newlines and other special characters.
|
||||
If @var{prompt} is @code{NULL} or the empty string, no prompt is displayed.
|
||||
The line @code{readline} returns is allocated with @code{malloc()};
|
||||
the caller should @code{free()} the line when it has finished with it.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2024 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 8.3
|
||||
@set VERSION 8.3
|
||||
|
||||
@set UPDATED 14 December 2023
|
||||
@set UPDATED-MONTH December 2023
|
||||
@set UPDATED 5 January 2024
|
||||
@set UPDATED-MONTH January 2024
|
||||
|
||||
@set LASTCHANGE Thu Dec 14 15:45:46 EST 2023
|
||||
@set LASTCHANGE Fri Jan 5 11:01:44 EST 2024
|
||||
|
||||
@@ -6894,6 +6894,7 @@ parse_string_to_word_list (char *s, int flags, const char *whom)
|
||||
orig_current_token = current_token;
|
||||
current_token = tok;
|
||||
yyerror (NULL); /* does the right thing */
|
||||
ps.pushed_strings = NULL; /* freed by reset_parser */
|
||||
current_token = orig_current_token;
|
||||
if (wl)
|
||||
dispose_words (wl);
|
||||
@@ -6980,8 +6981,12 @@ parse_compound_assignment (size_t *retlenp)
|
||||
current_token = tok; /* for error reporting */
|
||||
if (tok == yacc_EOF) /* ( */
|
||||
parser_error (orig_line_number, _("unexpected EOF while looking for matching `)'"));
|
||||
/* XXX - reset_parser here, even at EOF? */
|
||||
else
|
||||
yyerror(NULL); /* does the right thing */
|
||||
{
|
||||
yyerror(NULL); /* does the right thing */
|
||||
ps.pushed_strings = NULL; /* freed by reset_parser */
|
||||
}
|
||||
if (wl)
|
||||
dispose_words (wl);
|
||||
wl = &parse_string_error;
|
||||
|
||||
Binary file not shown.
+8
-8
@@ -9,7 +9,7 @@
|
||||
# liushuyu <liushuyu011@gmail.com>, 2016.
|
||||
# Mingye Wang <arthur200126@gmail.com>, 2015, 2016.
|
||||
# Boyuan Yang <073plan@gmail.com>, 2018, 2019, 2020.
|
||||
# Wenbin Lv <wenbin816@gmail.com>, 2021, 2022.
|
||||
# Wenbin Lv <wenbin816@gmail.com>, 2021, 2022, 2024.
|
||||
#
|
||||
# 本翻译目前采用的格式约定,和其他注意事项:
|
||||
#
|
||||
@@ -26,7 +26,7 @@ msgstr ""
|
||||
"Project-Id-Version: bash 5.2-rc1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-01-11 14:50-0500\n"
|
||||
"PO-Revision-Date: 2022-06-18 14:25+0800\n"
|
||||
"PO-Revision-Date: 2024-01-09 22:43+0800\n"
|
||||
"Last-Translator: Wenbin Lv <wenbin816@gmail.com>\n"
|
||||
"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
|
||||
"Language: zh_CN\n"
|
||||
@@ -171,7 +171,7 @@ msgstr ""
|
||||
" \n"
|
||||
" 不带有 <表达式> 时,返回 \"$line $filename\"。带有 <表达式> 时,\n"
|
||||
" 返回 \"$line $subroutine $filename\";这个额外的信息可以用来提供\n"
|
||||
" 栈跟踪 (stack trace)。\n"
|
||||
" 栈追踪 (stack trace)。\n"
|
||||
" \n"
|
||||
" <表达式> 的值表示从当前调用帧需要回去多少个调用帧;栈顶帧是第 0 帧。"
|
||||
|
||||
@@ -1814,7 +1814,7 @@ msgstr "非法指令"
|
||||
|
||||
#: siglist.c:67
|
||||
msgid "BPT trace/trap"
|
||||
msgstr "断点跟踪或陷阱"
|
||||
msgstr "断点追踪或陷阱"
|
||||
|
||||
#: siglist.c:75
|
||||
msgid "ABORT instruction"
|
||||
@@ -2190,7 +2190,7 @@ msgstr "%s: %s: 无法作为 FILE 打开"
|
||||
#: variables.c:6405
|
||||
#, c-format
|
||||
msgid "%s: %s: invalid value for trace file descriptor"
|
||||
msgstr "%s: %s: 跟踪文件描述符的值无效"
|
||||
msgstr "%s: %s: 追踪文件描述符的值无效"
|
||||
|
||||
#: variables.c:6450
|
||||
#, c-format
|
||||
@@ -2725,7 +2725,7 @@ msgstr ""
|
||||
" \n"
|
||||
" 不带有 <表达式> 时,返回 \"$line $filename\"。带有 <表达式> 时,\n"
|
||||
" 返回 \"$line $subroutine $filename\";这个额外的信息可以用来提供\n"
|
||||
" 栈跟踪 (stack trace)。\n"
|
||||
" 栈追踪 (stack trace)。\n"
|
||||
" \n"
|
||||
" <表达式> 的值表示从当前调用帧需要回去多少个调用帧;栈顶帧是第 0 帧。\n"
|
||||
" \n"
|
||||
@@ -2949,7 +2949,7 @@ msgstr ""
|
||||
" -l\t将 <名称> 的值在赋值时转换为小写\n"
|
||||
" -n\t使 <名称> 成为一个对以它的值为名称的变量的引用\n"
|
||||
" -r\t将 <名称> 变为只读\n"
|
||||
" -t\t使 <名称> 带有 \"跟踪\" (trace) 属性\n"
|
||||
" -t\t使 <名称> 带有 \"追踪\" (trace) 属性\n"
|
||||
" -u\t使 <名称> 的值在赋值时转换为大写\n"
|
||||
" -x\t将 <名称> 导出\n"
|
||||
" \n"
|
||||
@@ -3126,7 +3126,7 @@ msgstr ""
|
||||
" -s\t仅打印 Posix \"特殊\" 内建的名称\n"
|
||||
" \n"
|
||||
" 控制动态加载的选项:\n"
|
||||
" -f\t从共享对象 <文件名> 中加载 <名称> 内建\n"
|
||||
" -f\t从共享目标 <文件名> 中加载 <名称> 内建\n"
|
||||
" -d\t删除以 -f 选项加载的内建\n"
|
||||
" \n"
|
||||
" 不带选项时,启用每一个 <名称>。\n"
|
||||
|
||||
+9
-1
@@ -759,10 +759,18 @@ print_case_command (CASE_COM *case_command)
|
||||
static void
|
||||
print_case_clauses (PATTERN_LIST *clauses)
|
||||
{
|
||||
int first = 1;
|
||||
|
||||
indentation += indentation_amount;
|
||||
while (clauses)
|
||||
{
|
||||
newline ("");
|
||||
/* If we're printing a comsub, the result will be reparsed later, so
|
||||
we don't want to insert a newline after the `in': that could cause
|
||||
the parser to parse a reserved word in error, since the newline
|
||||
inserts a token after the `in'. */
|
||||
if (printing_comsub == 0 || first == 0)
|
||||
newline ("");
|
||||
first = 0;
|
||||
command_print_word_list (clauses->patterns, " | ");
|
||||
cprintf (")\n");
|
||||
indentation += indentation_amount;
|
||||
|
||||
Reference in New Issue
Block a user