execute_cmd.c
- execute_cond_node: reset extended_glob to the value of extglob_flag,
since we're executing a command here
+
+ 10/8
+ ----
+parse.y
+ - save_dstart: when we set the value of function_dstart, save the old
+ value in save_dstart (read_token, read_token_word); restore it in
+ the grammar production after calling make_function_def. This gives
+ you correct line numbers for one level of function nesting.
+ Report from Daniel Castro <danicc097@gmail.com>
+
+ 10/10
+ -----
+execute_cmd.c
+ - shell_execve: rearrange code so that we check for a bad interpreter
+ before printing a generic ENOENT error message. Report from
+ Kirill Elagin <kirelagin@gmail.com>
errno = i;
file_error (command);
}
- else if (i == ENOENT)
- {
- errno = i;
- internal_error (_("%s: cannot execute: required file not found"), command);
- }
else
{
/* The file has the execute bits set, but the kernel refuses to
FREE (interp);
return (EX_NOEXEC);
}
+ else
#endif
- errno = i;
- file_error (command);
+ if (i == ENOENT)
+ {
+ errno = i;
+ internal_error (_("%s: cannot execute: required file not found"), command);
+ }
+ else
+ {
+ errno = i;
+ file_error (command);
+ }
}
return (last_command_exit_value);
}
if (termsig && WIFSIGNALED (s) && termsig != SIGINT && termsig != SIGPIPE)
#endif
{
-itrace("notify_of_job_status: printing status of foreground job %d", job);
fprintf (stderr, "%s", j_strsignal (termsig));
if (WIFCORED (s))
case, we just want to compare the two as strings. */
return (STRCOMPARE (p - 1, pe, s, se));
+ glob_recursion_depth++;
+
switch (xc)
{
case L('+'): /* match one or more occurrences */
#endif
int glob_asciirange = GLOBASCII_DEFAULT;
+int glob_recursion_depth;
#if FNMATCH_EQUIV_FALLBACK
/* Construct a string w1 = "c1" and a pattern w2 = "[[=c2=]]" and pass them
wchar_t *wpattern, *wstring;
size_t plen, slen, mplen, mslen;
+ glob_recursion_depth = 0;
+
if (MB_CUR_MAX == 1)
return (internal_strmatch ((unsigned char *)pattern, (unsigned char *)string, flags));
return ret;
#else
+ glob_recursion_depth = 0;
+
return (internal_strmatch ((unsigned char *)pattern, (unsigned char *)string, flags));
#endif /* !HANDLE_MULTIBYTE */
}
/* The line number in a script on which a function definition starts. */
static int function_dstart;
+static int save_dstart = -1;
/* The line number in a script on which a function body starts. */
static int function_bstart;
+static int save_bstart = -1;
/* The line number in a script at which an arithmetic for command starts. */
static int arith_for_lineno;
;
function_def: WORD '(' ')' newline_list function_body
- { $$ = make_function_def ($1, $5, function_dstart, function_bstart); }
+ { $$ = make_function_def ($1, $5, function_dstart, function_bstart); function_dstart = save_dstart; }
| FUNCTION WORD '(' ')' newline_list function_body
- { $$ = make_function_def ($2, $6, function_dstart, function_bstart); }
+ { $$ = make_function_def ($2, $6, function_dstart, function_bstart); function_dstart = save_dstart; }
| FUNCTION WORD function_body
- { $$ = make_function_def ($2, $3, function_dstart, function_bstart); }
+ { $$ = make_function_def ($2, $3, function_dstart, function_bstart); function_dstart = save_dstart; }
| FUNCTION WORD '\n' newline_list function_body
- { $$ = make_function_def ($2, $5, function_dstart, function_bstart); }
+ { $$ = make_function_def ($2, $5, function_dstart, function_bstart); function_dstart = save_dstart; }
;
function_body: shell_command
#if defined (ALIAS)
parser_state &= ~PST_ALEXPNEXT;
#endif /* ALIAS */
+ save_dstart = function_dstart;
function_dstart = line_number;
}
{
case FUNCTION:
parser_state |= PST_ALLOWOPNBRC;
+ save_dstart = function_dstart;
function_dstart = line_number;
break;
case CASE: