nalika / rpms / bash

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