GNU bug report logs -
#22067
[bug-diffutils] bug#20062: bug#20062: [PATCH] diff: add support for --color
Previous Next
Reported by: Gisle Vanem <gvanem <at> yahoo.no>
Date: Tue, 1 Dec 2015 09:58:02 UTC
Severity: normal
Tags: patch
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Tue, Mar 1, 2016 at 12:25 AM, Giuseppe Scrivano <gscrivano <at> gnu.org> wrote:
> Giuseppe Scrivano <gscrivano <at> gnu.org> writes:
>
>> Jim Meyering <jim <at> meyering.net> writes:
>>
>>> Great! Thank you.
>>>
>>>> but it will need a change in the code as well, since
>>>> the signals are installed only when outputting to a tty:
>>> ...
>>>> - if (output_is_tty)
>>>> + if (output_is_tty || getenv ("DIFF_INSTALL_SIGNALS"))
>>>> install_signal_handlers ();
>>>
>>> However, we try very hard to avoid making tools depend on
>>> environment variable settings more than they already do,
>>> so how about a hidden, three-hyphen option, say,
>>> ---presume-output-tty, analogous to rm's ---presume-input-tty?
>>
>> I have added a test that uses the new option ---presume-output-tty.
>>
>> From 4aea918d31454fdeaada5e2453bea3dfc2e25f8b Mon Sep 17 00:00:00 2001
>> From: Giuseppe Scrivano <gscrivano <at> gnu.org>
>> Date: Mon, 1 Feb 2016 09:58:52 +0100
>> Subject: [PATCH] Fix an infinite recursion with --color
>>
>> * src/diff.h: New extern variable `presume_output_tty'.
>> * src/diff.c: New enum PRESUME_OUTPUT_TTY_OPTION.
>> (group_format_option): Add '-presume-output-tty'.
>> (main): Handle PRESUME_OUTPUT_TTY_OPTION.
>> * src/util.c: New variable `presume_output_tty'.
>> (check_color_output): Handle presume_output_tty.
>> (set_color_context): Call process_signals only when color_context is
>> not RESET_CONTEXT.
>> * tests/colors: Check that diff doesn't crash when interrupted
>> in the middle of a color sequence.
>>
>> Reported by Gisle Vanem in http://debbugs.gnu.org/22067
Thank you, and sorry about the delay.
I noticed that on OS X, the new test passed even without
the fix, but didn't want to let that hold up the fix any longer.
I've adjusted the test slightly, to eliminate the tr pipes.
Will wait for your "ack", before pushing.
[0001-diff-color-fix-an-infinite-recursion-bug.patch (text/x-patch, attachment)]
This bug report was last modified 9 years and 68 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.