From c145a6c86a1c30808006857e34dee4d398ce57c7 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 25 Jan 2021 12:18:27 +0200
Subject: [PATCH] Revert "Redirect macro stack backtrace printing to debug
 log."

The rationale behind the change was to suppress the excessive output
when trying to expand a recursive macro definition (RhBug:613010) but
this is not so good as it effectively suppresses *all* backtrace output,
include those requested by %trace where the other half is printed to
stderr and the other half in the debug log because of the change.

Besides making things consistent, this also avoids deadlock on
`rpm -vv --eval '%trace'`.

This reverts commit 7f220202f20c69d6f3fd957325cdbe692bbabedd.

Fixes: #1418
---
 rpmio/macro.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/rpmio/macro.c b/rpmio/macro.c
index 7993e9e5d..a342b2403 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -358,7 +358,7 @@ static void
 printExpansion(MacroBuf mb, const char * t, const char * te)
 {
     if (!(te > t)) {
-	rpmlog(RPMLOG_DEBUG, _("%3d<%*s(empty)\n"), mb->depth, (2 * mb->depth + 1), "");
+	fprintf(stderr, _("%3d<%*s(empty)\n"), mb->depth, (2 * mb->depth + 1), "");
 	return;
     }
 
@@ -374,10 +374,10 @@ printExpansion(MacroBuf mb, const char * t, const char * te)
 
     }
 
-    rpmlog(RPMLOG_DEBUG,"%3d<%*s", mb->depth, (2 * mb->depth + 1), "");
+    fprintf(stderr, "%3d<%*s", mb->depth, (2 * mb->depth + 1), "");
     if (te > t)
-	rpmlog(RPMLOG_DEBUG, "%.*s", (int)(te - t), t);
-    rpmlog(RPMLOG_DEBUG, "\n");
+	fprintf(stderr, "%.*s", (int)(te - t), t);
+    fprintf(stderr, "\n");
 }
 
 #define	SKIPBLANK(_s, _c)	\
-- 
2.27.0

