History log of /freebsd-13.1/usr.bin/diff/diffreg.c (Results 1 – 25 of 36)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/12.4.0, release/13.1.0, release/12.3.0
# bda949b6 22-Aug-2021 Piotr Pawel Stefaniak <[email protected]>

diff: read whole files to determine if they are ASCII text

Before this change, only the first BUFSIZE bytes were checked.

(cherry picked from commit 3cbf98e2bee91db9ed9118ff557e02cdd449f49a)


# ece58f7a 22-Aug-2021 Piotr Pawel Stefaniak <[email protected]>

diff: don't output carriage returns that were stripped on input

--strip-trailing-cr worked as intended for comparison between files,
but the characters were still present in final output.

(cherry p

diff: don't output carriage returns that were stripped on input

--strip-trailing-cr worked as intended for comparison between files,
but the characters were still present in final output.

(cherry picked from commit af2f0164318455433db95adce07af829285b78ad)

show more ...


# 7a7324d9 06-Jul-2021 Alex Richardson <[email protected]>

usr.bin/diff: fix UBSan error in readhash

UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is

usr.bin/diff: fix UBSan error in readhash

UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is well-defined.

Reviewed By: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31075

(cherry picked from commit c78f449d85e0b292fe5d942cca99f11c1cd430fa)

show more ...


Revision tags: release/13.0.0
# 7904a2e5 27-Jan-2021 Baptiste Daroussin <[email protected]>

diff: eleminitate useless macros

The diff_output was not bringing any values but was obfuscating
the code.

(cherry picked from commit 7a57c9cb5a4dffb0483beeae6da7cf266ea634be)


# b6b26cec 26-Jan-2021 Baptiste Daroussin <[email protected]>

diff: simplify the hash functions

Instead of 3 different complex case they have all been folded into a
simple on based on switch

(cherry picked from commit e43239f5140e1b80de122458a2ac037172866058)


# ffbf0225 26-Jan-2021 Baptiste Daroussin <[email protected]>

diff: fix typo in a comment

(cherry picked from commit e52546a3a75f6e4b327178f4d50a98dd99101c64)


# 0ce985a2 27-Jan-2021 Baptiste Daroussin <[email protected]>

diff: eliminate space at end of line

No functionnal changes

(cherry picked from commit 15abb23286541c17ff95bac056cd4979822c4288)


# 3728c4d3 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

(cherry picked from commit fefb3c46a80fdde6f307e73a2b5b5aed806df1ce)

show more ...


# 12a8d302 09-Jan-2021 Ed Maste <[email protected]>

diff: honour flags with -q

Previously -q (just print a line when files differ) ignored flags like
-w (ignore whitespace). Avoid the D_BRIEF short-circuit when flags are
in effect.

PR: 252515
Repo

diff: honour flags with -q

Previously -q (just print a line when files differ) ignored flags like
-w (ignore whitespace). Avoid the D_BRIEF short-circuit when flags are
in effect.

PR: 252515
Reported by: Scott Aitken
Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28064

show more ...


Revision tags: release/12.2.0
# fb0d1c69 01-Sep-2020 Baptiste Daroussin <[email protected]>

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 K

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
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26232

show more ...


Revision tags: release/11.4.0
# 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


# 7dddaa09 14-Jan-2020 Mark Johnston <[email protected]>

Do not skip line-by-line comparison if -q and -I are specified.

This fixes a regression from r356695.

Submitted by: kevans
Reported by: Jenkins via lwhsu
MFC after: 6 days


# 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


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

mkstemp returns -1

Obtained from: OpenBSD
MFC after: 3 days


# 5248d3b1 13-Jan-2020 Mark Johnston <[email protected]>

Optimize diff -q.

Once we know whether the files differ, we don't need to do any further
work.

PR: 242828
Submitted by: fehmi noyan isi <[email protected]> (original version)
Reviewed by: bapt,

Optimize diff -q.

Once we know whether the files differ, we don't need to do any further
work.

PR: 242828
Submitted by: fehmi noyan isi <[email protected]> (original version)
Reviewed by: bapt, kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23152

show more ...


Revision tags: release/12.1.0, release/11.3.0, release/12.0.0
# 377421df 04-Nov-2018 Mariusz Zaborski <[email protected]>

capsicum: use a new capsicum helpers in tools

Use caph_{rights,ioctls,fcntls}_limit to simplify the code.


# 9488de00 19-Aug-2018 Kyle Evans <[email protected]>

diff(1): Refactor -B a little bit

Instead of doing a second pass to skip empty lines if we've specified -I, go
ahead and check both at once. Ignore critera has been split out into its own
function t

diff(1): Refactor -B a little bit

Instead of doing a second pass to skip empty lines if we've specified -I, go
ahead and check both at once. Ignore critera has been split out into its own
function to try and keep the logic cleaner.

show more ...


# 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 ...


# 9977c7b5 27-Jul-2018 Xin LI <[email protected]>

Improve --strip-trailing-cr handling:

- Advance ctold for f1 and ctnew for f2
- ungetc() if the character is unexpected
- Don't break early when we hit the combination on one side

PR: 230049
Re

Improve --strip-trailing-cr handling:

- Advance ctold for f1 and ctnew for f2
- ungetc() if the character is unexpected
- Don't break early when we hit the combination on one side

PR: 230049
Reported by: maskray <emacsray gmail com>
Reviewed by: bapt, maskray
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16451

show more ...


Revision tags: release/11.2.0
# 7672a014 19-Jun-2018 Mariusz Zaborski <[email protected]>

Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.

No functional change intended.


# 6fa5bf08 09-Jun-2018 Baptiste Daroussin <[email protected]>

Isolate the pr(1) related code in its own source files

This keeps diffreg.c closer to what it is supposed to do:
diffing regular files.

It also allows my code to get a proper license


# 0118df5e 13-Dec-2017 Baptiste Daroussin <[email protected]>

Replace homemade equivalent of tolower(3) by towlower(3)

This will help in the futur making diff -i works with multibyte


# df57947f 18-Nov-2017 Pedro F. Giffuni <[email protected]>

spdx: initial adoption of licensing ID tags.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensou

spdx: initial adoption of licensing ID tags.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes: yes
Differential Revision: https://reviews.freebsd.org/D13133

show more ...


Revision tags: release/10.4.0, release/11.1.0
# 4d8c5790 17-Jul-2017 Enji Cooper <[email protected]>

Don't emit "diff: diff <options> arguments" when diffing files if
-q is specified.

This improves compatibility with GNU diff.

Found by accident with `diff -Nrq /usr/tests /usr/tests.new | grep Kyua

Don't emit "diff: diff <options> arguments" when diffing files if
-q is specified.

This improves compatibility with GNU diff.

Found by accident with `diff -Nrq /usr/tests /usr/tests.new | grep Kyuafile`.

MFC after: 2 months
Relnotes: yes

show more ...


# 7ef35d05 24-Apr-2017 Dimitry Andric <[email protected]>

Fix the following warning from gcc 4.2 in usr.bin/diff:

usr.bin/diff/diffreg.c: In function 'change':
usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function

This versi

Fix the following warning from gcc 4.2 in usr.bin/diff:

usr.bin/diff/diffreg.c: In function 'change':
usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function

This version of gcc is not smart enough to see that 'i' cannot actually
be used unitialized. However, the variable is confusingly re-used, so
it is better to give it another name, and clearly initialize it before
attempting to use it.

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

show more ...


12