- assign_in_env: if NAME is not a valid shell identifier, free it
after printing the error message and before returning. These are
the rest of the fixes from Siteshwar Vashisht <svashisht@redhat.com>
+
+ 7/22
+ ----
+shell.c
+ - main: set dollar_vars[0] to shell_script_filename before calling
+ run_startup_files() in the non-interactive case. Restore it after
+ run_startup_files returns so we can get better error messages if
+ we can't open a script file. Suggested by several people, originally
+ by Marc Aurèle La France <tsi@tuyoix.net> back in 2/2021 (in a
+ different form) and most recently by Tapani Tarvainen
+ <bash@tapanitarvainen.fi>
+
+ 7/28
+ ----
+trap.c
+ - any_signals_trapped: return that a signal is trapped only if it's
+ not ignored. This is an additional opportunity for optimization,
+ reported in https://bugzilla.redhat.com/show_bug.cgi?id=1981926
.BR "ARITHMETIC EVALUATION" .
If the value of the expression is non-zero, the return status is 0;
otherwise the return status is 1.
-The \fIexpression\fP is expanded as if it were within double quotes,
-but double quote characters in \fIexpression\fP are not special and
-are removed.
+The \fIexpression\fP
+undergoes the same expansions
+as if it were within double quotes,
+but double quote characters in \fIexpression\fP are not treated specially
+and are removed.
.TP
\fB[[\fP \fIexpression\fP \fB]]\fP
Return a status of 0 or 1 depending on the evaluation of
The shell performs tilde expansion, parameter and
variable expansion, arithmetic expansion, command substitution, process
substitution, and quote removal on those words
-(as if the words were enclosed in double quotes).
+(the expansions that would occur if the words were enclosed in double quotes).
Conditional operators such as \fB\-f\fP must be unquoted to be recognized
as primaries.
.if t .sp 0.5
.PP
The
.I expression
-is treated as if it were within double quotes, but a double quote
-inside the parentheses is not treated specially.
+undergoes the same expansions
+as if it were within double quotes,
+but double quote characters in \fIexpression\fP are not treated specially
+and are removed.
All tokens in the expression undergo parameter and variable expansion,
command substitution, and quote removal.
The result is treated as the arithmetic expression to be evaluated.
The arithmetic @var{expression} is evaluated according to the rules
described below (@pxref{Shell Arithmetic}).
-The @var{expression} is expanded as if it were within double quotes,
-but double quote characters in @var{expression} are not special and
+The @var{expression} undergoes the same expansions
+as if it were within double quotes,
+but double quote characters in @var{expression} are not treated specially
are removed.
If the value of the expression is non-zero, the return status is 0;
otherwise the return status is 1.
The shell performs tilde expansion, parameter and
variable expansion, arithmetic expansion, command substitution, process
substitution, and quote removal on those words
-(as if the words were enclosed in double quotes).
+(the expansions that would occur if the words were enclosed in double quotes).
Conditional operators such as @samp{-f} must be unquoted to be recognized
as primaries.
$(( @var{expression} ))
@end example
-The @var{expression} is treated as if it were within double quotes, but
-a double quote inside the parentheses is not treated specially.
+The @var{expression} undergoes the same expansions
+as if it were within double quotes,
+but double quote characters in @var{expression} are not treated specially
+and are removed.
All tokens in the expression undergo parameter and variable expansion,
command substitution, and quote removal.
The result is treated as the arithmetic expression to be evaluated.
/* The startup files are run with `set -e' temporarily disabled. */
if (locally_skip_execution == 0 && running_setuid == 0)
{
+ char *t;
+
old_errexit_flag = exit_immediately_on_error;
exit_immediately_on_error = 0;
+ /* Temporarily set $0 while running startup files, then restore it so
+ we get better error messages when trying to open script files. */
+ if (shell_script_filename)
+ {
+ t = dollar_vars[0];
+ dollar_vars[0] = exec_argv0 ? savestring (exec_argv0) : savestring (shell_script_filename);
+ }
run_startup_files ();
+ if (shell_script_filename)
+ {
+ free (dollar_vars[0]);
+ dollar_vars[0] = t;
+ }
exit_immediately_on_error += old_errexit_flag;
}
-BUILD_DIR=/usr/local/build/chet/bash/bash-current
+BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
register int i;
for (i = 1; i < NSIG; i++)
- if (sigmodes[i] & SIG_TRAPPED)
+ if ((sigmodes[i] & SIG_TRAPPED) && (sigmodes[i] & SIG_IGNORED) == 0)
return i;
return -1;
}