Blob Blame History Raw
From 280bd77d8d3e7f7c90c9fa07de3d1e8f8e18ac29 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 14 Nov 2016 14:27:06 -0500
Subject: [PATCH] Bash-4.4 patch 2

---
 patchlevel.h | 2 +-
 subst.c      | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/patchlevel.h b/patchlevel.h
index 40db1a3..a988d85 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 1
+#define PATCHLEVEL 2
 
 #endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index f1a4df1..4d498ef 100644
--- a/subst.c
+++ b/subst.c
@@ -5931,6 +5931,7 @@ read_comsub (fd, quoted, rflag)
   char *istring, buf[128], *bufp, *s;
   int istring_index, istring_size, c, tflag, skip_ctlesc, skip_ctlnul;
   ssize_t bufn;
+  int nullbyte;
 
   istring = (char *)NULL;
   istring_index = istring_size = bufn = tflag = 0;
@@ -5938,6 +5939,8 @@ read_comsub (fd, quoted, rflag)
   for (skip_ctlesc = skip_ctlnul = 0, s = ifs_value; s && *s; s++)
     skip_ctlesc |= *s == CTLESC, skip_ctlnul |= *s == CTLNUL;
 
+  nullbyte = 0;
+
   /* Read the output of the command through the pipe.  This may need to be
      changed to understand multibyte characters in the future. */
   while (1)
@@ -5956,7 +5959,11 @@ read_comsub (fd, quoted, rflag)
       if (c == 0)
 	{
 #if 1
-	  internal_warning ("%s", _("command substitution: ignored null byte in input"));
+	  if (nullbyte == 0)
+	    {
+	      internal_warning ("%s", _("command substitution: ignored null byte in input"));
+	      nullbyte = 1;
+	    }
 #endif
 	  continue;
 	}
-- 
2.9.3