File 0570-to_erl-Do-not-make-DEBUG-flag-enable-debug-logging.patch of Package erlang

From 8fbf0af79fc0baa3cd884547cd4b1c047b7f26d3 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Sat, 2 Jul 2022 19:59:43 +0200
Subject: [PATCH 5/5] to_erl: Do not make DEBUG flag enable debug logging

The log messages mess with testing and are really only meant
to help when debugging to_erl, not when running it in tests.
---
 erts/etc/unix/to_erl.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/erts/etc/unix/to_erl.c b/erts/etc/unix/to_erl.c
index f9ca5f6373..6ebe793edc 100644
--- a/erts/etc/unix/to_erl.c
+++ b/erts/etc/unix/to_erl.c
@@ -82,13 +82,13 @@
 #  define STRERROR(x) ""
 #endif
 
-#define noDEBUG
+#define noDEBUG_TOERL
 
 #define PIPE_DIR        "/tmp/"
 #define PIPE_STUBNAME   "erlang.pipe"
 #define PIPE_STUBLEN    strlen(PIPE_STUBNAME)
 
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
 #define STATUS(s)  { fprintf(stderr, (s)); fflush(stderr); }
 #else
 #define STATUS(s)
@@ -106,7 +106,7 @@ static int protocol_ver = RUN_ERL_LO_VER; /* assume lowest to begin with */
 static int write_all(int fd, const char* buf, int len);
 static int window_size_seq(char* buf, size_t bufsz);
 static int version_handshake(char* buf, int len, int wfd);
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
 static void show_terminal_settings(struct termios *);
 #endif
 
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
 	pipeIx = 2;
     }
     
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
     fprintf(stderr, "%s: pid is : %d\n", argv[0], (int)getpid());
 #endif
     
@@ -209,25 +209,25 @@ int main(int argc, char **argv)
     }
 
     if ((rfd = open (FIFO1, O_RDONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
 	fprintf(stderr, "Could not open FIFO %s for reading.\n", FIFO1);
 #endif
 	fprintf(stderr, "No running Erlang on pipe %s: %s\n", pipename, strerror(errno));
 	exit(1);
     }
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
     fprintf(stderr, "to_erl: %s opened for reading\n", FIFO1);
 #endif
     
     if ((wfd = open (FIFO2, O_WRONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
 	fprintf(stderr, "Could not open FIFO %s for writing.\n", FIFO2);
 #endif
 	fprintf(stderr, "No running Erlang on pipe %s: %s\n", pipename, strerror(errno));
 	close(rfd);
 	exit(1);
     }
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
     fprintf(stderr, "to_erl: %s opened for writing\n", FIFO2);
 #endif
     
@@ -245,7 +245,7 @@ int main(int argc, char **argv)
     }
     tty_smode = tty_rmode;
     tty_eof = '\004'; /* Ctrl+D to exit */
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
     show_terminal_settings(&tty_rmode);
 #endif
     tty_smode.c_iflag =
@@ -347,7 +347,7 @@ int main(int argc, char **argv)
     
     tcsetattr(0, TCSADRAIN, &tty_smode);
     
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
     show_terminal_settings(&tty_smode);
 #endif
     /*
@@ -420,7 +420,7 @@ int main(int argc, char **argv)
 	}
 
 	if (len) {
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
 	    if(write(1, buf, len));
 #endif
 	    if (write_all(wfd, buf, len) != len) {
@@ -580,7 +580,7 @@ static int version_handshake(char* buf, int len, int wfd)
 }
 
 
-#ifdef DEBUG
+#ifdef DEBUG_TOERL
 #define S(x)  ((x) > 0 ? 1 : 0)
 
 static void show_terminal_settings(struct termios *t)
-- 
2.35.3

openSUSE Build Service is sponsored by