History log of /freebsd-14.2/usr.bin/diff/diff.c (Results 1 – 25 of 30)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0
# 45fc3733 29-Jul-2024 Dag-Erling Smørgrav <[email protected]>

diff: Fix usage message and documentation.

The `--ignore-all-space` option was incorrectly documented as
`--ignore-all-blanks` in some (but not all) places.

MFC after: 3 days
PR: 280434
Sponsored

diff: Fix usage message and documentation.

The `--ignore-all-space` option was incorrectly documented as
`--ignore-all-blanks` in some (but not all) places.

MFC after: 3 days
PR: 280434
Sponsored by: Klara, Inc.
Reviewed by: 0mp, markj
Differential Revision: https://reviews.freebsd.org/D46160

(cherry picked from commit ab830de9f58c1b257e42b4fbdd46b3ca6a837ee6)

show more ...


# 16a75375 30-Jun-2024 Dag-Erling Smørgrav <[email protected]>

diff: Document the --no-dereference option.

Also, --no-dereference should not imply --recurse.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://revi

diff: Document the --no-dereference option.

Also, --no-dereference should not imply --recurse.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D45779

(cherry picked from commit 4ce4a0fe14c455c6ec77452bc99cd93ea45737b1)

show more ...


Revision tags: release/14.1.0, release/13.3.0
# da290528 26-Feb-2024 Dag-Erling Smørgrav <[email protected]>

diff: Fix --expand-tabs and --side-by-side.

* Overhaul column width and padding calculation.
* Rewrite print_space() so it is now a) correct and b) understandable.
* Rewrite tab expansion in fetch()

diff: Fix --expand-tabs and --side-by-side.

* Overhaul column width and padding calculation.
* Rewrite print_space() so it is now a) correct and b) understandable.
* Rewrite tab expansion in fetch() for the same reason.

This brings us in line with GNU diff for all cases I could think of.

Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44014

(cherry picked from commit 53de23f4d140becc3166e87665b0064f215a220e)

diff: Bump manual page date.

Sponsored by: Klara, Inc.

(cherry picked from commit 312b1076c6b0aff9bbcaff058b93385eaf607685)

show more ...


Revision tags: release/14.0.0
# 1d386b48 16-Aug-2023 Warner Losh <[email protected]>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0
# 93b7af1d 10-Mar-2022 Tom Jones <[email protected]>

diff: Re-add void argument to usage

Previous commit (8cf449db88b2c7a505bc241a78f9736b43f2ede5)
unintentionally dropped the 'void' argument to usage, reinstate it.

Sponsored by: Klara Inc.


# 8cf449db 10-Mar-2022 Tom Jones <[email protected]>

diff: add support for --help and --version

Add support for --help and --version to be compatible with gnu diff.

gnu diff --help writes to stdout, do the same to be compatible

Reviewed by: bapt, ps

diff: add support for --help and --version

Add support for --help and --version to be compatible with gnu diff.

gnu diff --help writes to stdout, do the same to be compatible

Reviewed by: bapt, pstef, debrup, Pau Amma
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34508

show more ...


# 7e64519a 08-Mar-2022 Tom Jones <[email protected]>

diff: set cflag when passed to diff

In b5541f456d641d23e0c46874daff0b62552bf3cb when flags were converted to
be boolean, the setting of cflag as an integer was removed, but no
boolean set was added.

diff: set cflag when passed to diff

In b5541f456d641d23e0c46874daff0b62552bf3cb when flags were converted to
be boolean, the setting of cflag as an integer was removed, but no
boolean set was added.

This effects the output format of dates, but the context type was set to
D_CONTEXT so other functionality worked.

Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34481

show more ...


# f4be3645 18-Feb-2022 Tom Jones <[email protected]>

diff: add --no-dereference flag

When diffing files and directories, don't follow symbolic links, instead
compare where the links point to.

Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Re

diff: add --no-dereference flag

When diffing files and directories, don't follow symbolic links, instead
compare where the links point to.

Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34203

show more ...


Revision tags: release/12.3.0
# e51aabf8 05-Sep-2021 Piotr Pawel Stefaniak <[email protected]>

diff: implement option -F (--show-function-line)

With unified and context diffs, show the last line that matches the
provided pattern before the context.

Reviewed by: bapt
Differential Revision: ht

diff: implement option -F (--show-function-line)

With unified and context diffs, show the last line that matches the
provided pattern before the context.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D31714

show more ...


# f38702e5 05-Sep-2021 Cameron Katri <[email protected]>

diff(1): Add --color support

Adds a --color flag to diff(1) that supports the same options as GNU's
diff(1). The colors are customizable with the env var DIFFCOLORS in
a format similar to grep(1)'s

diff(1): Add --color support

Adds a --color flag to diff(1) that supports the same options as GNU's
diff(1). The colors are customizable with the env var DIFFCOLORS in
a format similar to grep(1)'s GREPCOLORS. An example would be 04;36:41
for additions to be underlined light blue, and deletions have a red
background.

Differential Revision: https://reviews.freebsd.org/D30545

show more ...


# e43df07e 04-Sep-2021 Piotr Pawel Stefaniak <[email protected]>

diff: move functions around and reduce their visibility

Most of them become static. There will be more such functions added in
upcoming commits, so they would be inconsistent with existing code.
Imp

diff: move functions around and reduce their visibility

Most of them become static. There will be more such functions added in
upcoming commits, so they would be inconsistent with existing code.
Improve the existing code instead of reinforcing the unwanted pattern.

show more ...


# b5541f45 04-Sep-2021 Piotr Pawel Stefaniak <[email protected]>

diff: convert boolean flag variables to bool

There will be more boolean flags added in upcoming commits and they
would have to be stored in ints in order to be consistent with existing
code. Change

diff: convert boolean flag variables to bool

There will be more boolean flags added in upcoming commits and they
would have to be stored in ints in order to be consistent with existing
code. Change the existing code to use the bool type.

show more ...


# 03582021 29-Aug-2021 Piotr Pawel Stefaniak <[email protected]>

diff: improve code style

Reflow comments, strip trailing space, improve wrapping of lines.


Revision tags: release/13.0.0
# fefb3c46 25-Jan-2021 Jamie Landeg-Jones <[email protected]>

diff: fix incorrectly displaying files as duplicates

When diff hits certain access errors, function diffreg() shows the error
message, and then returns to the calling function, which calls
print_sta

diff: fix incorrectly displaying files as duplicates

When diff hits certain access errors, function diffreg() shows the error
message, and then returns to the calling function, which calls
print_status() with the return value.

However, in these cases, the return value isn't changed from the initial
default value of D_SAME.

Normally, print_status() with a value of D_SAME does nothing, so this
works out ok, however, if the "-s" flag is set, a message is displayed
showing identicality:

case D_SAME:
if (sflag)
printf("Files %s%s and %s%s are identical\n", path1, entry, path2, entry);
break;

This then produces such results as:

% diff -s /COPYRIGHT /var/run/rpcbind.sock
diff: /var/run/rpcbind.sock: Operation not supported
Files /COPYRIGHT and /var/run/rpcbind.sock are identical

% diff -s /COPYRIGHT /etc/master.passwd
diff: /etc/master.passwd: Permission denied
Files /COPYRIGHT and /etc/master.passwd are identical

Create a D_ERROR status which is returned in such cases, and
print_status() then deals with that status seperately from D_SAME

PR: 252614
MFC after: 1 week

show more ...


# b0d30b27 27-Oct-2020 Kyle Evans <[email protected]>

diff: don't force the format to 'context' with -p immediately

Instead, leave the fomat as unspecified (if it hasn't been) and use the
-p flag as a hint to 'context' if no other formatting option is

diff: don't force the format to 'context' with -p immediately

Instead, leave the fomat as unspecified (if it hasn't been) and use the
-p flag as a hint to 'context' if no other formatting option is specified.

This fixes `diff -purw`, used frequently by emaste, and matches the behavior
of its GNU counterpart.

PR: 250015
Reviewed by: emaste
MFC after: 1 week

show more ...


Revision tags: release/12.2.0, release/11.4.0
# 2816b999 01-Jun-2020 Baptiste Daroussin <[email protected]>

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 <[email protected]>
Reported by: Ro

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 <[email protected]>
Reported by: Roman Neuhauser <[email protected]>
MFC after: 3 days
Differential Revision: D25081

show more ...


# f096ed98 01-Jun-2020 Baptiste Daroussin <[email protected]>

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.

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 <[email protected]>
MFC after: 3 days

show more ...


# 67c90765 28-Apr-2020 Kyle Evans <[email protected]>

diff(1): don't reject specifying the same format multiple times

This may happen, for instance, if one happens to have an alias of diff to
diff -up and attempts to specify the amount of context on to

diff(1): don't reject specifying the same format multiple times

This may happen, for instance, if one happens to have an alias of diff to
diff -up and attempts to specify the amount of context on top of that.

Aliases like this may cause other problems, but if they're really not ever
generating non-unified diffs then we should at least not break that
use-case.

In addition, we'll now pick up a format mismatch if -p is specified with
!contextual && !unified && !unset.

Fix up a small trailing whitespace nit in the tests while we're here, and
add tests to make sure that we can double up all the formatting options.

Reported by: jbeich
MFC after: 3 days

show more ...


# db9cccfb 20-Apr-2020 Kyle Evans <[email protected]>

diff(1): reject conflicting formatting options

This matches GNU diff(1) behavior and, more importantly, eliminates any
source of confusion if multiple formatting options are specified.

Note that th

diff(1): reject conflicting formatting options

This matches GNU diff(1) behavior and, more importantly, eliminates any
source of confusion if multiple formatting options are specified.

Note that the committed diff differs slightly from the submitted: I've
modified it so that we initialize diff_format to something that isn't an
accepted format option so that we can also reject --normal -c and -c
--normal, which would've otherwise been accepted because the default was
--normal. After option parsing we default it to D_NORMAL if it's still
unset.

PR: 243975
Submitted by: fehmi noyan isi
MFC after: 1 week

show more ...


# 43fbd654 13-Feb-2020 Kyle Evans <[email protected]>

diff: fix segfault with --tabsize and no/malformed argument

--tabsize was previously listed as optional_argument, but didn't account for
the optionality of it in the argument handling. This is irrel

diff: fix segfault with --tabsize and no/malformed argument

--tabsize was previously listed as optional_argument, but didn't account for
the optionality of it in the argument handling. This is irrelevant -- the
manpage doesn't indicate that the argument is optional, and indeed there's
no clear interpretation of omitting the argument because there's no other
side effect of --tabsize.

The "malformed" argument part of the header on this message is simply
referring to usage like this:

% diff --tabsize 4 A B

With an optional_argument, the argument must be attached to the parameter
directly (e.g. --tabsize=4), so the argument is effectively NULL with the
above invocation as if no argument had been passed.

PR: 243974
Submitted by: fehmi noyan isi <fnoyanisi yahoo com> (diff.c portion)
MFC after: 3 days

show more ...


# 64793e74 07-Feb-2020 Baptiste Daroussin <[email protected]>

diff: implement -y (--side-by-side) along with -W and --suppress-common-lines

PR: 219933
Submitted by: fehmi noyan isi <[email protected]>
MFC after: 3 weeks


# 12d9c0dc 14-Jan-2020 Baptiste Daroussin <[email protected]>

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case.

Obtained from: OpenBSD
MFC after: 3 days


Revision tags: release/12.1.0, release/11.3.0, release/12.0.0
# e68edb8c 19-Aug-2018 Kyle Evans <[email protected]>

diff(1): Implement -B/--ignore-blank-lines

As noted by cem in r338035, coccinelle invokes diff(1) with the -B flag.
This was not previously implemented here, so one was forced to create a link
for G

diff(1): Implement -B/--ignore-blank-lines

As noted by cem in r338035, coccinelle invokes diff(1) with the -B flag.
This was not previously implemented here, so one was forced to create a link
for GNU diff to /usr/local/bin/diff

Implement the -B flag and add some primitive tests for it. It is implemented
in the same fashion that -I is implemented; each chunk's lines are scanned,
and if a non-blank line is encountered then the chunk will be output.
Otherwise, it's skipped.

MFC after: 2 weeks

show more ...


Revision tags: release/11.2.0, release/10.4.0, release/11.1.0
# ea67c7a0 02-Jun-2017 John Baldwin <[email protected]>

Add -H as an alias for --speed-large-file to match GNU diff.

This is undocumented to match GNU diff where -H is also undocumented.
Some existing software (such as kompare) uses this option by defaul

Add -H as an alias for --speed-large-file to match GNU diff.

This is undocumented to match GNU diff where -H is also undocumented.
Some existing software (such as kompare) uses this option by default.

Reviewed by: emaste, rpokala
Differential Revision: https://reviews.freebsd.org/D11022

show more ...


# fddcb7b8 20-Apr-2017 Baptiste Daroussin <[email protected]>

Implement a basic --changed-group-format

etcupdate(8) requires that option, while GNU diff supports many more variation
of that options, their behaviour beside the simple verion implemented here are

Implement a basic --changed-group-format

etcupdate(8) requires that option, while GNU diff supports many more variation
of that options, their behaviour beside the simple verion implemented here are
quite inconsistent as such I do not plan to implement those.

The only special keyword supported by this implementation are: %< and %>
%= is not implemented as the documentation of GNU diff says: common lines, but
it actually when tested print the changes from the first file

show more ...


12