diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 63145c3d..f298c057 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -7603,7 +7603,7 @@ test.h execute_cmd.c - execute_cond_node: call cond_test instead of binary_test or unary_test. - From a report and patch fro Grisha Levit + From a report and patch from Grisha Levit doc/bash.1,doc/bashref.texi - hash: add some text about the mutual exclusivity of the -t, -p, and @@ -7705,3 +7705,32 @@ builtins/history.def subst.c - array_length_reference: include the open bracket in the error message passed to err_badarraysub; it looks cleaner + + 10/2 + ---- +jobs.c + - delete_all_jobs: if we are clearing the jobs list, reset the stats + about running and dead jobs and child processes + Report from Koichi Murase + + 10/4 + ---- +lib/readline/complete.c + - rl_completion_rewrite_hook: rewrite hook applied to the completion + word before comparing against the possible completions from the + file system (modified by rl_filename_rewrite_hook) + - rl_filename_completion_function: call rl_completion_rewrite_hook, + if set by the calling application, on the filename portion of the + word to be completed + +lib/readline/readline.h + - rl_completion_rewrite_hook: extern declaration + +bashline.c + - bash_set_filename_hooks: set rl_completion_rewrite_hook to + bash_filename_rewrite_hook now that we've separated them + From a report and patch from Grisha Levit ; + original report from Stefan H. Holek + +lib/readline/doc/rltech.texi + - rl_completion_rewrite_hook: document diff --git a/POSIX b/POSIX index b6d410a0..2018afa8 100644 --- a/POSIX +++ b/POSIX @@ -98,7 +98,7 @@ The following list is what's changed when 'POSIX mode' is in effect: command name, rather than on all assignment statements on the line. 12. The default history file is '~/.sh_history' (this is the default - value of '$HISTFILE'). + value the shell assigns to '$HISTFILE'). 13. Redirection operators do not perform filename expansion on the word in the redirection unless the shell is interactive. @@ -119,7 +119,8 @@ The following list is what's changed when 'POSIX mode' is in effect: whose name contains one or more slashes. 18. POSIX special builtins are found before shell functions during - command lookup. + command lookup, including output printed by the 'type' and + 'command' builtins. 19. When printing shell function definitions (e.g., by 'type'), Bash does not print the 'function' keyword. @@ -171,7 +172,8 @@ The following list is what's changed when 'POSIX mode' is in effect: 29. A non-interactive shell exits with an error status if the iteration variable in a 'for' statement or the selection variable - in a 'select' statement is a readonly variable. + in a 'select' statement is a readonly variable or has an invalid + name. 30. Non-interactive shells exit if FILENAME in '.' FILENAME is not found. @@ -316,7 +318,12 @@ The following list is what's changed when 'POSIX mode' is in effect: 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 + 67. The 'test' builtin's '-t' unary primary requires an argument. + Historical versions of 'test' made the argument optional in certain + cases, and Bash attempts to accommodate those for backwards + compatibility. + + 68. 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 2c0ffaa8..1667b48d 100644 --- a/bashline.c +++ b/bashline.c @@ -3338,6 +3338,7 @@ bashline_set_filename_hooks (void) set_directory_hook (); rl_filename_rewrite_hook = bash_filename_rewrite_hook; + rl_completion_rewrite_hook = bash_filename_rewrite_hook; rl_filename_stat_hook = bash_filename_stat_hook; } diff --git a/builtins/type.def b/builtins/type.def index a0d31929..6eaa3f03 100644 --- a/builtins/type.def +++ b/builtins/type.def @@ -1,7 +1,7 @@ This file is type.def, from which is created type.c. It implements the builtin "type" in Bash. -Copyright (C) 1987-2022 Free Software Foundation, Inc. +Copyright (C) 1987-2023 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -64,6 +64,7 @@ $END #include "../bashintl.h" #include "../shell.h" +#include "../builtins.h" #include "../parser.h" #include "../execute_cmd.h" #include "../findcmd.h" @@ -209,7 +210,7 @@ type_builtin (WORD_LIST *list) int describe_command (char *command, int dflags) { - int found, i, found_file, f, all; + int found, i, found_file, f, all, skipbuiltin; char *full_path, *x, *pathlist; SHELL_VAR *func; #if defined (ALIAS) @@ -258,6 +259,24 @@ describe_command (char *command, int dflags) return (1); } + /* In posix mode, we find special builtins before shell functions. */ + /* find_shell_builtin sets current_builtin as a side effect */ + skipbuiltin = 0; + if (posixly_correct && (dflags & CDESC_FORCE_PATH) == 0 && find_shell_builtin (command) != 0 && (current_builtin->flags & SPECIAL_BUILTIN)) + { + if (dflags & CDESC_TYPE) + puts ("builtin"); + else if (dflags & CDESC_SHORTDESC) + printf (_("%s is a special shell builtin\n"), command); + else if (dflags & CDESC_REUSABLE) + printf ("%s\n", command); + + skipbuiltin = found = 1; + + if (all == 0) + return (1); + } + /* Command is a function? */ if (((dflags & (CDESC_FORCE_PATH|CDESC_NOFUNCS)) == 0) && (func = find_function (command))) { @@ -284,13 +303,14 @@ describe_command (char *command, int dflags) } /* Command is a builtin? */ - if (((dflags & CDESC_FORCE_PATH) == 0) && find_shell_builtin (command)) + /* find_shell_builtin sets current_builtin as a side effect */ + if (skipbuiltin == 0 && ((dflags & CDESC_FORCE_PATH) == 0) && find_shell_builtin (command)) { if (dflags & CDESC_TYPE) puts ("builtin"); else if (dflags & CDESC_SHORTDESC) { - if (posixly_correct && find_special_builtin (command) != 0) + if (posixly_correct && (current_builtin->flags & SPECIAL_BUILTIN)) printf (_("%s is a special shell builtin\n"), command); else printf (_("%s is a shell builtin\n"), command); diff --git a/doc/bash.info b/doc/bash.info index e32020b5..002986f5 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -1,9 +1,9 @@ This is bash.info, produced by makeinfo version 6.8 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.3, 13 September 2023). +Bash shell (version 5.3, 2 October 2023). - This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash + This is Edition 5.3, last updated 2 October 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.3. Copyright (C) 1988-2023 Free Software Foundation, Inc. @@ -26,10 +26,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.3, 13 September 2023). The Bash home page is +Bash shell (version 5.3, 2 October 2023). The Bash home page is . - This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash + This is Edition 5.3, last updated 2 October 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.3. Bash contains features that appear in other popular shells, and some @@ -7356,7 +7356,8 @@ startup files. whose name contains one or more slashes. 18. POSIX special builtins are found before shell functions during - command lookup. + command lookup, including output printed by the 'type' and + 'command' builtins. 19. When printing shell function definitions (e.g., by 'type'), Bash does not print the 'function' keyword. @@ -7408,7 +7409,8 @@ startup files. 29. A non-interactive shell exits with an error status if the iteration variable in a 'for' statement or the selection variable - in a 'select' statement is a readonly variable. + in a 'select' statement is a readonly variable or has an invalid + name. 30. Non-interactive shells exit if FILENAME in '.' FILENAME is not found. @@ -12873,138 +12875,138 @@ D.5 Concept Index  Tag Table: -Node: Top896 -Node: Introduction2815 -Node: What is Bash?3028 -Node: What is a shell?4139 -Node: Definitions6674 -Node: Basic Shell Features9622 -Node: Shell Syntax10838 -Node: Shell Operation11861 -Node: Quoting13151 -Node: Escape Character14452 -Node: Single Quotes14934 -Node: Double Quotes15279 -Node: ANSI-C Quoting16554 -Node: Locale Translation17863 -Node: Creating Internationalized Scripts19171 -Node: Comments23285 -Node: Shell Commands23900 -Node: Reserved Words24835 -Node: Simple Commands25588 -Node: Pipelines26239 -Node: Lists29222 -Node: Compound Commands31014 -Node: Looping Constructs32023 -Node: Conditional Constructs34515 -Node: Command Grouping49000 -Node: Coprocesses50475 -Node: GNU Parallel53135 -Node: Shell Functions54049 -Node: Shell Parameters61931 -Node: Positional Parameters66316 -Node: Special Parameters67215 -Node: Shell Expansions70426 -Node: Brace Expansion72511 -Node: Tilde Expansion75242 -Node: Shell Parameter Expansion77860 -Node: Command Substitution96450 -Node: Arithmetic Expansion99911 -Node: Process Substitution100876 -Node: Word Splitting101993 -Node: Filename Expansion104038 -Node: Pattern Matching106968 -Node: Quote Removal111967 -Node: Redirections112259 -Node: Executing Commands121949 -Node: Simple Command Expansion122616 -Node: Command Search and Execution124723 -Node: Command Execution Environment127107 -Node: Environment130139 -Node: Exit Status131799 -Node: Signals133580 -Node: Shell Scripts137026 -Node: Shell Builtin Commands140050 -Node: Bourne Shell Builtins142085 -Node: Bash Builtins165474 -Node: Modifying Shell Behavior198410 -Node: The Set Builtin198752 -Node: The Shopt Builtin209723 -Node: Special Builtins225858 -Node: Shell Variables226834 -Node: Bourne Shell Variables227268 -Node: Bash Variables229369 -Node: Bash Features264425 -Node: Invoking Bash265435 -Node: Bash Startup Files271471 -Node: Interactive Shells276599 -Node: What is an Interactive Shell?277007 -Node: Is this Shell Interactive?277653 -Node: Interactive Shell Behavior278465 -Node: Bash Conditional Expressions282091 -Node: Shell Arithmetic287001 -Node: Aliases289959 -Node: Arrays292850 -Node: The Directory Stack299481 -Node: Directory Stack Builtins300262 -Node: Controlling the Prompt304519 -Node: The Restricted Shell307481 -Node: Bash POSIX Mode310088 -Node: Shell Compatibility Mode326246 -Node: Job Control334487 -Node: Job Control Basics334944 -Node: Job Control Builtins339943 -Node: Job Control Variables345735 -Node: Command Line Editing346888 -Node: Introduction and Notation348556 -Node: Readline Interaction350176 -Node: Readline Bare Essentials351364 -Node: Readline Movement Commands353150 -Node: Readline Killing Commands354107 -Node: Readline Arguments356025 -Node: Searching357066 -Node: Readline Init File359249 -Node: Readline Init File Syntax360507 -Node: Conditional Init Constructs384529 -Node: Sample Init File388722 -Node: Bindable Readline Commands391843 -Node: Commands For Moving393044 -Node: Commands For History395092 -Node: Commands For Text400083 -Node: Commands For Killing404058 -Node: Numeric Arguments406759 -Node: Commands For Completion407895 -Node: Keyboard Macros412083 -Node: Miscellaneous Commands412768 -Node: Readline vi Mode418803 -Node: Programmable Completion419707 -Node: Programmable Completion Builtins427484 -Node: A Programmable Completion Example438601 -Node: Using History Interactively443846 -Node: Bash History Facilities444527 -Node: Bash History Builtins447535 -Node: History Interaction452623 -Node: Event Designators456433 -Node: Word Designators457968 -Node: Modifiers459830 -Node: Installing Bash461635 -Node: Basic Installation462769 -Node: Compilers and Options466488 -Node: Compiling For Multiple Architectures467226 -Node: Installation Names468915 -Node: Specifying the System Type471021 -Node: Sharing Defaults471735 -Node: Operation Controls472405 -Node: Optional Features473360 -Node: Reporting Bugs484576 -Node: Major Differences From The Bourne Shell485907 -Node: GNU Free Documentation License502762 -Node: Indexes527936 -Node: Builtin Index528387 -Node: Reserved Word Index535485 -Node: Variable Index537930 -Node: Function Index555061 -Node: Concept Index568779 +Node: Top890 +Node: Introduction2803 +Node: What is Bash?3016 +Node: What is a shell?4127 +Node: Definitions6662 +Node: Basic Shell Features9610 +Node: Shell Syntax10826 +Node: Shell Operation11849 +Node: Quoting13139 +Node: Escape Character14440 +Node: Single Quotes14922 +Node: Double Quotes15267 +Node: ANSI-C Quoting16542 +Node: Locale Translation17851 +Node: Creating Internationalized Scripts19159 +Node: Comments23273 +Node: Shell Commands23888 +Node: Reserved Words24823 +Node: Simple Commands25576 +Node: Pipelines26227 +Node: Lists29210 +Node: Compound Commands31002 +Node: Looping Constructs32011 +Node: Conditional Constructs34503 +Node: Command Grouping48988 +Node: Coprocesses50463 +Node: GNU Parallel53123 +Node: Shell Functions54037 +Node: Shell Parameters61919 +Node: Positional Parameters66304 +Node: Special Parameters67203 +Node: Shell Expansions70414 +Node: Brace Expansion72499 +Node: Tilde Expansion75230 +Node: Shell Parameter Expansion77848 +Node: Command Substitution96438 +Node: Arithmetic Expansion99899 +Node: Process Substitution100864 +Node: Word Splitting101981 +Node: Filename Expansion104026 +Node: Pattern Matching106956 +Node: Quote Removal111955 +Node: Redirections112247 +Node: Executing Commands121937 +Node: Simple Command Expansion122604 +Node: Command Search and Execution124711 +Node: Command Execution Environment127095 +Node: Environment130127 +Node: Exit Status131787 +Node: Signals133568 +Node: Shell Scripts137014 +Node: Shell Builtin Commands140038 +Node: Bourne Shell Builtins142073 +Node: Bash Builtins165462 +Node: Modifying Shell Behavior198398 +Node: The Set Builtin198740 +Node: The Shopt Builtin209711 +Node: Special Builtins225846 +Node: Shell Variables226822 +Node: Bourne Shell Variables227256 +Node: Bash Variables229357 +Node: Bash Features264413 +Node: Invoking Bash265423 +Node: Bash Startup Files271459 +Node: Interactive Shells276587 +Node: What is an Interactive Shell?276995 +Node: Is this Shell Interactive?277641 +Node: Interactive Shell Behavior278453 +Node: Bash Conditional Expressions282079 +Node: Shell Arithmetic286989 +Node: Aliases289947 +Node: Arrays292838 +Node: The Directory Stack299469 +Node: Directory Stack Builtins300250 +Node: Controlling the Prompt304507 +Node: The Restricted Shell307469 +Node: Bash POSIX Mode310076 +Node: Shell Compatibility Mode326330 +Node: Job Control334571 +Node: Job Control Basics335028 +Node: Job Control Builtins340027 +Node: Job Control Variables345819 +Node: Command Line Editing346972 +Node: Introduction and Notation348640 +Node: Readline Interaction350260 +Node: Readline Bare Essentials351448 +Node: Readline Movement Commands353234 +Node: Readline Killing Commands354191 +Node: Readline Arguments356109 +Node: Searching357150 +Node: Readline Init File359333 +Node: Readline Init File Syntax360591 +Node: Conditional Init Constructs384613 +Node: Sample Init File388806 +Node: Bindable Readline Commands391927 +Node: Commands For Moving393128 +Node: Commands For History395176 +Node: Commands For Text400167 +Node: Commands For Killing404142 +Node: Numeric Arguments406843 +Node: Commands For Completion407979 +Node: Keyboard Macros412167 +Node: Miscellaneous Commands412852 +Node: Readline vi Mode418887 +Node: Programmable Completion419791 +Node: Programmable Completion Builtins427568 +Node: A Programmable Completion Example438685 +Node: Using History Interactively443930 +Node: Bash History Facilities444611 +Node: Bash History Builtins447619 +Node: History Interaction452707 +Node: Event Designators456517 +Node: Word Designators458052 +Node: Modifiers459914 +Node: Installing Bash461719 +Node: Basic Installation462853 +Node: Compilers and Options466572 +Node: Compiling For Multiple Architectures467310 +Node: Installation Names468999 +Node: Specifying the System Type471105 +Node: Sharing Defaults471819 +Node: Operation Controls472489 +Node: Optional Features473444 +Node: Reporting Bugs484660 +Node: Major Differences From The Bourne Shell485991 +Node: GNU Free Documentation License502846 +Node: Indexes528020 +Node: Builtin Index528471 +Node: Reserved Word Index535569 +Node: Variable Index538014 +Node: Function Index555145 +Node: Concept Index568863  End Tag Table diff --git a/doc/bashref.info b/doc/bashref.info index 784e867a..b808c6d1 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.3, 13 September 2023). +Bash shell (version 5.3, 2 October 2023). - This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash + This is Edition 5.3, last updated 2 October 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.3. Copyright (C) 1988-2023 Free Software Foundation, Inc. @@ -27,10 +27,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.3, 13 September 2023). The Bash home page is +Bash shell (version 5.3, 2 October 2023). The Bash home page is . - This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash + This is Edition 5.3, last updated 2 October 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.3. Bash contains features that appear in other popular shells, and some @@ -7357,7 +7357,8 @@ startup files. whose name contains one or more slashes. 18. POSIX special builtins are found before shell functions during - command lookup. + command lookup, including output printed by the 'type' and + 'command' builtins. 19. When printing shell function definitions (e.g., by 'type'), Bash does not print the 'function' keyword. @@ -7409,7 +7410,8 @@ startup files. 29. A non-interactive shell exits with an error status if the iteration variable in a 'for' statement or the selection variable - in a 'select' statement is a readonly variable. + in a 'select' statement is a readonly variable or has an invalid + name. 30. Non-interactive shells exit if FILENAME in '.' FILENAME is not found. @@ -12874,138 +12876,138 @@ D.5 Concept Index  Tag Table: -Node: Top899 -Node: Introduction2821 -Node: What is Bash?3037 -Node: What is a shell?4151 -Node: Definitions6689 -Node: Basic Shell Features9640 -Node: Shell Syntax10859 -Node: Shell Operation11885 -Node: Quoting13178 -Node: Escape Character14482 -Node: Single Quotes14967 -Node: Double Quotes15315 -Node: ANSI-C Quoting16593 -Node: Locale Translation17905 -Node: Creating Internationalized Scripts19216 -Node: Comments23333 -Node: Shell Commands23951 -Node: Reserved Words24889 -Node: Simple Commands25645 -Node: Pipelines26299 -Node: Lists29285 -Node: Compound Commands31080 -Node: Looping Constructs32092 -Node: Conditional Constructs34587 -Node: Command Grouping49075 -Node: Coprocesses50553 -Node: GNU Parallel53216 -Node: Shell Functions54133 -Node: Shell Parameters62018 -Node: Positional Parameters66406 -Node: Special Parameters67308 -Node: Shell Expansions70522 -Node: Brace Expansion72610 -Node: Tilde Expansion75344 -Node: Shell Parameter Expansion77965 -Node: Command Substitution96558 -Node: Arithmetic Expansion100022 -Node: Process Substitution100990 -Node: Word Splitting102110 -Node: Filename Expansion104158 -Node: Pattern Matching107091 -Node: Quote Removal112093 -Node: Redirections112388 -Node: Executing Commands122081 -Node: Simple Command Expansion122751 -Node: Command Search and Execution124861 -Node: Command Execution Environment127248 -Node: Environment130283 -Node: Exit Status131946 -Node: Signals133730 -Node: Shell Scripts137179 -Node: Shell Builtin Commands140206 -Node: Bourne Shell Builtins142244 -Node: Bash Builtins165636 -Node: Modifying Shell Behavior198575 -Node: The Set Builtin198920 -Node: The Shopt Builtin209894 -Node: Special Builtins226032 -Node: Shell Variables227011 -Node: Bourne Shell Variables227448 -Node: Bash Variables229552 -Node: Bash Features264611 -Node: Invoking Bash265624 -Node: Bash Startup Files271663 -Node: Interactive Shells276794 -Node: What is an Interactive Shell?277205 -Node: Is this Shell Interactive?277854 -Node: Interactive Shell Behavior278669 -Node: Bash Conditional Expressions282298 -Node: Shell Arithmetic287211 -Node: Aliases290172 -Node: Arrays293066 -Node: The Directory Stack299700 -Node: Directory Stack Builtins300484 -Node: Controlling the Prompt304744 -Node: The Restricted Shell307709 -Node: Bash POSIX Mode310319 -Node: Shell Compatibility Mode326480 -Node: Job Control334724 -Node: Job Control Basics335184 -Node: Job Control Builtins340186 -Node: Job Control Variables345981 -Node: Command Line Editing347137 -Node: Introduction and Notation348808 -Node: Readline Interaction350431 -Node: Readline Bare Essentials351622 -Node: Readline Movement Commands353411 -Node: Readline Killing Commands354371 -Node: Readline Arguments356292 -Node: Searching357336 -Node: Readline Init File359522 -Node: Readline Init File Syntax360783 -Node: Conditional Init Constructs384808 -Node: Sample Init File389004 -Node: Bindable Readline Commands392128 -Node: Commands For Moving393332 -Node: Commands For History395383 -Node: Commands For Text400377 -Node: Commands For Killing404355 -Node: Numeric Arguments407059 -Node: Commands For Completion408198 -Node: Keyboard Macros412389 -Node: Miscellaneous Commands413077 -Node: Readline vi Mode419115 -Node: Programmable Completion420022 -Node: Programmable Completion Builtins427802 -Node: A Programmable Completion Example438922 -Node: Using History Interactively444170 -Node: Bash History Facilities444854 -Node: Bash History Builtins447865 -Node: History Interaction452956 -Node: Event Designators456769 -Node: Word Designators458307 -Node: Modifiers460172 -Node: Installing Bash461980 -Node: Basic Installation463117 -Node: Compilers and Options466839 -Node: Compiling For Multiple Architectures467580 -Node: Installation Names469272 -Node: Specifying the System Type471381 -Node: Sharing Defaults472098 -Node: Operation Controls472771 -Node: Optional Features473729 -Node: Reporting Bugs484948 -Node: Major Differences From The Bourne Shell486282 -Node: GNU Free Documentation License503140 -Node: Indexes528317 -Node: Builtin Index528771 -Node: Reserved Word Index535872 -Node: Variable Index538320 -Node: Function Index555454 -Node: Concept Index569175 +Node: Top893 +Node: Introduction2809 +Node: What is Bash?3025 +Node: What is a shell?4139 +Node: Definitions6677 +Node: Basic Shell Features9628 +Node: Shell Syntax10847 +Node: Shell Operation11873 +Node: Quoting13166 +Node: Escape Character14470 +Node: Single Quotes14955 +Node: Double Quotes15303 +Node: ANSI-C Quoting16581 +Node: Locale Translation17893 +Node: Creating Internationalized Scripts19204 +Node: Comments23321 +Node: Shell Commands23939 +Node: Reserved Words24877 +Node: Simple Commands25633 +Node: Pipelines26287 +Node: Lists29273 +Node: Compound Commands31068 +Node: Looping Constructs32080 +Node: Conditional Constructs34575 +Node: Command Grouping49063 +Node: Coprocesses50541 +Node: GNU Parallel53204 +Node: Shell Functions54121 +Node: Shell Parameters62006 +Node: Positional Parameters66394 +Node: Special Parameters67296 +Node: Shell Expansions70510 +Node: Brace Expansion72598 +Node: Tilde Expansion75332 +Node: Shell Parameter Expansion77953 +Node: Command Substitution96546 +Node: Arithmetic Expansion100010 +Node: Process Substitution100978 +Node: Word Splitting102098 +Node: Filename Expansion104146 +Node: Pattern Matching107079 +Node: Quote Removal112081 +Node: Redirections112376 +Node: Executing Commands122069 +Node: Simple Command Expansion122739 +Node: Command Search and Execution124849 +Node: Command Execution Environment127236 +Node: Environment130271 +Node: Exit Status131934 +Node: Signals133718 +Node: Shell Scripts137167 +Node: Shell Builtin Commands140194 +Node: Bourne Shell Builtins142232 +Node: Bash Builtins165624 +Node: Modifying Shell Behavior198563 +Node: The Set Builtin198908 +Node: The Shopt Builtin209882 +Node: Special Builtins226020 +Node: Shell Variables226999 +Node: Bourne Shell Variables227436 +Node: Bash Variables229540 +Node: Bash Features264599 +Node: Invoking Bash265612 +Node: Bash Startup Files271651 +Node: Interactive Shells276782 +Node: What is an Interactive Shell?277193 +Node: Is this Shell Interactive?277842 +Node: Interactive Shell Behavior278657 +Node: Bash Conditional Expressions282286 +Node: Shell Arithmetic287199 +Node: Aliases290160 +Node: Arrays293054 +Node: The Directory Stack299688 +Node: Directory Stack Builtins300472 +Node: Controlling the Prompt304732 +Node: The Restricted Shell307697 +Node: Bash POSIX Mode310307 +Node: Shell Compatibility Mode326564 +Node: Job Control334808 +Node: Job Control Basics335268 +Node: Job Control Builtins340270 +Node: Job Control Variables346065 +Node: Command Line Editing347221 +Node: Introduction and Notation348892 +Node: Readline Interaction350515 +Node: Readline Bare Essentials351706 +Node: Readline Movement Commands353495 +Node: Readline Killing Commands354455 +Node: Readline Arguments356376 +Node: Searching357420 +Node: Readline Init File359606 +Node: Readline Init File Syntax360867 +Node: Conditional Init Constructs384892 +Node: Sample Init File389088 +Node: Bindable Readline Commands392212 +Node: Commands For Moving393416 +Node: Commands For History395467 +Node: Commands For Text400461 +Node: Commands For Killing404439 +Node: Numeric Arguments407143 +Node: Commands For Completion408282 +Node: Keyboard Macros412473 +Node: Miscellaneous Commands413161 +Node: Readline vi Mode419199 +Node: Programmable Completion420106 +Node: Programmable Completion Builtins427886 +Node: A Programmable Completion Example439006 +Node: Using History Interactively444254 +Node: Bash History Facilities444938 +Node: Bash History Builtins447949 +Node: History Interaction453040 +Node: Event Designators456853 +Node: Word Designators458391 +Node: Modifiers460256 +Node: Installing Bash462064 +Node: Basic Installation463201 +Node: Compilers and Options466923 +Node: Compiling For Multiple Architectures467664 +Node: Installation Names469356 +Node: Specifying the System Type471465 +Node: Sharing Defaults472182 +Node: Operation Controls472855 +Node: Optional Features473813 +Node: Reporting Bugs485032 +Node: Major Differences From The Bourne Shell486366 +Node: GNU Free Documentation License503224 +Node: Indexes528401 +Node: Builtin Index528855 +Node: Reserved Word Index535956 +Node: Variable Index538404 +Node: Function Index555538 +Node: Concept Index569259  End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index 156247ed..62ccdfeb 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -8528,7 +8528,8 @@ contains one or more slashes. @item @sc{posix} special builtins are found before shell functions -during command lookup. +during command lookup, including output printed by the @code{type} +and @code{command} builtins. @item When printing shell function definitions (e.g., by @code{type}), Bash does diff --git a/doc/version.texi b/doc/version.texi index 39118798..31183d38 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2023 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Wed Sep 13 15:38:31 EDT 2023 +@set LASTCHANGE Mon Oct 2 14:52:49 EDT 2023 @set EDITION 5.3 @set VERSION 5.3 -@set UPDATED 13 September 2023 -@set UPDATED-MONTH September 2023 +@set UPDATED 2 October 2023 +@set UPDATED-MONTH October 2023 diff --git a/jobs.c b/jobs.c index 7ccacede..b8373cf5 100644 --- a/jobs.c +++ b/jobs.c @@ -4702,7 +4702,8 @@ delete_all_jobs (int running_only) { free ((char *)jobs); js.j_jobslots = 0; - js.j_firstj = js.j_lastj = js.j_njobs = 0; + js.j_firstj = js.j_lastj = js.j_njobs = js.j_ndead = 0; + js.c_reaped = js.c_injobs = js.c_living = 0; } } diff --git a/lib/readline/complete.c b/lib/readline/complete.c index 9f170334..e2c35012 100644 --- a/lib/readline/complete.c +++ b/lib/readline/complete.c @@ -246,11 +246,24 @@ rl_icppfunc_t *rl_filename_stat_hook = (rl_icppfunc_t *)NULL; either return its first argument (if no conversion takes place) or newly-allocated memory. This can, for instance, convert filenames between character sets for comparison against what's typed at the - keyboard. The returned value is what is added to the list of - matches. The second argument is the length of the filename to be - converted. */ + keyboard (after its potential modification by rl_completion_rewrite_hook). + The returned value is what is added to the list of matches. + The second argument is the length of the filename to be converted. */ rl_dequote_func_t *rl_filename_rewrite_hook = (rl_dequote_func_t *)NULL; +/* If non-zero, this is the address of a function to call before + comparing the filename portion of a word to be completed with directory + entries from the filesystem. This takes the address of the partial word + to be completed, after any rl_filename_dequoting_function has been applied. + The function should either return its first argument (if no conversion + takes place) or newly-allocated memory. This can, for instance, convert + the filename portion of the completion word to a character set suitable + for comparison against directory entries read from the filesystem (after + their potential modification by rl_filename_rewrite_hook). + The returned value is what is added to the list of matches. + The second argument is the length of the filename to be converted. */ +rl_dequote_func_t *rl_completion_rewrite_hook = (rl_dequote_func_t *)NULL; + /* Non-zero means readline completion functions perform tilde expansion. */ int rl_complete_with_tilde_expansion = 0; @@ -2537,9 +2550,9 @@ rl_filename_completion_function (const char *text, int state) filename_len = strlen (filename); /* Normalize the filename if the application has set a rewrite hook. */ - if (*filename && rl_filename_rewrite_hook) + if (*filename && rl_completion_rewrite_hook) { - temp = (*rl_filename_rewrite_hook) (filename, filename_len); + temp = (*rl_completion_rewrite_hook) (filename, filename_len); if (temp != filename) { xfree (filename); diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi index 3e136789..8b9bd8c0 100644 --- a/lib/readline/doc/rltech.texi +++ b/lib/readline/doc/rltech.texi @@ -2165,7 +2165,9 @@ The function should not modify the directory argument if it returns 0. @deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook If non-zero, this is the address of a function called when reading directory entries from the filesystem for completion and comparing -them to the partial word to be completed. The function should +them to the filename portion of the partial word to be completed +(after its potential modification by @code{rl_completion_rewrite_hook}). +The function should perform any necessary application or system-specific conversion on the filename, such as converting between character sets or converting from a filesystem format to a character input format. @@ -2178,6 +2180,24 @@ matches, is added to the list of matches. Readline will free the allocated string. @end deftypevar +@deftypevar {rl_dequote_func_t *} rl_completion_rewrite_hook +If non-zero, this is the address of a function to call before +comparing the filename portion of a word to be completed with directory +entries from the filesystem. +The function takes two arguments: @var{fname}, the filename to be converted, +after any @code{rl_filename_dequoting_function} has been applied, +and @var{fnlen}, its length in bytes. +It must either return its first argument (if no conversion takes place) +or the converted filename in newly-allocated memory. +The function should perform any necessary application or system-specific +conversion on the filename, such as converting between character sets or +converting from a character input format to some other format. +Readline compares the converted form against directory entries, after +their potential modification by @code{rl_filename_rewrite_hook}, and adds +any matches to the list of matches. +Readline will free the allocated string. +@end deftypevar + @deftypevar {rl_compdisp_func_t *} rl_completion_display_matches_hook If non-zero, then this is the address of a function to call when completing a word would normally display the list of possible matches. diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi index 19dfe9a2..f1b82d41 100644 --- a/lib/readline/doc/version.texi +++ b/lib/readline/doc/version.texi @@ -5,7 +5,7 @@ Copyright (C) 1988-2023 Free Software Foundation, Inc. @set EDITION 8.3 @set VERSION 8.3 -@set UPDATED 31 July 2023 -@set UPDATED-MONTH July 2023 +@set UPDATED 4 October 2023 +@set UPDATED-MONTH October 2023 -@set LASTCHANGE Mon Jul 31 10:09:09 EDT 2023 +@set LASTCHANGE Wed Oct 4 10:57:26 EDT 2023 diff --git a/lib/readline/readline.h b/lib/readline/readline.h index 0810f97d..82b22343 100644 --- a/lib/readline/readline.h +++ b/lib/readline/readline.h @@ -771,6 +771,19 @@ extern rl_icppfunc_t *rl_filename_stat_hook; converted. */ extern rl_dequote_func_t *rl_filename_rewrite_hook; +/* If non-zero, this is the address of a function to call before + comparing the filename portion of a word to be completed with directory + entries from the filesystem. This takes the address of the partial word + to be completed, after any rl_filename_dequoting_function has been applied. + The function should either return its first argument (if no conversion + takes place) or newly-allocated memory. This can, for instance, convert + the filename portion of the completion word to a character set suitable + for comparison against directory entries read from the filesystem (after + their potential modification by rl_filename_rewrite_hook). + The returned value is what is added to the list of matches. + The second argument is the length of the filename to be converted. */ +extern rl_dequote_func_t *rl_completion_rewrite_hook; + /* Backwards compatibility with previous versions of readline. */ #define rl_symbolic_link_hook rl_directory_completion_hook diff --git a/tests/func.right b/tests/func.right index 9cbb34d1..2c83a0fb 100644 --- a/tests/func.right +++ b/tests/func.right @@ -190,20 +190,59 @@ FUNCNAME: a=2 { echo $FUNCNAME } -break is a function -break () -{ - echo FUNCNAME: $FUNCNAME -} -FUNCNAME: break -break is a function -break () -{ - echo FUNCNAME: $FUNCNAME -} +posix mode: +type +break is a special shell builtin +builtin +command -v break -./func5.sub: line 69: `break': is a special builtin -./func5.sub: line 75: `!!': not a valid identifier +command -V +break is a special shell builtin +type -a +break is a special shell builtin +break is a function +break () +{ + echo inside function $FUNCNAME +} +declare +break () +{ + echo inside function $FUNCNAME +} +execution +default mode: +type +break is a function +break () +{ + echo inside function $FUNCNAME +} +function +command -v +break +command -V +break is a function +break () +{ + echo inside function $FUNCNAME +} +type -a +break is a function +break () +{ + echo inside function $FUNCNAME +} +break is a shell builtin +declare +break () +{ + echo inside function $FUNCNAME +} +execution +inside function break +./func5.sub: line 86: `break': is a special builtin +./func5.sub: line 92: `!!': not a valid identifier !! is a function !! () { diff --git a/tests/func5.sub b/tests/func5.sub index 43e2c522..bacb82db 100644 --- a/tests/func5.sub +++ b/tests/func5.sub @@ -46,18 +46,35 @@ type '<(:)' break() { - echo FUNCNAME: $FUNCNAME + echo inside function $FUNCNAME +} + +testfunc() +{ + echo type + type break + type -t break + echo command -v + command -v break + echo command -V + command -V break + + echo type -a + type -a break + echo declare + declare -f break + echo execution + break } -type break -\break -# you can print them in posix mode set -o posix -# posix mode should find special builtins first -type break -declare -F break +echo posix mode: +testfunc + set +o posix -unset -f break +echo default mode: +testfunc +unset -f testfunc break # but in posix mode, declaring such a function is a fatal error ( set -o posix diff --git a/tests/lastpipe.right b/tests/lastpipe.right index 84e1e2ea..d311d6f8 100644 --- a/tests/lastpipe.right +++ b/tests/lastpipe.right @@ -7,6 +7,7 @@ last = c 1 -- 0 0 1 1 -- 0 0 1 1 -- 0 1 0 +1 42 lastpipe1.sub returns 14 A1 A2 diff --git a/tests/printf.right b/tests/printf.right index 9253ef61..cf6f77e1 100644 --- a/tests/printf.right +++ b/tests/printf.right @@ -330,15 +330,28 @@ hello -- hello -- 123 -- 6 -- -à²M-^Gಳಿà²M-^Uà³M-^Fà²M-^Wಳà³M-^A -à²M-^Gಳ -à²M-^G -à²M-^Gಳ - à²M-^Gಳ -à²M-^Gಳ --- -à²M-^G -à²M-^G -à²M-^G -à²M-^G - à²M-^G -à²M-^G --- +0000000 340 262 207 340 262 263 340 262 277 340 262 225 340 263 206 340 +0000010 262 227 340 262 263 340 263 201 012 +0000019 +0000000 340 262 207 340 262 263 012 +0000007 +0000000 340 262 207 012 +0000004 +0000000 340 262 207 340 262 263 012 +0000007 +0000000 040 040 340 262 207 340 262 263 012 +0000009 +0000000 340 262 207 340 262 263 040 040 055 055 055 012 +000000c +0000000 340 262 207 012 +0000004 +0000000 340 262 207 012 +0000004 +0000000 340 262 207 012 +0000004 +0000000 340 262 207 012 +0000004 +0000000 040 040 040 340 262 207 012 +0000007 +0000000 340 262 207 040 040 040 055 055 055 012 +000000a diff --git a/tests/printf6.sub b/tests/printf6.sub index 09ee689e..0dc3b28b 100644 --- a/tests/printf6.sub +++ b/tests/printf6.sub @@ -4,18 +4,18 @@ V=ಇಳಿಕೆಗಳೠV2=${V:0:2} V3=${V:0:1} -printf "%ls\n" "$V" -printf "%ls\n" "$V2" -printf "%lc\n" "$V" -printf "%.2ls\n" "$V" +printf "%ls\n" "$V" | hexdump -b +printf "%ls\n" "$V2" | hexdump -b +printf "%lc\n" "$V" | hexdump -b +printf "%.2ls\n" "$V" | hexdump -b -printf "%4.2ls\n" "$V" -printf "%-4.2ls---\n" "$V" +printf "%4.2ls\n" "$V" | hexdump -b +printf "%-4.2ls---\n" "$V" | hexdump -b -printf "%ls\n" "$V3" -printf "%S\n" "$V3" -printf "%lc\n" "$V3" -printf "%C\n" "$V3" +printf "%ls\n" "$V3" | hexdump -b +printf "%S\n" "$V3" | hexdump -b +printf "%lc\n" "$V3" | hexdump -b +printf "%C\n" "$V3" | hexdump -b -printf "%4.2lc\n" "$V3" -printf "%-4.2lc---\n" "$V3" +printf "%4.2lc\n" "$V3" | hexdump -b +printf "%-4.2lc---\n" "$V3" | hexdump -b