psss / rpms / bash

Forked from rpms/bash 6 years ago
Clone
b316f71
diff --git a/execute_cmd.h b/execute_cmd.h
b316f71
--- a/execute_cmd.h
b316f71
+++ b/execute_cmd.h
b316f71
@@ -37,6 +37,9 @@ struct func_array_state
b316f71
   };
b316f71
 #endif
b316f71
 
b316f71
+/* Variables delared in execute_cmd.c, used by many other files */
b316f71
+extern int executing_command_builtin;
b316f71
+
b316f71
 extern struct fd_bitmap *new_fd_bitmap __P((int));
b316f71
 extern void dispose_fd_bitmap __P((struct fd_bitmap *));
b316f71
 extern void close_fd_bitmap __P((struct fd_bitmap *));
b316f71
diff --git a/subst.c b/subst.c
b316f71
--- a/subst.c
b316f71
+++ b/subst.c
b316f71
@@ -10676,11 +10676,12 @@ expand_word_list_internal (list, eflags)
b316f71
 		  tint = do_word_assignment (temp_list->word, 0);
b316f71
 		  this_command_name = savecmd;
b316f71
 		  /* Variable assignment errors in non-interactive shells
b316f71
-		     running in Posix.2 mode cause the shell to exit. */
b316f71
+		     running in Posix.2 mode cause the shell to exit, unless 
b316f71
+		     they are being run by the `command' builtin. */
b316f71
 		  if (tint == 0)
b316f71
 		    {
b316f71
 		      last_command_exit_value = EXECUTION_FAILURE;
b316f71
-		      if (interactive_shell == 0 && posixly_correct)
b316f71
+		      if (interactive_shell == 0 && posixly_correct && executing_command_builtin == 0)
b316f71
 			exp_jump_to_top_level (FORCE_EOF);
b316f71
 		      else
b316f71
 			exp_jump_to_top_level (DISCARD);