Patch was dead simple, so I just created it just in case. On Thu, Oct 6, 2016 at 2:46 PM, Norbert Kiesel <nkie...@gmail.com> wrote:
> I like the two-step approach. And this is clearly a feature that does not > need to be rushed. You want me to send a patch for step#1? > > On Thu, Oct 6, 2016 at 1:19 PM, Paul Eggert <egg...@cs.ucla.edu> wrote: > >> On 10/06/2016 12:48 PM, Norbert Kiesel wrote: >> >>> But we should be able to support a GNU_DIFF_FORMAT environment >>> variable that sets the default format, no? >>> >> >> It might be a good idea to change the default output format. I expect the >> first step would be to change 'diff' to warn on stderr if no output format >> option is specified; you could silence the warning with the --normal >> option, or by setting POSIXLY_CORRECT. This step should also document the >> first step (and the intent to change the default) in the usual places. >> After some time in some later release we could then change the default. >> >> I'd rather not have diff's behavior depend on a new environment variable. >> Environment variables are a pain to get right and something like this could >> break security-relevant code. >> >> >
From 4cd7cbcff3361f0b17db2627301cebc359e02150 Mon Sep 17 00:00:00 2001 From: Norbert Kiesel <nkie...@metricstream.com> Date: Thu, 6 Oct 2016 15:32:50 -0700 Subject: [PATCH] diff: Warn about future change to default style diff still uses --normal as default diff style, although this is no longer recommended to be used and also actually mostly unused. Thus, futire versions of diff will switch to --unified as new default style. This commit only adds a warning informing users of that future change. --- NEWS | 7 +++++++ src/diff.c | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 473332e..ab66ffb 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ GNU diffutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New features + + If the diff output style is not set, diff prints a warning that a future + release will switch the default output style from --normal to --unified. This + warning can be suppressed by setting the POSIXLY_CORRECT environment variable + (though that has some other side effects as well). + ** Bug fixes diff no longer mishandles line numbers exceeding 2**31 on Mingw-w64. diff --git a/src/diff.c b/src/diff.c index 686945e..12792a1 100644 --- a/src/diff.c +++ b/src/diff.c @@ -672,7 +672,12 @@ main (int argc, char **argv) context = 3; } else - specify_style (OUTPUT_NORMAL); + { + char const *t = getenv ("POSIXLY_CORRECT"); + if (!t) + error (0, 0, _("Future versions of diff will use --unified instead of --normal as default style")); + specify_style (OUTPUT_NORMAL); + } } if (output_style != OUTPUT_CONTEXT || hard_locale (LC_TIME)) -- 2.9.3