Bug 244533 - [patch] diff(1) --label not honoured for "print_status"
Summary: [patch] diff(1) --label not honoured for "print_status"
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2020-03-01 04:53 UTC by Jamie Landeg-Jones
Modified: 2020-09-19 20:16 UTC (History)
4 users (show)

See Also:


Attachments
patch to restore -label functionality (391 bytes, text/plain)
2020-03-01 04:53 UTC, Jamie Landeg-Jones
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jamie Landeg-Jones 2020-03-01 04:53:47 UTC
Created attachment 212065 [details]
patch to restore -label functionality

Various options to "diff(1)" show filenames, and traditionally make use of the "--label" parameter, if set.

The BSD diff supports --label for unified and context diffs, but doesn't for these other cases. GNU diff, as previously installed in base did:

% diff --label hello --label world -s /COPYRIGHT /COPYRIGHT
Files /COPYRIGHT and /COPYRIGHT are identical

% gdiff --label hello --label world -s /COPYRIGHT /COPYRIGHT
Files hello and world are identical

% diff --label hello --label world /bin/ls /bin/pwd
Binary files /bin/ls and /bin/pwd differ

% gdiff --label hello --label world /bin/ls /bin/pwd
Binary files hello and world differ

etc.

The attached patch restores the previous behaviour.

Cheers, Jamie
Comment 1 Kyle Evans freebsd_committer 2020-03-03 18:55:53 UTC
CC'ing myself and bapt@
Comment 2 Jamie Landeg-Jones 2020-05-13 01:31:41 UTC
Hi. Any chance this will make it into 12.2?

Cheers
Comment 3 Kyle Evans freebsd_committer 2020-05-13 01:39:35 UTC
The patch looks trivial enough to me; as a style nit, we'll want to push the path1/path2 assignments off to the next line, but this can be done pre-commit.

I'll coordinate with bapt@, but given the length of time between here and 12.2 it will certainly be there.
Comment 4 Jamie Landeg-Jones 2020-05-13 21:41:01 UTC
Thanks for the info, Kyle!

And sorry for the style formatting - I don't know how I managed to not notice that when submitting!

Cheers, Jamie
Comment 5 commit-hook freebsd_committer 2020-06-01 09:01:58 UTC
A commit references this bug:

Author: bapt
Date: Mon Jun  1 09:01:14 UTC 2020
New revision: 361688
URL: https://svnweb.freebsd.org/changeset/base/361688

Log:
  Restore compatibility with GNU diff regarding --label

  Various options to "diff(1)" show filenames, and traditionally make use of the
  "--label" parameter, if set.

  Restore this behaviour in BSD diff.

  While here add a regression test

  PR:		244533
  Submitted by:	Jamie Landeg-Jones <jamie@catflap.org>
  MFC after:	3 days

Changes:
  head/usr.bin/diff/diff.c
  head/usr.bin/diff/tests/diff_test.sh
Comment 6 Baptiste Daroussin freebsd_committer 2020-06-01 09:11:29 UTC
Thanks for reporting and sorry for the delay
Comment 7 Jamie Landeg-Jones 2020-09-07 23:15:54 UTC
(In reply to Baptiste Daroussin from comment #6)

MFC in time for 12.2? :-)

Cheers
Comment 8 commit-hook freebsd_committer 2020-09-19 20:16:36 UTC
A commit references this bug:

Author: bapt
Date: Sat Sep 19 20:15:52 UTC 2020
New revision: 365914
URL: https://svnweb.freebsd.org/changeset/base/365914

Log:
  MFC r361688-r361690, r365041

  r361688:
  Restore compatibility with GNU diff regarding --label

  Various options to "diff(1)" show filenames, and traditionally make use of the
  "--label" parameter, if set.

  Restore this behaviour in BSD diff.

  While here add a regression test

  PR:  244533
  Submitted by: Jamie Landeg-Jones <jamie@catflap.org>

  r361689:
  diff: restore compatibility with GNU diff regarding -N option

  When -N is used the missing files are treated as empty.

  PR:  233402
  Submitted by: Fehmi Noyan Isi <fnoyanisi@yahoo.com>
  Reported by: Roman Neuhauser <roman@sigpipe.cz>
  Differential Revision: D25081

  r361690:
  Document long version of -b option

  PR:  234195
  Submitted by: Fehmi Noyan Isi <fnoyanisi@yahoo.com>
  Reported by: Andras Farkas <deepbluemistake@gmail.com>

  r365041:
  diff: always properly kill pr(1)

  When diff is invoked with -l it will spawn the pr(1) program.
  In some circumpstances the pr(1) was not properly killed when diff program
  exits.

  Submitted by: Bret Ketchum
  Differential Revision: https://reviews.freebsd.org/D26232

Changes:
_U  stable/12/
  stable/12/usr.bin/diff/diff.1
  stable/12/usr.bin/diff/diff.c
  stable/12/usr.bin/diff/diffreg.c
  stable/12/usr.bin/diff/tests/diff_test.sh