}
#else
argv = construct_command_argv (p, &end, child->file,
- child->file->cmds->lines_flags[child->command_line - 1],
+ child->file->cmds->lines_flags[child->command_line - 1] | child->file->command_flags,
&child->sh_batch_file);
#endif
if (end == NULL)
if (*line == '\0')
return 0;
- if (shellflags == 0)
- shellflags = posix_pedantic && NONE_SET (flags, COMMANDS_NOERROR) ? "-ec" : "-c";
-
/* See if it is safe to parse commands internally. */
if (shell == 0)
shell = default_shell;
construct_command_argv (char *line, char **restp, struct file *file,
int cmd_flags, char **batch_filename)
{
- char *shell, *ifs, *shellflags;
+ char *shell, *ifs;
+ char *allocflags = NULL;
+ const char *shellflags;
char **argv;
{
var = lookup_variable_for_file (STRING_SIZE_TUPLE (".SHELLFLAGS"), file);
if (!var)
- shellflags = xstrdup ("");
- else if (posix_pedantic && var->origin == o_default)
+ shellflags = "";
+ else if (var->origin != o_default)
+ shellflags = allocflags = allocated_expand_string_for_file (var->value, file);
+ else if (posix_pedantic && !ignore_errors_flag && NONE_SET (cmd_flags, COMMANDS_NOERROR))
/* In POSIX mode we default to -ec, unless we're ignoring errors. */
- shellflags = xstrdup (ANY_SET (cmd_flags, COMMANDS_NOERROR) ? "-c" : "-ec");
+ shellflags = "-ec";
else
- shellflags = allocated_expand_string_for_file (var->value, file);
+ shellflags = "-c";
ifs = allocated_expand_variable_for_file (STRING_SIZE_TUPLE ("IFS"), file);
cmd_flags, batch_filename);
free (shell);
- free (shellflags);
+ free (allocflags);
free (ifs);
return argv;
--- /dev/null
+# -*-perl-*-
+
+$description = "Test the behaviour of the .IGNORE target.";
+
+$details = "";
+
+# Without any ignore
+run_make_test(q!
+all: ; @#HELPER# -q fail 1
+!,
+ '', "#MAKE#: *** [#MAKEFILE#:2: all] Error 1", 512);
+
+# Global .IGNORE
+run_make_test(q!
+.IGNORE:
+all: ; @#HELPER# -q fail 1
+!,
+ '', "#MAKE#: [#MAKEFILE#:3: all] Error 1 (ignored)");
+
+# Specific .IGNORE
+
+run_make_test(q!
+.IGNORE: all
+all: ; @#HELPER# -q fail 1
+!,
+ '', "#MAKE#: [#MAKEFILE#:3: all] Error 1 (ignored)");
+
+1;
!,
'', "hello\n");
+# SV 64085: Also don't add -e if -i or .IGNORE is used
+
+run_make_test(q!
+.POSIX:
+all: ; @#HELPER# -q fail 1; #HELPER# out hello
+!,
+ '-i', "hello\n");
+
+run_make_test(q!
+.POSIX:
+.IGNORE:
+all: ; @#HELPER# -q fail 1; #HELPER# out hello
+!,
+ '', "hello\n");
+
+run_make_test(q!
+.POSIX:
+.IGNORE: all
+all: ; @#HELPER# -q fail 1; #HELPER# out hello
+!,
+ '', "hello\n");
+
# But explicit settings must still take precedence
run_make_test(q!