<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/usr.bin/diff, branch stable/14</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>diff: Tweak recursion tests</title>
<updated>2026-02-18T00:18:38+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-13T20:18:30+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f10da155fafad0fc450f974e3ae1421d7f78f123'/>
<id>f10da155fafad0fc450f974e3ae1421d7f78f123</id>
<content type='text'>
The -r flag is not required to compare two directories; it is only
required to compare them recursively, i.e. descend into their common
subdirectories.  Adjust tests that use -r needlessly, and adjust the
dirloop test to verify that these two cases remain distinct.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55262

(cherry picked from commit b2532432971fbd9339a9a49eca1b532978bb6d48)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The -r flag is not required to compare two directories; it is only
required to compare them recursively, i.e. descend into their common
subdirectories.  Adjust tests that use -r needlessly, and adjust the
dirloop test to verify that these two cases remain distinct.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55262

(cherry picked from commit b2532432971fbd9339a9a49eca1b532978bb6d48)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Tweak range of -C and -U arguments</title>
<updated>2026-02-18T00:18:37+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-13T20:18:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ce4f512dc004bae5b4b9ec22b449c785e1bf5297'/>
<id>ce4f512dc004bae5b4b9ec22b449c785e1bf5297</id>
<content type='text'>
POSIX uses the terms “positive decimal integer” for -C and “non-negative
decimal integer” for -U, which translates into lower bounds of 1 for -C
and 0 for -U.

POSIX does not specify a minimum upper bound for either mode, but as of
5fc739eb5949 both our backends support context sizes up to and including
INT_MAX, so use that.

Having had the opportunity to consult the Unix System Test Suite, the
diff test cases found therein happen to precisely match these bounds.

While here, switch to using strtonum() to parse numerical arguments, and
try to be more consistent in how we report usage errors.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55261

(cherry picked from commit 790f1d1cc5fa892ba59fd7f239b22064c8ab14c7)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
POSIX uses the terms “positive decimal integer” for -C and “non-negative
decimal integer” for -U, which translates into lower bounds of 1 for -C
and 0 for -U.

POSIX does not specify a minimum upper bound for either mode, but as of
5fc739eb5949 both our backends support context sizes up to and including
INT_MAX, so use that.

Having had the opportunity to consult the Unix System Test Suite, the
diff test cases found therein happen to precisely match these bounds.

While here, switch to using strtonum() to parse numerical arguments, and
try to be more consistent in how we report usage errors.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55261

(cherry picked from commit 790f1d1cc5fa892ba59fd7f239b22064c8ab14c7)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Improve directory loop detection</title>
<updated>2026-02-15T08:58:35+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-11T16:24:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0c5c50353026bd9d7dca862b6033bcc9cbd8cea1'/>
<id>0c5c50353026bd9d7dca862b6033bcc9cbd8cea1</id>
<content type='text'>
When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.

MFC after:	1 week
Reported by:	Bakul Shah &lt;bakul@iitbombay.org&gt;
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55248

(cherry picked from commit 71569594d860a59d8362770a56d806e1d31fb946)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.

MFC after:	1 week
Reported by:	Bakul Shah &lt;bakul@iitbombay.org&gt;
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55248

(cherry picked from commit 71569594d860a59d8362770a56d806e1d31fb946)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Report I/O errors in Stone algorithm</title>
<updated>2026-02-10T14:24:20+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-05T17:41:56+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=37ceb8794c22d88a41e261d23d347bc7ac08b2c8'/>
<id>37ceb8794c22d88a41e261d23d347bc7ac08b2c8</id>
<content type='text'>
In the legacy Stone algorithm, we do a first pass over the files to
check if they're identical before we start diffing them.  That code
would correctly set the exit status if an I/O error was encountered,
but would not emit an error message.  Do so.

PR:		292198
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj
Differential Revision:	https://reviews.freebsd.org/D55125

(cherry picked from commit f8c12e6e3874cdd353fb16785da6f4e7eb134cd9)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the legacy Stone algorithm, we do a first pass over the files to
check if they're identical before we start diffing them.  That code
would correctly set the exit status if an I/O error was encountered,
but would not emit an error message.  Do so.

PR:		292198
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj
Differential Revision:	https://reviews.freebsd.org/D55125

(cherry picked from commit f8c12e6e3874cdd353fb16785da6f4e7eb134cd9)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Correctly declare tests</title>
<updated>2026-02-10T14:24:19+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-05T16:21:22+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b8bcf04d6dd37308834ee258230082ae6875b1f3'/>
<id>b8bcf04d6dd37308834ee258230082ae6875b1f3</id>
<content type='text'>
Sponsored by:	Klara, Inc.
Fixes:		5fc739eb5949 ("diff: Fix integer overflows in Stone algorithm")
Fixes:		270492602b9b ("diff: Add test case for pagination resource leak")
Fixes:		590126789c84 ("diff: Don't compare a file or directory to itself")

(cherry picked from commit 157d6664aeb815db3b758bd3038fd1512a0f4e2c)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sponsored by:	Klara, Inc.
Fixes:		5fc739eb5949 ("diff: Fix integer overflows in Stone algorithm")
Fixes:		270492602b9b ("diff: Add test case for pagination resource leak")
Fixes:		590126789c84 ("diff: Don't compare a file or directory to itself")

(cherry picked from commit 157d6664aeb815db3b758bd3038fd1512a0f4e2c)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Don't compare a file or directory to itself</title>
<updated>2026-02-10T14:24:19+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-05T14:39:57+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7f412c6f88edc3aafb53a83f1743ad49da4679a9'/>
<id>7f412c6f88edc3aafb53a83f1743ad49da4679a9</id>
<content type='text'>
While here, stop abusing struct dirent for something we don't even need
to store.

PR:		254455
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj, kevans
Differential Revision:	https://reviews.freebsd.org/D55113

(cherry picked from commit 590126789c841d80655869bc075c8980c173dd1c)

diff: Fix build

rc must be defined first.

Fixes:		590126789c84
MFC after:	1 week
X-MFC with:	590126789c84

(cherry picked from commit ee44ab936e84bacaa49847d36aabdf280f9fecce)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While here, stop abusing struct dirent for something we don't even need
to store.

PR:		254455
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj, kevans
Differential Revision:	https://reviews.freebsd.org/D55113

(cherry picked from commit 590126789c841d80655869bc075c8980c173dd1c)

diff: Fix build

rc must be defined first.

Fixes:		590126789c84
MFC after:	1 week
X-MFC with:	590126789c84

(cherry picked from commit ee44ab936e84bacaa49847d36aabdf280f9fecce)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Fix pagination leak</title>
<updated>2026-02-10T14:24:19+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-05T14:39:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=144455c333dc0d3db369596038de2e3dd6113b46'/>
<id>144455c333dc0d3db369596038de2e3dd6113b46</id>
<content type='text'>
* Drop an unnecessary variable and rename pidfd to procd.

* Rewinding stdout serves no purpose, so stop doing it.

* Don't bother freeing memory or setting the global status right
  before erroring out.

* Error out if dup(2) or dup2(2) fail.

* In the unlikely case that our pipe is equal to stdout, we need to
  record that information so we don't close it when cleaning up.

* Don't bother closing a descriptor before dup2(2)ing to it.

* Don't forget to close the the process descriptor after reaping the
  child process.

PR:		266592
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, markj
Differential Revision:	https://reviews.freebsd.org/D55112

(cherry picked from commit c3904a7de78ca1ca15fcdf4c09f9d4be7f6fe6f5)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Drop an unnecessary variable and rename pidfd to procd.

* Rewinding stdout serves no purpose, so stop doing it.

* Don't bother freeing memory or setting the global status right
  before erroring out.

* Error out if dup(2) or dup2(2) fail.

* In the unlikely case that our pipe is equal to stdout, we need to
  record that information so we don't close it when cleaning up.

* Don't bother closing a descriptor before dup2(2)ing to it.

* Don't forget to close the the process descriptor after reaping the
  child process.

PR:		266592
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, markj
Differential Revision:	https://reviews.freebsd.org/D55112

(cherry picked from commit c3904a7de78ca1ca15fcdf4c09f9d4be7f6fe6f5)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Add test case for pagination resource leak</title>
<updated>2026-02-10T14:24:19+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-05T14:39:47+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=51c2384ce049ec92e07901cf8a84c171e5d72104'/>
<id>51c2384ce049ec92e07901cf8a84c171e5d72104</id>
<content type='text'>
The pagination code leaks either processes or descriptors or both,
depending on the exact version of the code you have.  Add a test case
which exercises this leak to facilitate fixing it.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj, kevans
Differential Revision:	https://reviews.freebsd.org/D55111

(cherry picked from commit 270492602b9bd8b8fce4f021f055804978bf3f23)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The pagination code leaks either processes or descriptors or both,
depending on the exact version of the code you have.  Add a test case
which exercises this leak to facilitate fixing it.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj, kevans
Differential Revision:	https://reviews.freebsd.org/D55111

(cherry picked from commit 270492602b9bd8b8fce4f021f055804978bf3f23)
</pre>
</div>
</content>
</entry>
<entry>
<title>diff: Fix integer overflows in Stone algorithm</title>
<updated>2026-02-10T14:24:19+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-05T14:39:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=237fd8dd96979412dd65ce95032aa9957463d069'/>
<id>237fd8dd96979412dd65ce95032aa9957463d069</id>
<content type='text'>
Fix integer overflows that may occur when the context window is very
large and add tests to exercise those conditions.

PR:		267032
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj, kevans
Differential Revision:	https://reviews.freebsd.org/D55110

(cherry picked from commit 5fc739eb5949620da911db2f87ca8faedc549d3a)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix integer overflows that may occur when the context window is very
large and add tests to exercise those conditions.

PR:		267032
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj, kevans
Differential Revision:	https://reviews.freebsd.org/D55110

(cherry picked from commit 5fc739eb5949620da911db2f87ca8faedc549d3a)
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Rename fscandir{,_b}() to fdscandir{,_b}().</title>
<updated>2026-02-05T14:47:46+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-23T13:02:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=35f8b56a41230f5c0853c2e096af72e9e65fa0e5'/>
<id>35f8b56a41230f5c0853c2e096af72e9e65fa0e5</id>
<content type='text'>
This seems to fit the pattern better (e.g. fdopendir()).

I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50980

(cherry picked from commit 0a5b763d98b921f921243525ff25a70bbe00cfaa)

libc: Finish removing fscandir{,_b}().

These only existed for a few days before being renamed, so there's no
reason to continue to carry compatibility shims for them.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50981

(cherry picked from commit ccf937320a1a7383a2c33698007b7244f66dc022)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This seems to fit the pattern better (e.g. fdopendir()).

I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50980

(cherry picked from commit 0a5b763d98b921f921243525ff25a70bbe00cfaa)

libc: Finish removing fscandir{,_b}().

These only existed for a few days before being renamed, so there's no
reason to continue to carry compatibility shims for them.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50981

(cherry picked from commit ccf937320a1a7383a2c33698007b7244f66dc022)
</pre>
</div>
</content>
</entry>
</feed>
