<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/usr.bin/patch, branch releng/12.4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2021-05-16T04:42:02Z</updated>
<entry>
<title>usr.bin/patch: remove unneeded header.</title>
<updated>2021-05-16T04:42:02Z</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2021-05-02T16:27:32Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=cd7d1862f7b07277577d1e684792526acfdd3bc7'/>
<id>urn:sha1:cd7d1862f7b07277577d1e684792526acfdd3bc7</id>
<content type='text'>
(cherry picked from commit 9769f6f808210ddc304bc9e3c55121e6ce4d9075)
</content>
</entry>
<entry>
<title>MFC r368807: patch(1): Fix a few mandoc related issues</title>
<updated>2020-12-27T12:39:57Z</updated>
<author>
<name>Gordon Bergling</name>
<email>gbe@FreeBSD.org</email>
</author>
<published>2020-12-19T13:00:17Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=fccec952f9b295d8166510533762e0874df9bebf'/>
<id>urn:sha1:fccec952f9b295d8166510533762e0874df9bebf</id>
<content type='text'>
- no blank before trailing delimiter

(cherry picked from commit a2f1c81b286c528a8efedf224a13e476dba1de42)
</content>
</entry>
<entry>
<title>MFC r364291:</title>
<updated>2020-09-09T22:42:14Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2020-09-09T22:42:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=70af721dfa52f10203eab437aa9c5939a4177c5d'/>
<id>urn:sha1:70af721dfa52f10203eab437aa9c5939a4177c5d</id>
<content type='text'>
r364291 | imp | 2020-08-16 17:55:23 -0600 (Sun, 16 Aug 2020) | 33 lines

Remove heuristic for dealing with trailing newlines being truncated by mailers.
...
</content>
</entry>
<entry>
<title>MFC r351836, r351866, r354328: patch(1) /dev/null testing+improvement</title>
<updated>2019-12-03T18:55:09Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2019-12-03T18:55:09Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=be3a0c5043ce6f6dd57ad55276e9b67447be6867'/>
<id>urn:sha1:be3a0c5043ce6f6dd57ad55276e9b67447be6867</id>
<content type='text'>
r351836: patch(1): add some basic tests

Summary:
- basic: test application of patches created by diff -u at the
  beginning/middle/end of file, which have differing amounts of context
  before and after chunks being added
- limited_ctx: stems from PR 74127 in which a rogue line was getting added
  when the patch should have been rejected. Similar behavior was
  reproducible with larger contexts near the beginning/end of a file. See
  r326084 for details
- file_creation: patch sourced from /dev/null should create the file
- file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents
  when re-applied (personal vendetta, WIP, see comment)
- file_removal: this follows from nodupe; the reverse of a patch sourced
  from /dev/null is most naturally deleting the file, as is expected based
  on GNU patch behavior (WIP)

r351866: patch(1): fix the file removal test, strengthen it a bit

To remain compatible with GNU patch, we should ensure that once we're
removing empty files after a reversed /dev/null patch we don't remove files
that have been modified. GNU patch leaves these intact and just reverses the
hunk that created the file, effectively implying --remove-empty-files for
reversed /dev/null patches.

r354328: patch(1): give /dev/null patches special treatment

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.
</content>
</entry>
<entry>
<title>MFC r344677: patch(1): Exit successfully if we're fed a 0-length patch</title>
<updated>2019-04-04T17:21:30Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2019-04-04T17:21:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=ca2dafdd851c002b7bf2b1e2dadd7ee432712caa'/>
<id>urn:sha1:ca2dafdd851c002b7bf2b1e2dadd7ee432712caa</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.
</content>
</entry>
<entry>
<title>patch(1): Don't check for NUL bytes in Plan A</title>
<updated>2018-01-11T15:01:48Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2018-01-11T15:01:48Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=21ab148d783814f0157935e3fd210b2f22cdb00f'/>
<id>urn:sha1:21ab148d783814f0157935e3fd210b2f22cdb00f</id>
<content type='text'>
Plan A mmap()'s the entire input file and operates on it in memory. The
map(2) call succeeded, so we shouldn't need to bother checking for the NUL
byte as long as we're within our buffer space.

This was clearly intentional to match "the behavior of the original code",
but it creates a discrepancy between Plan A and Plan B that doesn't seem
sensible and it's not inherently wrong to allow a NUL byte.

This change was motivated by the gemspec in net/rubygem-grpc failing to
patch, despite the patch being generated with diff, because a NUL byte was
used as a delimiter in the header briefly in an otherwise text file.

An alternative was considered: to fallback to plan B if plan A won't process
the entire file due to a NUL byte, but I deemed this to be the better option
since plan A isn't failing due to memory limitations and will fail later on
if it's really dealing with a file it shouldn't be.

PR:		224842 (exp-run)
Reported by:	swills
Reviewed by:	emaste, pfg
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13738
</content>
</entry>
<entry>
<title>patch: further cleanup to git-style diffs.</title>
<updated>2017-12-21T16:25:33Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-12-21T16:25:33Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=76df519fe099c90ba2188cd1ca6846181b24b4b2'/>
<id>urn:sha1:76df519fe099c90ba2188cd1ca6846181b24b4b2</id>
<content type='text'>
Fix adding and removing files with git-style a/ b/ diffs: only skip
six letters if they actually match "--- a/" and "+++ b/" instead of
laxer checks.

Obtained from:	OpenBSD (CVS 1.59)
</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>General further adoption of SPDX licensing ID tags.</title>
<updated>2017-11-20T19:49:47Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-11-20T19:49:47Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8a16b7a18f5d0b031f09832fd7752fba717e2a97'/>
<id>urn:sha1:8a16b7a18f5d0b031f09832fd7752fba717e2a97</id>
<content type='text'>
Mainly focus on files that use BSD 3-Clause license.

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.
</content>
</entry>
</feed>
