Subject: Re: [bug-diffutils] bug#22067: bug#20062: bug#20062: [PATCH] diff: add support for --color

From: Giuseppe Scrivano <[email-masked]>
Date: Mon, 01 Feb 2016 10:10:05 +0100

Giuseppe Scrivano <[email-masked]> writes:

> Bug 3 is a bug on all platforms, set_color_context should call
> process_signals only when color_context != RESET_CONTEXT.  I'll send a
> patch for that.

I've attached a patch for this bug.

Regards,
Giuseppe

>From c9326d016a05c594b8cd2f19effe792c23fde3ef Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <[email-masked]>
Date: Mon, 1 Feb 2016 09:58:52 +0100
Subject: [PATCH] Fix an infinite recursion with --color

* src/util.c: Call process_signals only when color_context is not
RESET_CONTEXT.

Reported by Gisle Vanem in http://debbugs.gnu.org/22067
---
 src/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util.c b/src/util.c
index bf9ed97..26615ca 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1349,7 +1349,8 @@ static enum color_context last_context = RESET_CONTEXT;
 void
 set_color_context (enum color_context color_context)
 {
-  process_signals ();
+  if (color_context != RESET_CONTEXT)
+    process_signals ();
   if (colors_enabled && last_context != color_context)
     {
       put_indicator (&color_indicator[C_LEFT]);
-- 
2.5.0