From: Chet Ramey Date: Mon, 29 Oct 2018 20:06:50 +0000 (-0400) Subject: commit bash-20181025 snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=941cd04a536ded876dfa4b4e032386a80744231c;p=thirdparty%2Fbash.git commit bash-20181025 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 930624435..068f2580f 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -4615,3 +4615,28 @@ subst.c - param_expand: don't set W_SPLITSPACE for $* unless IFS is NULL; consistent with other uses of W_SPLITSPACE + 10/22 + ----- +doc/{bash.1,bashref.texi} + - tweak description of bash conditional expressions to note that the + test and [ commands determine their behavior based on the number of + arguments. Suggested by Ilkka Virta + + 10/24 + ----- +execute_cmd.c + - execute_simple_command: don't set $_ to NULL when executing a + command that forks; just leave it unchanged. Tweaked the documentation + slightly as a result. Inspired by report from Ricky Tigg + + + 10/28 + ----- +redir.c + - here_document_to_fd: make sure the temp files used to store here + documents are readable (and writable, where necessary) by the user. + This can happen in the unlikely case that someone decides to shoot + himself in the foot by setting the umask to 400. Issue originally + raised back in March by Stephane Chazelas + ; fix inspired by Martijn Dekker + diff --git a/doc/bash.1 b/doc/bash.1 index a22768ac5..0b072b988 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,12 +5,12 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Fri Oct 5 14:53:12 EDT 2018 +.\" Last Change: Mon Oct 22 09:55:27 EDT 2018 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2018 October 5" "GNU Bash 5.0" +.TH BASH 1 "2018 October 22" "GNU Bash 5.0" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -1427,8 +1427,8 @@ as given by argument zero. At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. -Subsequently, expands to the last argument to the previous command, -after expansion. +Subsequently, expands to the last argument to the previous simple +command executed in the foreground, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file @@ -4494,6 +4494,10 @@ rules above. Conditional expressions are used by the \fB[[\fP compound command and the \fBtest\fP and \fB[\fP builtin commands to test file attributes and perform string and arithmetic comparisons. +The \fBtest\fP abd \fB[\fP commands determine their behavior based on +the number of arguments; see the descriptions of those commands for any +other command-specific actions. +.PP Expressions are formed from the following unary or binary primaries. \fBBash\fP handles several filenames specially when they are used in expressions. diff --git a/doc/bashref.texi b/doc/bashref.texi index 7d1b53bbc..96484eede 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -1738,8 +1738,8 @@ to the filename used to invoke Bash, as given by argument zero. At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. -Subsequently, expands to the last argument to the previous command, -after expansion. +Subsequently, expands to the last argument to the previous simple +command executed in the foreground, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file. @@ -3795,18 +3795,25 @@ false. @item 3 arguments The following conditions are applied in the order listed. + +@enumerate +@item If the second argument is one of the binary conditional operators (@pxref{Bash Conditional Expressions}), the result of the expression is the result of the binary test using the first and third arguments as operands. The @samp{-a} and @samp{-o} operators are considered binary operators when there are three arguments. +@item If the first argument is @samp{!}, the value is the negation of the two-argument test using the second and third arguments. +@item If the first argument is exactly @samp{(} and the third argument is exactly @samp{)}, the result is the one-argument test of the second argument. +@item Otherwise, the expression is false. +@end enumerate @item 4 arguments If the first argument is @samp{!}, the result is the negation of @@ -6821,9 +6828,13 @@ printing @env{$PS1} (@pxref{Bash Variables}). @cindex expressions, conditional Conditional expressions are used by the @code{[[} compound command -and the @code{test} and @code{[} builtin commands. +and the @code{test} and @code{[} builtin commands. The @code{test} +and @code{[} commands determine their behavior based on the number +of arguments; see the descriptions of those commands for any other +command-specific actions. -Expressions may be unary or binary. +Expressions may be unary or binary, +and are formed from the following primaries. Unary expressions are often used to examine the status of a file. There are string operators and numeric comparison operators as well. Bash handles several filenames specially when they are used in diff --git a/doc/version.texi b/doc/version.texi index f7eab2bbc..54089a905 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2018 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Fri Oct 5 14:52:51 EDT 2018 +@set LASTCHANGE Mon Oct 22 09:55:52 EDT 2018 @set EDITION 5.0 @set VERSION 5.0 -@set UPDATED 5 October 2018 +@set UPDATED 22 October 2018 @set UPDATED-MONTH October 2018 diff --git a/execute_cmd.c b/execute_cmd.c index 4c2b15cd2..83e46dba2 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -4285,7 +4285,9 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close) #endif #endif command_line = (char *)NULL; /* don't free this. */ +#if 0 bind_lastarg ((char *)NULL); +#endif return (result); } } diff --git a/redir.c b/redir.c index f5276dc65..1fd4d269a 100644 --- a/redir.c +++ b/redir.c @@ -465,6 +465,7 @@ here_document_to_fd (redirectee, ri) return (fd); } + fchmod (fd, S_IRUSR | S_IWUSR); SET_CLOSE_ON_EXEC (fd); errno = r = 0; /* XXX */ @@ -508,6 +509,8 @@ here_document_to_fd (redirectee, ri) } free (filename); + + fchmod (fd2, S_IRUSR); return (fd2); }