svashisht / rpms / bash

Forked from rpms/bash 6 years ago
Clone
4793970
From ad1b3e68229273b4983b607c5eeb56551536c583 Mon Sep 17 00:00:00 2001
4793970
From: Chet Ramey <chet.ramey@case.edu>
4793970
Date: Fri, 7 Feb 2020 15:19:53 -0500
4793970
Subject: [PATCH] Bash-5.0 patch 15: aliases and -c commands can cause
4793970
 premature termination
4793970
4793970
---
4793970
 builtins/evalstring.c | 6 ++++--
4793970
 patchlevel.h          | 2 +-
4793970
 2 files changed, 5 insertions(+), 3 deletions(-)
4793970
4793970
diff --git a/builtins/evalstring.c b/builtins/evalstring.c
4793970
index cadc9bc0..2f13a66a 100644
4793970
--- a/builtins/evalstring.c
4793970
+++ b/builtins/evalstring.c
4793970
@@ -91,6 +91,7 @@ should_suppress_fork (command)
4793970
   return (startup_state == 2 && parse_and_execute_level == 1 &&
4793970
 	  running_trap == 0 &&
4793970
 	  *bash_input.location.string == '\0' &&
4793970
+	  parser_expanding_alias () == 0 &&
4793970
 	  command->type == cm_simple &&
4793970
 	  signal_is_trapped (EXIT_TRAP) == 0 &&
4793970
 	  signal_is_trapped (ERROR_TRAP) == 0 &&
4793970
@@ -105,6 +106,7 @@ can_optimize_connection (command)
4793970
      COMMAND *command;
4793970
 {
4793970
   return (*bash_input.location.string == '\0' &&
4793970
+	  parser_expanding_alias () == 0 &&
4793970
 	  (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
4793970
 	  command->value.Connection->second->type == cm_simple);
4793970
 }
4793970
@@ -290,7 +292,7 @@ parse_and_execute (string, from_file, flags)
4793970
 
4793970
   with_input_from_string (string, from_file);
4793970
   clear_shell_input_line ();
4793970
-  while (*(bash_input.location.string))
4793970
+  while (*(bash_input.location.string) || parser_expanding_alias ())
4793970
     {
4793970
       command = (COMMAND *)NULL;
4793970
 
4793970
@@ -545,7 +547,7 @@ parse_string (string, from_file, flags, endp)
4793970
   ostring = string;
4793970
 
4793970
   with_input_from_string (string, from_file);
4793970
-  while (*(bash_input.location.string))
4793970
+  while (*(bash_input.location.string))		/* XXX - parser_expanding_alias () ? */
4793970
     {
4793970
       command = (COMMAND *)NULL;
4793970
 
4793970
diff --git a/patchlevel.h b/patchlevel.h
4793970
index 09a3cc84..6e9ed3fc 100644
4793970
--- a/patchlevel.h
4793970
+++ b/patchlevel.h
4793970
@@ -25,6 +25,6 @@
4793970
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
4793970
    looks for to find the patch level (for the sccs version string). */
4793970
 
4793970
-#define PATCHLEVEL 14
4793970
+#define PATCHLEVEL 15
4793970
 
4793970
 #endif /* _PATCHLEVEL_H_ */
4793970
-- 
4793970
2.25.1
4793970