<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/usr.bin/patch/patch.c, branch releng/13.4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F13.4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F13.4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2023-08-23T17:43:22Z</updated>
<entry>
<title>Remove $FreeBSD$: one-line .h pattern</title>
<updated>2023-08-23T17:43:22Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-22T01:31:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=34041aac835a0bce462bccb7e0239c0ba092f872'/>
<id>urn:sha1:34041aac835a0bce462bccb7e0239c0ba092f872</id>
<content type='text'>
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit 42b388439bd3)
</content>
</entry>
<entry>
<title>patch: omit filename if the prompt was ignored</title>
<updated>2023-02-16T03:29:40Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2023-01-24T16:46:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=dfdc3b2e6541c941b51edd5e5ec575411e5be143'/>
<id>urn:sha1:dfdc3b2e6541c941b51edd5e5ec575411e5be143</id>
<content type='text'>
When a file is missing, patch(1) will prompt for a filename to try and
patch it.  If we're doing a dry-run, we'll output that the patch to the
source file was either ignored/failed.  If you ignore the prompt in a
dry-run (i.e. just hit enter), we'll output:

X out of X hunks ignored while patching (null)

Let's improve the aesthetics a bit and just omit the last part if the
prompt was ignored:

X out of X hunks ignored

Unfortunately we can't really test this without expect(1) because both
force and batch mode will use the first best guess, which is wiped out
by the "File to patch:" prompt.  We could record the initially derived
bestguess there and use *that*, but given that this is only possible in
an interactive session I think it's fine to just omit the filename
rather than adding a fair amount of complexity (which could also break
other scenarios I haven't considered yet)..

Reviewed by:	des
Sponsored by:	Klara, Inc.

(cherry picked from commit 7e688ed493482c5346d969e7667856d8ced8d87a)
</content>
</entry>
<entry>
<title>patch(1): give /dev/null patches special treatment</title>
<updated>2019-11-04T03:07:01Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2019-11-04T03:07:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=50dacbf6c2a3d32f7e3f20ca98cda23f38817e7f'/>
<id>urn:sha1:50dacbf6c2a3d32f7e3f20ca98cda23f38817e7f</id>
<content type='text'>
We have a bad habit of duplicating contents of files that are sourced from
/dev/null and applied more than once... take the more sane (in most ways)
GNU route and complain if the file exists and offer reversal options.

This still falls short a little bit as selecting "don't reverse, apply
anyway" will still give you duplicated file contents. There's probably other
issues as well, but awareness is the first step to happiness.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D21535
</content>
</entry>
<entry>
<title>patch(1): Exit successfully if we're fed a 0-length patch</title>
<updated>2019-03-01T01:20:21Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2019-03-01T01:20:21Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=ef30b5a80910bd877f582248004200065eeb3ef5'/>
<id>urn:sha1:ef30b5a80910bd877f582248004200065eeb3ef5</id>
<content type='text'>
This change is made in the name of GNU patch compatibility. If GNU patch is
fed a zero-length patch, it will exit successfully with no output. This is
used in at least one port to date (comms/wsjtx), and we break on this usage.

It seems unlikely that anyone relies on patch(1) calling their completely
empty patch garbage and failing, and GNU compatibility is a plus if it helps
with porting, so make the switch.

Reported by:	db
MFC after:	2 weeks
</content>
</entry>
<entry>
<title>patch: rejname[] is also -r option buffer, and should be PATH_MAX.</title>
<updated>2017-12-21T16:19:10Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-12-21T16:19:10Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c844f14e37e57b9f259fb60423456b297b3951e1'/>
<id>urn:sha1:c844f14e37e57b9f259fb60423456b297b3951e1</id>
<content type='text'>
Obtained from:	OpenBSD (CVS 1.64)
</content>
</entry>
<entry>
<title>patch(1): don't assume a match if we run out of context to check</title>
<updated>2017-11-22T03:44:19Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2017-11-22T03:44:19Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=bc4f0fe3588183058f52c53f9cf59b77e19842db'/>
<id>urn:sha1:bc4f0fe3588183058f52c53f9cf59b77e19842db</id>
<content type='text'>
Patches with very little context (-U0 and -U1) could get misapplied if
the file to be patched changes and a hunk is no longer applicable. Matching
with fuzz would be attempted and default to a match when we unexpectedly ran
out of context.

This also affected patches with higher levels of context but had limited
actual context due to the hunk being located near the beginning/end of file.

PR:		74127, 223545 (exp-run)
Reviewed by:	emaste, pfg
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D12631
</content>
</entry>
<entry>
<title>Revert r325365</title>
<updated>2017-11-08T23:11:15Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2017-11-08T23:11:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=752e881db7398b10410d26c7d69176ec998d9c3b'/>
<id>urn:sha1:752e881db7398b10410d26c7d69176ec998d9c3b</id>
<content type='text'>
r325365 caused several ports to fail to patch correctly. Revert it for the
time being until an exp-run can be completed.

Requested by:	antoine
Approved by:	emaste (implicit)
</content>
</entry>
<entry>
<title>patch(1): don't assume a match if we run out of context to check</title>
<updated>2017-11-03T17:04:30Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2017-11-03T17:04:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=ed3b30599370432f6ac501e36099f597f5999d27'/>
<id>urn:sha1:ed3b30599370432f6ac501e36099f597f5999d27</id>
<content type='text'>
Patches with very little context (-U0 and -U1) could get misapplied if
the file to be patched changes and a hunk is no longer applicable. Matching
with fuzz would be attempted and default to a match when we unexpectedly ran
out of context.

PR:		74127
Reviewed by:	emaste, pfg
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D12631
</content>
</entry>
<entry>
<title>patch(1): replace strnlen() with a simpler strlen().</title>
<updated>2017-01-02T18:27:35Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-01-02T18:27:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=fa812237434edee9745e7cf6e9ef4481cf2b5a8c'/>
<id>urn:sha1:fa812237434edee9745e7cf6e9ef4481cf2b5a8c</id>
<content type='text'>
Small style fix with here.

Pointed out by:	kib
</content>
</entry>
<entry>
<title>Revert r311106:</title>
<updated>2017-01-02T18:23:31Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-01-02T18:23:31Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=4f548c1916e86995b61b678743c91d689bba8581'/>
<id>urn:sha1:4f548c1916e86995b61b678743c91d689bba8581</id>
<content type='text'>
patch(1): extend the maximum length of a line from USHRT_MAX to UINT_MAX.

This doesn't really work for 32 bit platforms.

Pointed out by:	kib
</content>
</entry>
</feed>
