Subject: bug#25595: closed (Re: [bug-diffutils] bug#25595: [PATCH] diff: avoid UMR with ---presume-output-tty)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 01 Feb 2017 01:09:02 +0000

Your bug report

#25595: [PATCH] diff: avoid UMR with ---presume-output-tty

which was filed against the diffutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
25595: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25595
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug-diffutils] bug#25595: [PATCH] diff: avoid UMR with ---presume-output-tty
From: Jim Meyering <[email-masked]>
To: [email-masked], "Nelson H. F. Beebe" <[email-masked]>
Date: Tue, 31 Jan 2017 17:08:20 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On Tue, Jan 31, 2017 at 4:50 PM, Jim Meyering <[email-masked]> wrote:
> Thanks to a private bug report from Nelson Beebe, I learned
> that the "colors" test was failing on many different types of hosts.
> It was due to a UMR bug. Here is the fix I've just pushed.
> Sorry, Nelson, I've just realized that I forgot to attribute you
> in the commit log.

I also failed to mention when that was introduced in NEWS, so
here is a fix-up patch to address both issues:
From affa30def0d530022a03845372ec19c644f8f1ac Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Tue, 31 Jan 2017 17:06:10 -0800
Subject: [PATCH] maint: add "introduced in 3.4" in latest NEWS entry

* NEWS: Update.  Also, thanks to Nelson Beebe for reporting this.
---
 NEWS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/NEWS b/NEWS
index 0afee1b..eae32b2 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ GNU diffutils NEWS                                    -*- outline -*-

   the ---presume-output-tty (ostensibly test-only) option would cause
   diff --color to read an uninitialized variable
+  [bug introduced in 3.4]

 ** Performance changes

-- 
2.9.3

Subject: [PATCH] diff: avoid UMR with ---presume-output-tty
From: Jim Meyering <[email-masked]>
To: [email-masked], "Nelson H. F. Beebe" <[email-masked]>
Date: Tue, 31 Jan 2017 16:50:19 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks to a private bug report from Nelson Beebe, I learned
that the "colors" test was failing on many different types of hosts.
It was due to a UMR bug. Here is the fix I've just pushed.
Sorry, Nelson, I've just realized that I forgot to attribute you
in the commit log.
From eaa2a24345fba918eb7ad7a6a263e7e639d82d5f Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Tue, 31 Jan 2017 16:44:03 -0800
Subject: [PATCH] diff: avoid UMR with ---presume-output-tty

* src/diff.c (main): Always define presume_output_tty.
Otherwise, it would be read uninitialized.
Introduced in v3.3-45-g17e2698
* NEWS (Bug fixes): Mention it.
---
 NEWS       | 3 +++
 src/diff.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/NEWS b/NEWS
index 030432f..0afee1b 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ GNU diffutils NEWS                                    -*- outline -*-

   diff no longer mishandles line numbers exceeding 2**31 on Mingw-w64.

+  the ---presume-output-tty (ostensibly test-only) option would cause
+  diff --color to read an uninitialized variable
+
 ** Performance changes

   diff's default algorithm has been tweaked to deal better with larger
diff --git a/src/diff.c b/src/diff.c
index efcedf9..76851ac 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -296,6 +296,7 @@ main (int argc, char **argv)
   ignore_regexp_list.buf = &ignore_regexp;
   re_set_syntax (RE_SYNTAX_GREP | RE_NO_POSIX_BACKTRACKING);
   excluded = new_exclude ();
+  presume_output_tty = false;

   /* Decode the options.  */

-- 
2.8.0-rc2