| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
Notes:
svn path=/head/; revision=327826
|
|
|
|
|
|
|
|
|
|
|
| |
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)
Notes:
svn path=/head/; revision=327064
|
|
|
|
|
|
|
| |
Obtained from: OpenBSD (CVS 1.64)
Notes:
svn path=/head/; revision=327063
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
Notes:
svn path=/head/; revision=326084
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Notes:
svn path=/head/; revision=326025
|
|
|
|
|
|
|
|
|
|
|
| |
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)
Notes:
svn path=/head/; revision=325564
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
Notes:
svn path=/head/; revision=325365
|
|
|
|
|
|
|
| |
Sponsored by: Dell EMC Isilon
Notes:
svn path=/head/; revision=325188
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patches like file.txt attached to PR 190195 with a final line formed
like ">(EOL)" could cause a copy past the end of the current line buffer. In the
case of PR 191641, this caused a duplicate line to be copied into the resulting
file.
Instead of running past the end, treat it as if it were a blank line.
PR: 191641
Reviewed by: cem, emaste, pfg
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D12609
Notes:
svn path=/head/; revision=324431
|
|
|
|
|
|
|
|
|
|
| |
Sometimes patches coming from other places have extra a/ and b/
directories prepended to filenames.
Obtained from: OpenBSD (CVS rev. 1.57, 1.58)
Notes:
svn path=/head/; revision=320579
|
|
|
|
|
|
|
|
|
|
| |
This can happen if no tty is available.
Obtained from: OpenBSD (CVS rev 1.54)
MFC after: 5 days
Notes:
svn path=/head/; revision=319676
|
|
|
|
|
|
|
|
|
|
|
| |
reallocarray(3) is a non portable extension from OpenBSD. Given that it is
already in FreeBSD, make easier future merges by adopting in some cases
where the code has some shared heritage with OpenBSD.
Obtained from: OpenBSD
Notes:
svn path=/head/; revision=314704
|
|
|
|
|
|
|
|
|
| |
Small style fix with here.
Pointed out by: kib
Notes:
svn path=/head/; revision=311110
|
|
|
|
|
|
|
|
|
|
|
| |
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
Notes:
svn path=/head/; revision=311109
|
|
|
|
|
|
|
|
|
|
| |
We can handle such "big data" without much trouble.
Try to do a better job at detecting the rejection cause while here.
MFC after: 2 weeks
Notes:
svn path=/head/; revision=311106
|
|
|
|
|
|
|
|
|
| |
Similar to r306560, plus remove an unused macro.
Suggested by: jmallett
Notes:
svn path=/head/; revision=306561
|
|
|
|
|
|
|
|
|
|
|
|
| |
Minor cleanup inspired by a new patch(1) variant in schily tools.
For reference:
https://sourceforge.net/p/schillix-on/
MFC after: 1 week
Notes:
svn path=/head/; revision=306560
|
|
|
|
|
|
|
|
| |
Independent of the maximum length, the return type for strnlen(3)
is always size_t.
Notes:
svn path=/head/; revision=298531
|
|
|
|
|
|
|
|
|
|
|
| |
Integer i is used to index p_end of type LINENUM (actually long).
Match the types.
MFC after: 5 days
Notes:
svn path=/head/; revision=298530
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so. A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR. These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package. The current implementation of targets/ is
very unmaintainable.
Currently rescue/rescue and sys/modules are still not connected.
Sponsored by: EMC / Isilon Storage Division
Notes:
svn path=/head/; revision=291563
|
|
|
|
|
|
|
|
|
|
| |
arc lint is helpful
Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337
Notes:
svn path=/head/; revision=289677
|
|
|
|
|
|
|
|
|
| |
Obtained from: DragonFly via OpenBSD
Relnotes: yes
MFC: never
Notes:
svn path=/head/; revision=286795
|
|
|
|
|
|
|
|
| |
Suggested by: ed
MFC after: 2 weeks
Notes:
svn path=/head/; revision=286617
|
|
|
|
|
|
|
|
|
|
|
| |
by jmg@.
Reviewed By: pfg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3353
Notes:
svn path=/head/; revision=286601
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tightening sanity check of the input. [1]
While I'm there also replace ed(1) with red(1) because we do
not need the unrestricted functionality. [2]
Obtained from: Bitrig [1], DragonFly [2]
Security: CVE-2015-1418 [1]
Notes:
svn path=/head/; revision=286346
|
|
|
|
|
|
|
|
|
|
|
|
| |
support by replacing system() with execve().
Future revisions may remove the functionality completely.
Obtained from: Bitrig
Security: CVE-2015-1416
Notes:
svn path=/head/; revision=285974
|
|
|
|
|
|
|
|
|
|
|
|
| |
Differential Revision: https://reviews.freebsd.org/D3146
Reviewed by: pfg
Approved by: markj (mentor)
MFC after: 1 week
Relnotes: yes
Sponsored by: EMC / Isilon Storage Division
Notes:
svn path=/head/; revision=285772
|
|
|
|
|
|
|
|
|
| |
Mostly to match OpenBSD, no functional change.
Obtained from: OpenBSD
Notes:
svn path=/head/; revision=281800
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prevent null pointer dereference on empty input files when diff requires
a specific version.
Fix division by zero for files with long lines (> 1024) in Plan B mode
by supporting arbitrarily long lines.
Obtained from: OpenBSD (CVS Rev 1.41, 1.42)
MFC after: 1 week
Notes:
svn path=/head/; revision=281216
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exit with EXIT_FAILURE for invalid arguments.
Fixes NetBSD-PR 43517.
Print version string to stdout instead of stderr;
it is user-requested and not an error.
Obtained from: NetBSD
MFC after: 5 days
Notes:
svn path=/head/; revision=276472
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function savestr allows NULL return values during Plan A patching so in
case of out of memory conditions, Plan B can step in. In many cases, NULL
value is not properly handled, so use xstrdup here (it's outside Plan A/B
patching, which means that even Plan B relies on successful operations).
Clean up some whitespaces while here
Obtained from: OpenBSD
MFC after: 2 weeks
Notes:
svn path=/head/; revision=276218
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce strtolinenum to properly check line numbers while parsing:
no signs, no spaces, just digits, 0 <= x <= LONG_MAX
Properly validate line ranges supplied in diff file to prevent overflows.
Also fixes an out of boundary memory access because the resulting values
are used as array indices.
PR: 195436
Obtained from: OpenBSD (CVS pch.c rev 1.45, 1,46, common.h rev 1.28)
MFC after: 1 week
Notes:
svn path=/head/; revision=275612
|
|
|
|
|
|
|
|
|
|
| |
Mostly to keep in sync with OpenBSD and update the TAG.
Obtained from: OpenBSD
MFC after: 5 days
Notes:
svn path=/head/; revision=275582
|
|
|
|
|
|
|
|
|
|
| |
On FreeBSD's libc setlinebuf is a wrapper to setvbuf anyways.
Obtained from: OpenBSD
MFC after: 5 days
Notes:
svn path=/head/; revision=275581
|
|
|
|
|
|
|
|
|
|
|
| |
Check fstat return value. Also, use off_t for file size and offsets.
Avoid iterating over end of string.
Obtained from: OpenBSD (CVS rev. 1.41, 1.43)
MFC after: 1 week
Notes:
svn path=/head/; revision=275553
|
|
|
|
|
|
|
|
|
| |
This is a no-op to make it easier to track changes from OpenBSD
MFC after: 3 days
Notes:
svn path=/head/; revision=275531
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Other implementations of patch(1), including GNU patch and "svn patch"
have a --dry-run option which does the same as our -C or --check
option.
Add a new alias to make our implementation more compatible.
MFC after: 1 week
Notes:
svn path=/head/; revision=267512
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patch(1) uses a short int for the line length, which is usually
sufficient for regular diffs, but makes no effort to signal
when there is an overflow.
Change the line length to an unsigned short int to better use
the fact that a length is never negative. The change is loosely
inspired on a related change in DragonFly, but we avoid spending
more memory than necessary.
While here adjust the messages to be clearer on what is happening.
MFC after: 1 week
Notes:
svn path=/head/; revision=267490
|
|
|
|
|
|
|
|
|
|
|
| |
- Drop some bogus casts to size_t.
- The new_p_foo variables are not needed after r267426.
Pointed out by: bde
MFC after: 1 week
Notes:
svn path=/head/; revision=267464
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change reverts a change from OpenBSD which made use of
calloc, and therefore wasted time initializing arrays that
will later be realloc'ed. Consistently use FreeBSD's
reallocf().
While here also merge the changes from OpenBSD's manpage
patch.1 Rev 1.27:
"patch was moved from user portability (UP) to base in issue 7
and is no longer optional"
MFC after: 1 week
Notes:
svn path=/head/; revision=267426
|
|
|
|
|
|
|
| |
MFC after: 3 days
Notes:
svn path=/head/; revision=264744
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Ask only once for "Apply anyway". [1]
- Tell user what file have failed patch rather than just how
many hunks failed.
Reported by: jmg via pfg [1]
Tested by: pfg [1]
Approved by: re (gjb)
Notes:
svn path=/head/; revision=255894
|
|
|
|
|
|
|
|
|
|
| |
file case before. Bump version because of the changed behavior, which now
matches the documentation.
Reviewed by: pfg
Notes:
svn path=/head/; revision=255232
|
|
|
|
|
|
|
|
|
|
|
| |
As promised, drop the option to make the older GNU patch
the default.
GNU patch is still being built but something drastic may
happen to it to it before Release.
Notes:
svn path=/head/; revision=255014
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The BSD-licensed patch(1) command has matured and it's behaviour
can be considered equivalent to the older version of GNU patch
in the tree.
The switch has been extensively tested [1] and only two ports
presented regressions, which have since been fixed.
For convenience a new WITH_GNU_PATCH option is available,
but it will likely be removed in the near future.
PR: 176313
Approved by: portmgr
Notes:
svn path=/head/; revision=253689
|
|
|
|
|
|
|
| |
Submitted by: gogolok
Notes:
svn path=/head/; revision=253614
|
|
|
|
|
|
|
|
|
|
|
| |
Properly handle input lines containing NUL characters such that pgets()
accurately fills the read buffer.
Callers of pgets() still mis-process the buffer contents if the read line
contains NUL characters, but this at least makes pgets() accurate.
Notes:
svn path=/head/; revision=252637
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make it so that 'patch < FUBAR' and 'patch -i FUBAR' operate the same.
The former makes a copy of stdin, but was not accurately putting the
content of stdin into a temp file. This lead to the undercounting
the number of lines in hunks containing NUL characters when reading
from stdin. Thus resulting in "unexpected end of file in patch" errors.
Notes:
svn path=/head/; revision=252636
|
|
|
|
| |
Notes:
svn path=/head/; revision=250975
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fclose() being skipped. Fix this by using boolean "&" and "|" instead of
short-cut operators "&&" and "||".
While here, increment the last part of the version string. The reason is
the fixed output file selection logic in pch.c, which was committed as
r250943, yesterday.
Reviewed by: pfg
Notes:
svn path=/head/; revision=250972
|