diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 7ca101a7..5e88f380 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -4276,6 +4276,11 @@ expr.c subscripts if the shell compatibility level is greater than 51. Prompted by report from Corey Hickey +subst.c + - string_list_pos_params, param_expand: make sure that $* is treated + the same as "$*" in here-document bodies that are being expanded. + From https://lists.gnu.org/archive/html/bug-bash/2022-09/msg00002.html + 11/1 ---- lib/readline/readline.c @@ -6750,4 +6755,45 @@ variables.c - push_posix_tempvar_internal: call arrayar_copyval instead of using inline code + 6/19 + ---- +lib/sh/shmatch.c + - sh_regmatch: use builtin_find_indexed_array to allow a local copy + of BASH_REMATCH. + From https://lists.gnu.org/archive/html/bug-bash/2022-05/msg00052.html + +execute_cmd.c + - execute_in_subshell: tentative change to clear procsub list after + performing redirections, so nothing in a redirection can affect + what's in the subshell. + From https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00114.html + +test.c + - binary_operator: in posix mode, the < and > operators compare strings + using the current locale (strcoll). + From https://www.austingroupbugs.net/view.php?id=375 + +bashline.c + - bash_default_completion: make sure that command completion adds the + trailing `/' suffix for directories even if the directory name is + the same as the common prefix of matches. + From https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00034.html + +lib/readline/kill.c + - rl_vi_yank_pop: make repeated invocations of vi-yank-pop cycle + through the kill ring just like in emacs mode, even when point + is at the end of the line. + From https://lists.gnu.org/archive/html/bug-bash/2022-08/msg00105.html + +parse.y + - parse_comsub: set variables if the last token (last_read_token) is + `;', `\n', or `&', in addition to was_word + - parse_comsub: if the last read token was a newline (was_newline), + terminate the comsub with a newline instead of a semicolon; keeps + the line numbers more consistent. + From a report by Grisha Levit + +lib/sh/anonfile.c + - anonopen: use memfd_create if it is available, fall through to + traditional Unix/POSIX implementation if it fails diff --git a/POSIX b/POSIX index b5b21d88..b6d410a0 100644 --- a/POSIX +++ b/POSIX @@ -313,7 +313,10 @@ The following list is what's changed when 'POSIX mode' is in effect: that a backslash preceding a double quote character will escape it and the backslash will be removed. - 66. Command substitutions don't set the '?' special parameter. The + 66. The 'test' builtin compares strings using the current locale when + processing the '<' and '>' binary operators. + + 67. Command substitutions don't set the '?' special parameter. The exit status of a simple command without a command word is still the exit status of the last command substitution that occurred while evaluating the variable assignments and redirections in that diff --git a/bashline.c b/bashline.c index 6adc548e..80f68603 100644 --- a/bashline.c +++ b/bashline.c @@ -1863,8 +1863,7 @@ bash_default_completion (const char *text, int start, int end, int qc, int compf rl_completion_suppress_append = 1; rl_filename_completion_desired = 0; } -#if 0 - /* TAG:bash-5.3 jidanni@jidanni.org 11/11/2022 */ +#if 1 else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && matches[2] && STREQ (matches[1], matches[2]) && CMD_IS_DIR (matches[0])) #else diff --git a/doc/bash.info b/doc/bash.info index 3077b1d0..0136f129 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -7487,7 +7487,10 @@ startup files. that a backslash preceding a double quote character will escape it and the backslash will be removed. - 66. Command substitutions don't set the '?' special parameter. The + 66. The 'test' builtin compares strings using the current locale when + processing the '<' and '>' binary operators. + + 67. Command substitutions don't set the '?' special parameter. The exit status of a simple command without a command word is still the exit status of the last command substitution that occurred while evaluating the variable assignments and redirections in that @@ -12865,61 +12868,61 @@ Node: Directory Stack Builtins296813 Node: Controlling the Prompt301070 Node: The Restricted Shell304032 Node: Bash POSIX Mode306639 -Node: Shell Compatibility Mode322429 -Node: Job Control330670 -Node: Job Control Basics331127 -Node: Job Control Builtins336126 -Node: Job Control Variables341918 -Node: Command Line Editing343071 -Node: Introduction and Notation344739 -Node: Readline Interaction346359 -Node: Readline Bare Essentials347547 -Node: Readline Movement Commands349333 -Node: Readline Killing Commands350290 -Node: Readline Arguments352208 -Node: Searching353249 -Node: Readline Init File355432 -Node: Readline Init File Syntax356690 -Node: Conditional Init Constructs380478 -Node: Sample Init File384671 -Node: Bindable Readline Commands387792 -Node: Commands For Moving388993 -Node: Commands For History391041 -Node: Commands For Text396032 -Node: Commands For Killing399678 -Node: Numeric Arguments402708 -Node: Commands For Completion403844 -Node: Keyboard Macros408032 -Node: Miscellaneous Commands408717 -Node: Readline vi Mode414752 -Node: Programmable Completion415656 -Node: Programmable Completion Builtins423433 -Node: A Programmable Completion Example434550 -Node: Using History Interactively439795 -Node: Bash History Facilities440476 -Node: Bash History Builtins443478 -Node: History Interaction448499 -Node: Event Designators452116 -Node: Word Designators453467 -Node: Modifiers455224 -Node: Installing Bash457029 -Node: Basic Installation458163 -Node: Compilers and Options461882 -Node: Compiling For Multiple Architectures462620 -Node: Installation Names464309 -Node: Specifying the System Type466415 -Node: Sharing Defaults467129 -Node: Operation Controls467799 -Node: Optional Features468754 -Node: Reporting Bugs479970 -Node: Major Differences From The Bourne Shell481301 -Node: GNU Free Documentation License498147 -Node: Indexes523321 -Node: Builtin Index523772 -Node: Reserved Word Index530870 -Node: Variable Index533315 -Node: Function Index550446 -Node: Concept Index564227 +Node: Shell Compatibility Mode322552 +Node: Job Control330793 +Node: Job Control Basics331250 +Node: Job Control Builtins336249 +Node: Job Control Variables342041 +Node: Command Line Editing343194 +Node: Introduction and Notation344862 +Node: Readline Interaction346482 +Node: Readline Bare Essentials347670 +Node: Readline Movement Commands349456 +Node: Readline Killing Commands350413 +Node: Readline Arguments352331 +Node: Searching353372 +Node: Readline Init File355555 +Node: Readline Init File Syntax356813 +Node: Conditional Init Constructs380601 +Node: Sample Init File384794 +Node: Bindable Readline Commands387915 +Node: Commands For Moving389116 +Node: Commands For History391164 +Node: Commands For Text396155 +Node: Commands For Killing399801 +Node: Numeric Arguments402831 +Node: Commands For Completion403967 +Node: Keyboard Macros408155 +Node: Miscellaneous Commands408840 +Node: Readline vi Mode414875 +Node: Programmable Completion415779 +Node: Programmable Completion Builtins423556 +Node: A Programmable Completion Example434673 +Node: Using History Interactively439918 +Node: Bash History Facilities440599 +Node: Bash History Builtins443601 +Node: History Interaction448622 +Node: Event Designators452239 +Node: Word Designators453590 +Node: Modifiers455347 +Node: Installing Bash457152 +Node: Basic Installation458286 +Node: Compilers and Options462005 +Node: Compiling For Multiple Architectures462743 +Node: Installation Names464432 +Node: Specifying the System Type466538 +Node: Sharing Defaults467252 +Node: Operation Controls467922 +Node: Optional Features468877 +Node: Reporting Bugs480093 +Node: Major Differences From The Bourne Shell481424 +Node: GNU Free Documentation License498270 +Node: Indexes523444 +Node: Builtin Index523895 +Node: Reserved Word Index530993 +Node: Variable Index533438 +Node: Function Index550569 +Node: Concept Index564350  End Tag Table diff --git a/doc/bashref.info b/doc/bashref.info index 31a7e346..033ecca3 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -7488,7 +7488,10 @@ startup files. that a backslash preceding a double quote character will escape it and the backslash will be removed. - 66. Command substitutions don't set the '?' special parameter. The + 66. The 'test' builtin compares strings using the current locale when + processing the '<' and '>' binary operators. + + 67. Command substitutions don't set the '?' special parameter. The exit status of a simple command without a command word is still the exit status of the last command substitution that occurred while evaluating the variable assignments and redirections in that @@ -12866,61 +12869,61 @@ Node: Directory Stack Builtins297035 Node: Controlling the Prompt301295 Node: The Restricted Shell304260 Node: Bash POSIX Mode306870 -Node: Shell Compatibility Mode322663 -Node: Job Control330907 -Node: Job Control Basics331367 -Node: Job Control Builtins336369 -Node: Job Control Variables342164 -Node: Command Line Editing343320 -Node: Introduction and Notation344991 -Node: Readline Interaction346614 -Node: Readline Bare Essentials347805 -Node: Readline Movement Commands349594 -Node: Readline Killing Commands350554 -Node: Readline Arguments352475 -Node: Searching353519 -Node: Readline Init File355705 -Node: Readline Init File Syntax356966 -Node: Conditional Init Constructs380757 -Node: Sample Init File384953 -Node: Bindable Readline Commands388077 -Node: Commands For Moving389281 -Node: Commands For History391332 -Node: Commands For Text396326 -Node: Commands For Killing399975 -Node: Numeric Arguments403008 -Node: Commands For Completion404147 -Node: Keyboard Macros408338 -Node: Miscellaneous Commands409026 -Node: Readline vi Mode415064 -Node: Programmable Completion415971 -Node: Programmable Completion Builtins423751 -Node: A Programmable Completion Example434871 -Node: Using History Interactively440119 -Node: Bash History Facilities440803 -Node: Bash History Builtins443808 -Node: History Interaction448832 -Node: Event Designators452452 -Node: Word Designators453806 -Node: Modifiers455566 -Node: Installing Bash457374 -Node: Basic Installation458511 -Node: Compilers and Options462233 -Node: Compiling For Multiple Architectures462974 -Node: Installation Names464666 -Node: Specifying the System Type466775 -Node: Sharing Defaults467492 -Node: Operation Controls468165 -Node: Optional Features469123 -Node: Reporting Bugs480342 -Node: Major Differences From The Bourne Shell481676 -Node: GNU Free Documentation License498525 -Node: Indexes523702 -Node: Builtin Index524156 -Node: Reserved Word Index531257 -Node: Variable Index533705 -Node: Function Index550839 -Node: Concept Index564623 +Node: Shell Compatibility Mode322786 +Node: Job Control331030 +Node: Job Control Basics331490 +Node: Job Control Builtins336492 +Node: Job Control Variables342287 +Node: Command Line Editing343443 +Node: Introduction and Notation345114 +Node: Readline Interaction346737 +Node: Readline Bare Essentials347928 +Node: Readline Movement Commands349717 +Node: Readline Killing Commands350677 +Node: Readline Arguments352598 +Node: Searching353642 +Node: Readline Init File355828 +Node: Readline Init File Syntax357089 +Node: Conditional Init Constructs380880 +Node: Sample Init File385076 +Node: Bindable Readline Commands388200 +Node: Commands For Moving389404 +Node: Commands For History391455 +Node: Commands For Text396449 +Node: Commands For Killing400098 +Node: Numeric Arguments403131 +Node: Commands For Completion404270 +Node: Keyboard Macros408461 +Node: Miscellaneous Commands409149 +Node: Readline vi Mode415187 +Node: Programmable Completion416094 +Node: Programmable Completion Builtins423874 +Node: A Programmable Completion Example434994 +Node: Using History Interactively440242 +Node: Bash History Facilities440926 +Node: Bash History Builtins443931 +Node: History Interaction448955 +Node: Event Designators452575 +Node: Word Designators453929 +Node: Modifiers455689 +Node: Installing Bash457497 +Node: Basic Installation458634 +Node: Compilers and Options462356 +Node: Compiling For Multiple Architectures463097 +Node: Installation Names464789 +Node: Specifying the System Type466898 +Node: Sharing Defaults467615 +Node: Operation Controls468288 +Node: Optional Features469246 +Node: Reporting Bugs480465 +Node: Major Differences From The Bourne Shell481799 +Node: GNU Free Documentation License498648 +Node: Indexes523825 +Node: Builtin Index524279 +Node: Reserved Word Index531380 +Node: Variable Index533828 +Node: Function Index550962 +Node: Concept Index564746  End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index 4b0082c2..c37300d5 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -8694,6 +8694,10 @@ undergoes expansion. That means, for example, that a backslash preceding a double quote character will escape it and the backslash will be removed. +@item +The @code{test} builtin compares strings using the current locale when +processing the @samp{<} and @samp{>} binary operators. + @item Command substitutions don't set the @samp{?} special parameter. The exit status of a simple command without a command word is still the exit status diff --git a/execute_cmd.c b/execute_cmd.c index 7d3711ec..6bc572c7 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -1705,9 +1705,8 @@ execute_in_subshell (COMMAND *command, int asynchronous, int pipe_in, int pipe_o dispose_redirects (command->redirects); command->redirects = (REDIRECT *)NULL; -#if 0 +#if 1 #if defined (PROCESS_SUBSTITUTION) && defined (JOB_CONTROL) - /* TAG: bash-5.3 kre 10/24/2022 */ if (user_subshell && command->type == cm_subshell) { procsub_clear (); diff --git a/lib/readline/kill.c b/lib/readline/kill.c index 1dfe3c57..0ba59ce5 100644 --- a/lib/readline/kill.c +++ b/lib/readline/kill.c @@ -569,7 +569,7 @@ rl_vi_yank_pop (int count, int key) } l = strlen (rl_kill_ring[rl_kill_index]); -#if 0 /* TAG:readline-8.3 8/29/2022 matteopaolini1995@gmail.com */ +#if 1 origpoint = rl_point; n = rl_point - l + 1; #else @@ -577,7 +577,7 @@ rl_vi_yank_pop (int count, int key) #endif if (n >= 0 && STREQN (rl_line_buffer + n, rl_kill_ring[rl_kill_index], l)) { -#if 0 /* TAG:readline-8.3 */ +#if 1 rl_delete_text (n, n + l); /* remember vi cursor positioning */ rl_point = origpoint - l; #else diff --git a/lib/sh/anonfile.c b/lib/sh/anonfile.c index febc778f..560b8c86 100644 --- a/lib/sh/anonfile.c +++ b/lib/sh/anonfile.c @@ -51,6 +51,15 @@ anonopen (const char *name, int flags, char **fn) { int fd, flag; +#if defined (HAVE_MEMFD_CREATE) + /* "Names do not affect the behavior of the file descriptor." */ + fd = memfd_create ("anonopen", 0); + if (fd >= 0) + return fd; + /* If memfd_create fails, we fall through to the unlinked-regular-file + implementation. */ +#endif + /* Heuristic */ flag = (name && *name == '/') ? MT_TEMPLATE : MT_USETMPDIR; fd = sh_mktmpfd (name, flag|MT_USERANDOM|MT_READWRITE|MT_UNLINK, fn); diff --git a/lib/sh/shmatch.c b/lib/sh/shmatch.c index 6bcfc603..4262e656 100644 --- a/lib/sh/shmatch.c +++ b/lib/sh/shmatch.c @@ -93,11 +93,11 @@ sh_regmatch (const char *string, const char *pattern, int flags) /* Store the parenthesized subexpressions in the array BASH_REMATCH. Element 0 is the portion that matched the entire regexp. Element 1 is the part that matched the first subexpression, and so on. */ -#if 1 +#if 0 + /* This was the pre-bash-5.3 code. */ unbind_global_variable_noref ("BASH_REMATCH"); rematch = make_new_array_variable ("BASH_REMATCH"); #else - /* TAG:bash-5.3 */ rematch = builtin_find_indexed_array ("BASH_REMATCH", 1); #endif amatch = rematch ? array_cell (rematch) : (ARRAY *)0; diff --git a/parse.y b/parse.y index c139a4d7..c08b77f6 100644 --- a/parse.y +++ b/parse.y @@ -4297,7 +4297,8 @@ static char * parse_comsub (int qc, int open, int close, size_t *lenp, int flags) { int peekc, r; - int start_lineno, dolbrace_spec, local_extglob, was_extpat, was_word; + int start_lineno, dolbrace_spec, local_extglob, was_extpat; + int was_word, was_newline, was_semi, was_amp; char *ret, *tcmd; size_t retlen; sh_parser_state_t ps; @@ -4342,7 +4343,7 @@ parse_comsub (int qc, int open, int close, size_t *lenp, int flags) save_parser_state (&ps); was_extpat = (parser_state & PST_EXTPAT); - was_word = 0; + was_word = was_newline = was_semi = was_amp = 0; /* State flags we don't want to persist into command substitutions. */ parser_state &= ~(PST_REGEXP|PST_EXTPAT|PST_CONDCMD|PST_CONDEXPR|PST_COMPASSIGN); @@ -4390,10 +4391,14 @@ parse_comsub (int qc, int open, int close, size_t *lenp, int flags) if (open == '{') { - if (current_token == shell_eof_token && - (last_read_token == ';' || last_read_token == '\n') && - (token_before_that == WORD || token_before_that == ASSIGNMENT_WORD)) - was_word = 1; + if (current_token == shell_eof_token) + { + was_semi = last_read_token == ';'; + was_newline = last_read_token == '\n'; + was_amp = last_read_token == '&'; + + was_word = (was_semi || was_newline) && (token_before_that == WORD || token_before_that == ASSIGNMENT_WORD); + } } if (need_here_doc > 0) @@ -4488,7 +4493,9 @@ INTERNAL_DEBUG(("current_token (%d) != shell_eof_token (%c)", current_token, she ret = xmalloc (retlen + 4); ret[0] = (dolbrace_spec == '|') ? '|' : ' '; strcpy (ret + 1, tcmd); /* ( */ - if (was_word) + if (was_newline) + ret[retlen++] = '\n'; + else if (was_word || was_semi) ret[retlen++] = ';'; else if (lastc != '\n' && lastc != ';' && lastc != '&') ret[retlen++] = ';'; diff --git a/subst.c b/subst.c index b93374b8..11e7a00c 100644 --- a/subst.c +++ b/subst.c @@ -3026,12 +3026,7 @@ string_list_pos_params (int pchar, WORD_LIST *list, int quoted, int pflags) { tlist = quote_list (list); word_list_remove_quoted_nulls (tlist); -#if 0 - ret = string_list (tlist); -#else - /* TAG:bash-5.3 Aloxaf Yin 9/1/2022 */ ret = string_list_dollar_star (tlist, 0, 0); -#endif } else if (pchar == '*' && quoted == 0 && ifs_is_null) /* XXX */ ret = expand_no_split_dollar_star ? string_list_dollar_star (list, quoted, 0) : string_list_dollar_at (list, quoted, 0); /* Posix interp 888 */ @@ -10456,12 +10451,7 @@ param_expand (char *string, int *sindex, int quoted, quote the whole string, including the separators. If IFS is unset, the parameters are separated by ' '; if $IFS is null, the parameters are concatenated. */ -#if 0 - temp = (quoted & (Q_DOUBLE_QUOTES|Q_PATQUOTE)) ? string_list_dollar_star (list, quoted, 0) : string_list (list); -#else - /* TAG:bash-5.3 Aloxaf Yin 9/1/2022 */ temp = string_list_dollar_star (list, quoted, 0); -#endif if (temp) { temp1 = (quoted & Q_DOUBLE_QUOTES) ? quote_string (temp) : temp; diff --git a/test.c b/test.c index 114941cc..2b12197a 100644 --- a/test.c +++ b/test.c @@ -436,7 +436,7 @@ binary_operator (void) ((w[0] == '>' || w[0] == '<') && w[1] == '\0') || /* <, > */ (w[0] == '!' && w[1] == '=' && w[2] == '\0')) /* != */ { -#if 0 /* TAG: bash-5.3 POSIX interp 375 11/9/2022 */ +#if 1 /* POSIX interp 375 11/9/2022 */ value = binary_test (w, argv[pos], argv[pos + 2], (posixly_correct ? TEST_LOCALE : 0)); #else value = binary_test (w, argv[pos], argv[pos + 2], 0);