summaryrefslogtreecommitdiff
path: root/usr.bin/patch/tests
AgeCommit message (Collapse)Author
2025-08-30Revert "patch: fix pch_context() for unified diffs with no leading context"Kyle Evans
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
2025-08-29patch: test for unified diffs with spaces in filenamesKyle Evans
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
2025-08-29patch: fix pch_context() for unified diffs with no leading contextKyle Evans
When the first line of a file is a removal, we may not have any leading context. Only adjusting p_context if context > 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
2024-10-14Update Makefile.depend filesSimon J. Gerraty
After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
2024-07-15Remove residual blank line at start of MakefileWarner Losh
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
2024-02-12patch: Support long context lines.Dag-Erling Smørgrav
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D43850
2023-08-16Remove $FreeBSD$: one-line sh patternWarner Losh
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2019-11-04patch(1): give /dev/null patches special treatmentKyle Evans
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 Notes: svn path=/head/; revision=354328
2019-09-05patch(1): fix the file removal test, strengthen it a bitKyle Evans
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. Notes: svn path=/head/; revision=351866
2019-09-05patch(1): add some basic testsKyle Evans
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) Notes: svn path=/head/; revision=351836