From 5d3684b8c5938d4f4b94ac177aa0a2ee77018da7 Mon Sep 17 00:00:00 2001
From: Koichi Murase <myoga.murase@gmail.com>
Date: Sun, 27 Jun 2021 11:35:16 +0900
Subject: [PATCH 1/4] subst, parse: add missing ifdef DEBUG

---
 parse.y | 10 ++++++++++
 subst.c |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/parse.y b/parse.y
index 7cd59e30..d28d4af8 100644
--- a/parse.y
+++ b/parse.y
@@ -1188,7 +1188,9 @@ simple_list:	simple_list1
 			    gather_here_documents ();
 			  if ((parser_state & PST_CMDSUBST) && current_token == shell_eof_token)
 			    {
+#ifdef DEBUG
 itrace("LEGACY: parser: command substitution simple_list1 -> simple_list");
+#endif
 			      global_command = $1;
 			      eof_encountered = 0;
 			      if (bash_input.type == st_string)
@@ -1206,7 +1208,9 @@ itrace("LEGACY: parser: command substitution simple_list1 -> simple_list");
 			    gather_here_documents ();
 			  if ((parser_state & PST_CMDSUBST) && current_token == shell_eof_token)
 			    {
+#ifdef DEBUG
 itrace("LEGACY: parser: command substitution simple_list1 '&' -> simple_list");
+#endif
 			      global_command = $1;
 			      eof_encountered = 0;
 			      if (bash_input.type == st_string)
@@ -1221,7 +1225,9 @@ itrace("LEGACY: parser: command substitution simple_list1 '&' -> simple_list");
 			    gather_here_documents ();
 			  if ((parser_state & PST_CMDSUBST) && current_token == shell_eof_token)
 			    {
+#ifdef DEBUG
 itrace("LEGACY: parser: command substitution simple_list1 ';' -> simple_list");
+#endif
 			      global_command = $1;
 			      eof_encountered = 0;
 			      if (bash_input.type == st_string)
@@ -4069,7 +4075,9 @@ parse_comsub (qc, open, close, lenp, flags)
 
   if (need_here_doc)
 {
+#ifdef DEBUG
 itrace("parse_comsub: need_here_doc = %d after yyparse()?", need_here_doc);
+#endif
     gather_here_documents ();
 }
 
@@ -4086,7 +4094,9 @@ itrace("parse_comsub: need_here_doc = %d after yyparse()?", need_here_doc);
 
   if (current_token != shell_eof_token)
 {
+#ifdef DEBUG
 itrace("current_token (%d) != shell_eof_token (%c)", current_token, shell_eof_token);
+#endif
     token_to_read = current_token;
 }
 
diff --git a/subst.c b/subst.c
index 15979bd9..497003dd 100644
--- a/subst.c
+++ b/subst.c
@@ -10211,8 +10211,10 @@ expand_array_subscript (string, sindex, quoted, flags)
   if (ni >= slen || string[ni] != RBRACK || (ni - si) == 1 ||
       (string[ni+1] != '\0' && (quoted & Q_ARITH) == 0))
     {
+#ifdef DEBUG
 /* let's check and see what fails this check */
 itrace("expand_array_subscript: bad subscript string: `%s'", string+si);
+#endif
       ret = (char *)xmalloc (2);	/* badly-formed subscript */
       ret[0] = string[si];
       ret[1] = '\0';
-- 
2.21.3

