<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/usr.bin/patch, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=main</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2025-08-30T22:02:35Z</updated>
<entry>
<title>Revert "patch: fix pch_context() for unified diffs with no leading context"</title>
<updated>2025-08-30T22:02:35Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-08-30T22:01:27Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=fb37e38fbe99039a479520b4b596f4bfc04e2a88'/>
<id>urn:sha1:fb37e38fbe99039a479520b4b596f4bfc04e2a88</id>
<content type='text'>
This reverts commit f97b6a8f84b3ed209c2aea0958a7b889d0bf27ed, as it
turns out our fuzz implementation is just too naive.  We can have more
leading context than trailing context and vice-versa, so we can't really
assume they're the same.

Restore the previous bug and we can work on it post-branch.

Reported by:	cy
</content>
</entry>
<entry>
<title>patch: test for unified diffs with spaces in filenames</title>
<updated>2025-08-29T19:24:35Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-08-29T19:24:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=cc36624b2a8be3fbf180c5ae8d310d86486884bc'/>
<id>urn:sha1:cc36624b2a8be3fbf180c5ae8d310d86486884bc</id>
<content type='text'>
The older GNU patch that we had in base did not properly handle spaces
in filenames in unified diffs, but bsdpatch seems to have handled this
fine at least since the version we imported into base initially.  Add a
test with spaces in the filename specifically to be sure.

PR:		181272
</content>
</entry>
<entry>
<title>patch: fix pch_context() for unified diffs with no leading context</title>
<updated>2025-08-29T19:24:35Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-08-29T19:24:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=f97b6a8f84b3ed209c2aea0958a7b889d0bf27ed'/>
<id>urn:sha1:f97b6a8f84b3ed209c2aea0958a7b889d0bf27ed</id>
<content type='text'>
When the first line of a file is a removal, we may not have any leading
context.  Only adjusting p_context if context &gt; 0 means that we
incorrectly believe that we have 100 lines of context when the reality
is that we have none.

This fixes a bug with fuzz-checking, which ends up fuzzing away the line
we're trying to replace if it's the first line in the file.  We use
pch_context() to determine a reasonable max-fuzz.

PR:		250511
Reviewed by:	pfg
Differential Revision:	https://reviews.freebsd.org/D51837
</content>
</entry>
<entry>
<title>Update Makefile.depend files</title>
<updated>2024-10-14T17:26:17Z</updated>
<author>
<name>Simon J. Gerraty</name>
<email>sjg@FreeBSD.org</email>
</author>
<published>2024-10-14T17:24:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a64729f5077d77e13b9497cb33ecb3c82e606ee8'/>
<id>urn:sha1:a64729f5077d77e13b9497cb33ecb3c82e606ee8</id>
<content type='text'>
After building packages we have a number of new
and updated Makefile.depend files

Reviewed by:	stevek
</content>
</entry>
<entry>
<title>Remove residual blank line at start of Makefile</title>
<updated>2024-07-15T22:43:39Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2024-07-15T04:46:32Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e9ac41698b2f322d55ccf9da50a3596edb2c1800'/>
<id>urn:sha1:e9ac41698b2f322d55ccf9da50a3596edb2c1800</id>
<content type='text'>
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
</content>
</entry>
<entry>
<title>patch: use getline() instead of fgetln()</title>
<updated>2024-04-19T21:52:22Z</updated>
<author>
<name>Martin Tournoij</name>
<email>martin@arp242.net</email>
</author>
<published>2024-04-19T21:11:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=25696725b65b651814799574fdfadb1b1a5e0b02'/>
<id>urn:sha1:25696725b65b651814799574fdfadb1b1a5e0b02</id>
<content type='text'>
This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from:	https://github.com/dcantrell/bsdutils and
              	https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij &lt;martin@arp242.net&gt;
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893
</content>
</entry>
<entry>
<title>patch: Support long context lines.</title>
<updated>2024-02-12T18:26:13Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2024-02-12T18:26:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=851a9da38f070675c42a6d69c41c47a5d29ee3d0'/>
<id>urn:sha1:851a9da38f070675c42a6d69c41c47a5d29ee3d0</id>
<content type='text'>
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43850
</content>
</entry>
<entry>
<title>patch: fix locate_hunk in empty files</title>
<updated>2023-12-03T17:33:03Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2023-12-03T17:33:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=7e8afbb6d605006d7cb867362b225d21c4f5ae57'/>
<id>urn:sha1:7e8afbb6d605006d7cb867362b225d21c4f5ae57</id>
<content type='text'>
if `first_guess' is zero then main() assumes that locate_hunk has failed
and aborts the patch operation.  Instead, make sure to return 1 (the
line number) so that the patch operation can continue.

Issue originally found by Neels Hofmeyr in the regress suite of the diff
implementation for got, where the tests assume that applying a diff with
`patch' and then again with `patch -R' yields back the original file.

Obtained from:	OpenBSD (CVS patch.c,v 1.71)
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line nroff pattern</title>
<updated>2023-08-16T17:55:15Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b2c76c41be32f904179efed29c0ca04d53f3996c'/>
<id>urn:sha1:b2c76c41be32f904179efed29c0ca04d53f3996c</id>
<content type='text'>
Remove /^\.\\"\s*\$FreeBSD\$$\n/
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line sh pattern</title>
<updated>2023-08-16T17:55:03Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf'/>
<id>urn:sha1:d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf</id>
<content type='text'>
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
</content>
</entry>
</feed>
