From: Chet Ramey Date: Tue, 30 Jul 2024 15:18:17 +0000 (-0400) Subject: new bash_source_fullpath shell option; documentation updates for wait builtin X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e45ec6f76bea49cf8df306ac45022306831ed086;p=thirdparty%2Fbash.git new bash_source_fullpath shell option; documentation updates for wait builtin --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index bfe8444b..6930d8ce 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9872,3 +9872,39 @@ lib/malloc/malloc.c otherwise - internal_realloc: don't check bucket at nunits-1 unless nunits >= 1 Report and fix from Collin Funk + + 7/25 + ---- +variables.c + - push_source: new function, pushes a filename to BASH_SOURCE; changed + callers (shell.c, execute_cmd.c, builtins/evalfile.c) + - bash_source_fullpath: new variable, if non-zero, push_source runs + the filename through sh_realpath before pushing it to BASH_SOURCE + Feature requested by several, including konsolebox + +builtins/shopt.def + - bash_source_fullpath: new option, controls bash_source_fullpath and + whether or not BASH_SOURCE contains full pathnames + +doc/bash.1,doc/bashref.texi + - bash_source_fullpath: document new shell option + + 7/26 + ---- +jobs.c,jobs.h,subst.c + - last_procsub_pid: new variable, set to the pid of last_procsub_child, + so it will survive the PROCESS * being deleted if we need it. Not + used yet + + 7/29 + ---- +doc/bash.1,doc/bashref.texi + - wait: update description to clarify wait -n and unify language + Inspired by report from Zachary Santer + - set: note that the -e behavior for pipelines is affected by the + state of the pipefail option + From a report by Martin D Kealey + +variables.c,hashcmd.c,builtins/hash.def,builtins/history.def,builtins/source.def + - use ABSPATH/RELPATH/absolute_program instead of testing for slash + explicitly diff --git a/builtins/hash.def b/builtins/hash.def index ee8da9d0..fc96d594 100644 --- a/builtins/hash.def +++ b/builtins/hash.def @@ -156,7 +156,7 @@ hash_builtin (WORD_LIST *list) #if defined (RESTRICTED_SHELL) if (restricted && pathname) { - if (strchr (pathname, '/')) + if (absolute_program (pathname)) { sh_restricted (pathname); return (EXECUTION_FAILURE); diff --git a/builtins/history.def b/builtins/history.def index ae64726a..f5dd416b 100644 --- a/builtins/history.def +++ b/builtins/history.def @@ -282,7 +282,7 @@ history_builtin (WORD_LIST *list) } #if defined (RESTRICTED_SHELL) - if (restricted && strchr (filename, '/')) + if (restricted && absolute_program (filename)) { sh_restricted (filename); return (EXECUTION_FAILURE); diff --git a/builtins/shopt.def b/builtins/shopt.def index b3e1cfe5..67bc0c22 100644 --- a/builtins/shopt.def +++ b/builtins/shopt.def @@ -97,6 +97,7 @@ extern int localvar_unset; extern int varassign_redir_autoclose; extern int singlequote_translations; extern int patsub_replacement; +extern int bash_source_fullpath; #if defined (EXTENDED_GLOB) extern int extended_glob; @@ -177,10 +178,13 @@ static struct { int *value; shopt_set_func_t *set_func; } shopt_vars[] = { - { "autocd", &autocd, (shopt_set_func_t *)NULL }, #if defined (ARRAY_VARS) { "array_expand_once", &expand_once_flag, set_array_expand }, { "assoc_expand_once", &expand_once_flag, set_array_expand }, +#endif + { "autocd", &autocd, (shopt_set_func_t *)NULL }, +#if defined (ARRAY_VARS) + { "bash_source_fullpath", &bash_source_fullpath, (shopt_set_func_t *)NULL }, #endif { "cdable_vars", &cdable_vars, (shopt_set_func_t *)NULL }, { "cdspell", &cdspelling, (shopt_set_func_t *)NULL }, diff --git a/builtins/source.def b/builtins/source.def index fa3d5ce1..41c664f9 100644 --- a/builtins/source.def +++ b/builtins/source.def @@ -146,7 +146,7 @@ source_builtin (WORD_LIST *list) } #if defined (RESTRICTED_SHELL) - if (restricted && (pathstring || strchr (list->word->word, '/'))) + if (restricted && (pathstring || absolute_program (list->word->word))) { sh_restricted (list->word->word); return (EXECUTION_FAILURE); @@ -162,7 +162,7 @@ source_builtin (WORD_LIST *list) filename = (char *)NULL; /* XXX -- should this be absolute_pathname? */ - if (posixly_correct && strchr (list->word->word, '/')) + if (posixly_correct && absolute_program (list->word->word)) filename = savestring (list->word->word); else if (absolute_pathname (list->word->word)) filename = savestring (list->word->word); diff --git a/doc/bash.0 b/doc/bash.0 index f89c340d..2b40362c 100644 --- a/doc/bash.0 +++ b/doc/bash.0 @@ -6027,6 +6027,10 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS aauuttooccdd If set, a command name that is the name of a directory is executed as if it were the argument to the ccdd com- mand. This option is only used by interactive shells. + bbaasshh__ssoouurrccee__ffuullllppaatthh + If set, filenames added to the BBAASSHH__SSOOUURRCCEE array vari- + able are converted to full pathnames (see SShheellll VVaarrii-- + aabblleess above). ccddaabbllee__vvaarrss If set, an argument to the ccdd builtin command that is not a directory is assumed to be the name of a variable diff --git a/doc/bash.1 b/doc/bash.1 index 1f0a23d3..a5d15c95 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,14 +5,14 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Tue Jul 2 14:28:46 EDT 2024 +.\" Last Change: Mon Jul 29 11:19:45 EDT 2024 .\" .\" bash_builtins, strip all but Built-Ins section .\" avoid a warning about an undefined register .\" .if !rzY .nr zY 0 .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2024 July 2" "GNU Bash 5.3" +.TH BASH 1 "2024 July 29" "GNU Bash 5.3" .\" .ie \n(.g \{\ .ds ' \(aq @@ -657,8 +657,8 @@ These are referred to as \fIasynchronous\fP commands. Commands separated by a .B ; are executed sequentially; the shell waits for each -command to terminate in turn. The return status is the -exit status of the last command executed. +command to terminate in turn. +The return status is the exit status of the last command executed. .PP AND and OR lists are sequences of one or more pipelines separated by the \fB&&\fP and \fB||\fP control operators, respectively. @@ -10327,7 +10327,8 @@ reserved words, part of any command executed in a or .B || list except the command following the final \fB&&\fP or \fB||\fP, -any command in a pipeline but the last, +any command in a pipeline but the last +(subject to the state of the \fBpipefail\fP shell option), or if the command's return value is being inverted with .BR ! . @@ -10764,6 +10765,10 @@ If set, a command name that is the name of a directory is executed as if it were the argument to the \fBcd\fP command. This option is only used by interactive shells. .TP 8 +.B bash_source_fullpath +If set, filenames added to the \fBBASH_SOURCE\fP array variable are +converted to full pathnames (see \fBShell Variables\fP above). +.TP 8 .B cdable_vars If set, an argument to the .B cd @@ -11831,43 +11836,45 @@ subsequently reset. The exit status is true unless a is readonly or may not be unset. .TP \fBwait\fP [\fB\-fn\fP] [\fP\-p\fP \fIvarname\fP] [\fIid\fP .\|.\|.] -Wait for each specified child process and return its termination status. -Each -.I id -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 -.I id -is not given, +Wait for each specified child process \fIid\fP and return the +termination status of the last \fIid\fP. +Each \fIid\fP may be a process ID or a job specification; +if a job spec is given, \fBwait\fP waits for all processes in the job. +.IP +If no options or \fIid\fPs are supplied, \fBwait\fP waits for all running background jobs and -the last-executed process substitution, if its process id is the same as -\fB$!\fP, +the last-executed process substitution, +if its process id is the same as \fB$!\fP, and the return status is zero. -If the \fB\-n\fP option is supplied, -\fBwait\fP waits for a single job -from the list of \fIid\fPs or, if no \fIid\fPs are supplied, any job, +.IP +If the \fB\-n\fP option is supplied, \fBwait\fP waits for any one of +the given \fIid\fPs or, if no \fIid\fPs are supplied, any job +or process substitution, to complete and returns its exit status. -If none of the supplied arguments is a child of the shell, or if no arguments -are supplied and the shell has no unwaited-for children, the exit status -is 127. -If the \fB\-p\fP option is supplied, the process or job identifier of the job -for which the exit status is returned is assigned to the variable -\fIvarname\fP named by the option argument. +If none of the supplied \fIid\fPs is a child of the shell, +or if no \fIid\fPs are supplied and the shell has no unwaited-for children, +the exit status is 127. +.IP +If the \fB\-p\fP option is supplied, the process or job identifier +of the job for which the exit status is returned is assigned to the +variable \fIvarname\fP named by the option argument. The variable will be unset initially, before any assignment. This is useful only when the \fB\-n\fP option is supplied. +.IP Supplying the \fB\-f\fP option, when job control is enabled, -forces \fBwait\fP to wait for \fIid\fP to terminate before returning -its status, instead of returning when it changes status. -If -.I id -specifies a non-existent process or job, the return status is 127. -If \fBwait\fP is interrupted by a signal, the return status will be greater +forces \fBwait\fP to wait for each \fIid\fP to terminate before +returning its status, instead of returning when it changes status. +.IP +If none of the \fIid\fPs specify one of the shell's active child +processes, the return status is 127. +If \fBwait\fP is interrupted by a signal, +any \fIvarname\fP will remain unset, +and the return status will be greater than 128, as described under .B SIGNALS .ie \n(zZ=1 in \fIbash\fP(1). .el above. -Otherwise, the return status is the exit status of the last -process or job waited for. +Otherwise, the return status is the exit status of the last \fIid\fP. .SH "SHELL COMPATIBILITY MODE" Bash-4.0 introduced the concept of a \fIshell compatibility level\fP, specified as a set of options to the shopt builtin (\c diff --git a/doc/bash.html b/doc/bash.html index 8076e3f0..0cb7347a 100644 --- a/doc/bash.html +++ b/doc/bash.html @@ -13512,6 +13512,11 @@ Deprecated; a synonym for array_expand_once. If set, a command name that is the name of a directory is executed as if it were the argument to the cd command. This option is only used by interactive shells. +
bash_source_fullpath + +
+If set, filenames added to the BASH_SOURCE array variable are +converted to full pathnames (see Shell Variables above).
cdable_vars
@@ -15590,7 +15595,7 @@ There may be only one active coprocess at a time.
BUGS

-This document was created by man2html from /usr/local/src/bash/bash-20240701/doc/bash.1.
-Time: 03 July 2024 10:54:15 EDT +This document was created by man2html from /usr/local/src/bash/bash-20240724/doc/bash.1.
+Time: 25 July 2024 11:43:06 EDT diff --git a/doc/bash.info b/doc/bash.info index a716bffa..ebd2327b 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -1,9 +1,9 @@ This is bash.info, produced by makeinfo version 7.1 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.3, 2 July 2024). +Bash shell (version 5.3, 25 July 2024). - This is Edition 5.3, last updated 2 July 2024, of ‘The GNU Bash + This is Edition 5.3, last updated 25 July 2024, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.3. Copyright © 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, 2 July 2024). The Bash home page is +Bash shell (version 5.3, 25 July 2024). The Bash home page is . - This is Edition 5.3, last updated 2 July 2024, of ‘The GNU Bash + This is Edition 5.3, last updated 25 July 2024, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.3. Bash contains features that appear in other popular shells, and some @@ -4930,6 +4930,10 @@ This builtin allows you to change additional shell optional behavior. executed as if it were the argument to the ‘cd’ command. This option is only used by interactive shells. + ‘bash_source_fullpath’ + If set, filenames added to the ‘BASH_SOURCE’ array variable + are converted to full pathnames (*note Bash Variables::). + ‘cdable_vars’ If this is set, an argument to the ‘cd’ builtin command that is not a directory is assumed to be the name of a variable @@ -12994,138 +12998,138 @@ D.5 Concept Index  Tag Table: -Node: Top891 -Node: Introduction2822 -Node: What is Bash?3035 -Node: What is a shell?4176 -Node: Definitions6755 -Node: Basic Shell Features9931 -Node: Shell Syntax11151 -Node: Shell Operation12178 -Node: Quoting13476 -Node: Escape Character14789 -Node: Single Quotes15287 -Node: Double Quotes15636 -Node: ANSI-C Quoting16979 -Node: Locale Translation18364 -Node: Creating Internationalized Scripts19708 -Node: Comments23906 -Node: Shell Commands24541 -Node: Reserved Words25480 -Node: Simple Commands26345 -Node: Pipelines27004 -Node: Lists30067 -Node: Compound Commands31939 -Node: Looping Constructs32948 -Node: Conditional Constructs35492 -Node: Command Grouping50313 -Node: Coprocesses51800 -Node: GNU Parallel54496 -Node: Shell Functions55414 -Node: Shell Parameters63520 -Node: Positional Parameters68053 -Node: Special Parameters68988 -Node: Shell Expansions72294 -Node: Brace Expansion74483 -Node: Tilde Expansion77146 -Node: Shell Parameter Expansion79912 -Node: Command Substitution99019 -Node: Arithmetic Expansion102552 -Node: Process Substitution103517 -Node: Word Splitting104654 -Node: Filename Expansion106795 -Node: Pattern Matching109891 -Node: Quote Removal115124 -Node: Redirections115428 -Node: Executing Commands125237 -Node: Simple Command Expansion125904 -Node: Command Search and Execution128015 -Node: Command Execution Environment130423 -Node: Environment133732 -Node: Exit Status135436 -Node: Signals137221 -Node: Shell Scripts140835 -Node: Shell Builtin Commands143927 -Node: Bourne Shell Builtins146038 -Node: Bash Builtins170808 -Node: Modifying Shell Behavior205822 -Node: The Set Builtin206164 -Node: The Shopt Builtin217679 -Node: Special Builtins234466 -Node: Shell Variables235455 -Node: Bourne Shell Variables235889 -Node: Bash Variables238082 -Node: Bash Features275247 -Node: Invoking Bash276261 -Node: Bash Startup Files282660 -Node: Interactive Shells287963 -Node: What is an Interactive Shell?288371 -Node: Is this Shell Interactive?289037 -Node: Interactive Shell Behavior289861 -Node: Bash Conditional Expressions293615 -Node: Shell Arithmetic298789 -Node: Aliases301871 -Node: Arrays304826 -Node: The Directory Stack311625 -Node: Directory Stack Builtins312422 -Node: Controlling the Prompt316871 -Node: The Restricted Shell320009 -Node: Bash POSIX Mode322796 -Node: Shell Compatibility Mode340307 -Node: Job Control349074 -Node: Job Control Basics349531 -Node: Job Control Builtins354705 -Node: Job Control Variables360665 -Node: Command Line Editing361842 -Node: Introduction and Notation363546 -Node: Readline Interaction365190 -Node: Readline Bare Essentials366378 -Node: Readline Movement Commands368196 -Node: Readline Killing Commands369193 -Node: Readline Arguments371171 -Node: Searching372228 -Node: Readline Init File374457 -Node: Readline Init File Syntax375739 -Node: Conditional Init Constructs400677 -Node: Sample Init File405042 -Node: Bindable Readline Commands408163 -Node: Commands For Moving409388 -Node: Commands For History411615 -Node: Commands For Text416820 -Node: Commands For Killing420954 -Node: Numeric Arguments423755 -Node: Commands For Completion424907 -Node: Keyboard Macros429223 -Node: Miscellaneous Commands429924 -Node: Readline vi Mode436578 -Node: Programmable Completion437530 -Node: Programmable Completion Builtins445487 -Node: A Programmable Completion Example457053 -Node: Using History Interactively462398 -Node: Bash History Facilities463079 -Node: Bash History Builtins466191 -Node: History Interaction471434 -Node: Event Designators475759 -Node: Word Designators477342 -Node: Modifiers479328 -Node: Installing Bash481237 -Node: Basic Installation482371 -Node: Compilers and Options486250 -Node: Compiling For Multiple Architectures487000 -Node: Installation Names488749 -Node: Specifying the System Type490983 -Node: Sharing Defaults491729 -Node: Operation Controls492443 -Node: Optional Features493462 -Node: Reporting Bugs505264 -Node: Major Differences From The Bourne Shell506613 -Node: GNU Free Documentation License526348 -Node: Indexes551525 -Node: Builtin Index551976 -Node: Reserved Word Index559074 -Node: Variable Index561519 -Node: Function Index578650 -Node: Concept Index592506 +Node: Top893 +Node: Introduction2826 +Node: What is Bash?3039 +Node: What is a shell?4180 +Node: Definitions6759 +Node: Basic Shell Features9935 +Node: Shell Syntax11155 +Node: Shell Operation12182 +Node: Quoting13480 +Node: Escape Character14793 +Node: Single Quotes15291 +Node: Double Quotes15640 +Node: ANSI-C Quoting16983 +Node: Locale Translation18368 +Node: Creating Internationalized Scripts19712 +Node: Comments23910 +Node: Shell Commands24545 +Node: Reserved Words25484 +Node: Simple Commands26349 +Node: Pipelines27008 +Node: Lists30071 +Node: Compound Commands31943 +Node: Looping Constructs32952 +Node: Conditional Constructs35496 +Node: Command Grouping50317 +Node: Coprocesses51804 +Node: GNU Parallel54500 +Node: Shell Functions55418 +Node: Shell Parameters63524 +Node: Positional Parameters68057 +Node: Special Parameters68992 +Node: Shell Expansions72298 +Node: Brace Expansion74487 +Node: Tilde Expansion77150 +Node: Shell Parameter Expansion79916 +Node: Command Substitution99023 +Node: Arithmetic Expansion102556 +Node: Process Substitution103521 +Node: Word Splitting104658 +Node: Filename Expansion106799 +Node: Pattern Matching109895 +Node: Quote Removal115128 +Node: Redirections115432 +Node: Executing Commands125241 +Node: Simple Command Expansion125908 +Node: Command Search and Execution128019 +Node: Command Execution Environment130427 +Node: Environment133736 +Node: Exit Status135440 +Node: Signals137225 +Node: Shell Scripts140839 +Node: Shell Builtin Commands143931 +Node: Bourne Shell Builtins146042 +Node: Bash Builtins170812 +Node: Modifying Shell Behavior205826 +Node: The Set Builtin206168 +Node: The Shopt Builtin217683 +Node: Special Builtins234645 +Node: Shell Variables235634 +Node: Bourne Shell Variables236068 +Node: Bash Variables238261 +Node: Bash Features275426 +Node: Invoking Bash276440 +Node: Bash Startup Files282839 +Node: Interactive Shells288142 +Node: What is an Interactive Shell?288550 +Node: Is this Shell Interactive?289216 +Node: Interactive Shell Behavior290040 +Node: Bash Conditional Expressions293794 +Node: Shell Arithmetic298968 +Node: Aliases302050 +Node: Arrays305005 +Node: The Directory Stack311804 +Node: Directory Stack Builtins312601 +Node: Controlling the Prompt317050 +Node: The Restricted Shell320188 +Node: Bash POSIX Mode322975 +Node: Shell Compatibility Mode340486 +Node: Job Control349253 +Node: Job Control Basics349710 +Node: Job Control Builtins354884 +Node: Job Control Variables360844 +Node: Command Line Editing362021 +Node: Introduction and Notation363725 +Node: Readline Interaction365369 +Node: Readline Bare Essentials366557 +Node: Readline Movement Commands368375 +Node: Readline Killing Commands369372 +Node: Readline Arguments371350 +Node: Searching372407 +Node: Readline Init File374636 +Node: Readline Init File Syntax375918 +Node: Conditional Init Constructs400856 +Node: Sample Init File405221 +Node: Bindable Readline Commands408342 +Node: Commands For Moving409567 +Node: Commands For History411794 +Node: Commands For Text416999 +Node: Commands For Killing421133 +Node: Numeric Arguments423934 +Node: Commands For Completion425086 +Node: Keyboard Macros429402 +Node: Miscellaneous Commands430103 +Node: Readline vi Mode436757 +Node: Programmable Completion437709 +Node: Programmable Completion Builtins445666 +Node: A Programmable Completion Example457232 +Node: Using History Interactively462577 +Node: Bash History Facilities463258 +Node: Bash History Builtins466370 +Node: History Interaction471613 +Node: Event Designators475938 +Node: Word Designators477521 +Node: Modifiers479507 +Node: Installing Bash481416 +Node: Basic Installation482550 +Node: Compilers and Options486429 +Node: Compiling For Multiple Architectures487179 +Node: Installation Names488928 +Node: Specifying the System Type491162 +Node: Sharing Defaults491908 +Node: Operation Controls492622 +Node: Optional Features493641 +Node: Reporting Bugs505443 +Node: Major Differences From The Bourne Shell506792 +Node: GNU Free Documentation License526527 +Node: Indexes551704 +Node: Builtin Index552155 +Node: Reserved Word Index559253 +Node: Variable Index561698 +Node: Function Index578829 +Node: Concept Index592685  End Tag Table diff --git a/doc/bash.pdf b/doc/bash.pdf index b9dba237..ce05639d 100644 Binary files a/doc/bash.pdf and b/doc/bash.pdf differ diff --git a/doc/bashref.html b/doc/bashref.html index 242e27b3..fcd6573c 100644 --- a/doc/bashref.html +++ b/doc/bashref.html @@ -4,9 +4,9 @@