summaryrefslogtreecommitdiff
path: root/usr.bin/patch
Commit message (Collapse)AuthorAgeFilesLines
* MFC r319676:Pedro F. Giffuni2017-06-181-2/+4
| | | | | | | | | | | patch: if reading fails, do not go into infinite loop asking for a filename. This can happen if no tty is available. Obtained from: OpenBSD (CVS rev 1.54) Notes: svn path=/stable/10/; revision=320086
* MFC r306560, r306561:Pedro F. Giffuni2016-10-091-4/+3
| | | | | | | | | | | | patch(1): make some macros look boolean. Minor cleanup inspired by a new patch(1) variant in schily tools. For reference: https://sourceforge.net/p/schillix-on/ Notes: svn path=/stable/10/; revision=306914
* MFC r298530:Pedro F. Giffuni2016-04-291-2/+2
| | | | | | | | | | patch(1): avoid signed integer overflow when debugging. Integer i is used to index p_end of type LINENUM (actually long). Match the types. Notes: svn path=/stable/10/; revision=298763
* MFC r289677:Bryan Drewery2016-01-071-1/+1
| | | | | | | Fix a ton of speelling errors Notes: svn path=/stable/10/; revision=293290
* MFC r281800 (pfg):Xin LI2015-08-273-45/+40
| | | | | | | | | | | | | | patch(1): small include changes. Mostly to match OpenBSD, no functional change. MFC r286601 + 286617: use posix_spawn(3) instead of fork() and exec() manually as suggested by jmg@. Notes: svn path=/stable/10/; revision=287223
* Fix patch(1) shell injection vulnerability via ed(1). [SA-15:18]Xin LI2015-08-052-4/+16
| | | | | | | Fix routed remote denial of service vulnerability. [SA-15:19] Notes: svn path=/stable/10/; revision=286348
* Fix patch(1) shell injection vulnerability. [SA-15:14]Xin LI2015-07-282-41/+65
| | | | | | | | | Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Notes: svn path=/stable/10/; revision=285976
* MFC r276218:Pedro F. Giffuni2015-01-084-18/+35
| | | | | | | | | | | | | | | | patch: Bring in xstrdup and use it when appropriate. 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 Notes: svn path=/stable/10/; revision=276807
* MFC r276472:Pedro F. Giffuni2015-01-052-2/+2
| | | | | | | | | | | | | | | Minor fixes to exit status. 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 Notes: svn path=/stable/10/; revision=276706
* MFC r275553, r275612;Pedro F. Giffuni2014-12-162-72/+112
| | | | | | | | | | | | | | | | | | | | patch(1): Bring fixes from OpenBSD Check fstat return value. Use off_t for file size and offsets. Avoid iterating over end of string. 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 Notes: svn path=/stable/10/; revision=275841
* MFC r275531, r275581, r275582;Pedro F. Giffuni2014-12-162-11/+14
| | | | | | | | | | | | | patch(1): Small changes to sync with OpenBSD Update OpenBSD CVS revision tag for our r255232. Prefer setvbuf() to setlinebuf(). Small space changes, mostly to keep in sync with OpenBSD Obtained from: OpenBSD Notes: svn path=/stable/10/; revision=275840
* MFC r267512:Pedro F. Giffuni2014-06-222-2/+3
| | | | | | | | | | | | | patch: add dry-run alias for compatibility with other implementations. 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. Notes: svn path=/stable/10/; revision=267747
* MFC r267490:Pedro F. Giffuni2014-06-223-11/+15
| | | | | | | | | | | | | | | | | | patch: unsign the line length to avoid overflows. 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. Notes: svn path=/stable/10/; revision=267746
* MFC r267426, r267464:Pedro F. Giffuni2014-06-212-32/+12
| | | | | | | | | | | | | | | | | | | | Avoid zeroing during allocation. 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(): - Drop some bogus casts to size_t. - The new_p_foo variables are not needed anymore. 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" Notes: svn path=/stable/10/; revision=267701
* MFC r264581, r264744:Pedro F. Giffuni2014-04-302-27/+27
| | | | | | | | | Various style(9) fixes and typos in printf, grep, sort and patch. #define should be followed by a tab. Notes: svn path=/stable/10/; revision=265160
* Improve bsdpatch usability:Xin LI2013-09-262-5/+8
| | | | | | | | | | | | | - 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
* Fix file selection logic for the RCS/SCCS case, as was done for the simpleStefan Eßer2013-09-052-34/+27
| | | | | | | | | | file case before. Bump version because of the changed behavior, which now matches the documentation. Reviewed by: pfg Notes: svn path=/head/; revision=255232
* Drop build option switch for the older GNU patch.Pedro F. Giffuni2013-08-291-10/+0
| | | | | | | | | | | 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
* Make the BSD-licensed patch the default.Pedro F. Giffuni2013-07-261-3/+3
| | | | | | | | | | | | | | | | | | 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
* patch: style fixPedro F. Giffuni2013-07-241-2/+4
| | | | | | | Submitted by: gogolok Notes: svn path=/head/; revision=253614
* Merge r252513 from src/gnu/usr.bin/patch into src/usr.bin/patch:David E. O'Brien2013-07-031-1/+1
| | | | | | | | | | | 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
* Merge r252512 from src/gnu/usr.bin/patch into src/usr.bin/patch:David E. O'Brien2013-07-031-2/+6
| | | | | | | | | | | | 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
* Revert r250972 to fix build.Glen Barber2013-05-252-4/+4
| | | | Notes: svn path=/head/; revision=250975
* The error handling for writes to the target file could lead to the finalStefan Eßer2013-05-242-4/+4
| | | | | | | | | | | | | 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
* Fix target selection logic, which did not comply with the man page.Stefan Eßer2013-05-231-2/+8
| | | | | | | | | | | | | | | | | | | Instead of using the file with the least order of path name components, shortest filename and finally the shortest basename (with the search stopping as soon as one of these conditions is true), the first filename checked was used as the reference, and another filename was only selected if all of the above comparisons are in favour of the latter file. This was wrong, because filenames with path less components were only considered, if both of the other conditions were true as well. In fact, the first filename to be checked had good chances to be selected in the end, since it only needed to be better with regard to any one of the three criteria ... Reviewed by: delphij@freebsd.org Notes: svn path=/head/; revision=250943
* Remove contractions.Joel Dahl2013-04-111-8/+8
| | | | Notes: svn path=/head/; revision=249373
* patch: Follow original versioning convention.Pedro F. Giffuni2013-02-081-1/+1
| | | | | | | | | | | | According to the README file [1] the 12u variant, unlike the 12g variant, contains no copyleft code. It is therefore convenient to keep using the original versioning scheme to prevent confusions. [1] http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/patch/README Notes: svn path=/head/; revision=246560
* - Refresh code with latest OpenBSD revisions.Xin LI2013-01-2914-87/+71
| | | | | | | | | | | | - Remove $DragonFly$ tags as they are using git nowadays and VCS tags will not help merging. - Other changes to Copyright headers to make them consistent with other source code, we intend to fork from this point. Reviewed by: pfg Notes: svn path=/head/; revision=246091
* - Add a BSD-licensed patch, ported by Pedro F. Giffuni (pfg) fromGabor Kovesdan2013-01-2914-0/+4945
| | | | | | | | | | | DragonflyBSD and install it as bsdpatch. WITH_BSD_PATCH makes it default and installs GNU patch as gnupatch. Submitted by: pfg Obtained from: The DragonflyBSD Project Notes: svn path=/head/; revision=246074
* Remove these three files left-over from my unsuccessful attempt toGarance A Drosehn2004-08-043-287/+0
| | | | | | | | | re-import `patch' into this location. Instead I think I will import it to 'patch-b', and that way I can be sure that I am starting with a clean slate WRT the CVS repository. Notes: svn path=/head/; revision=133104
* This commit was generated by cvs2svn to compensate for changes in r132977,Garance A Drosehn2004-08-013-0/+287
|\ | | | | | | | | | | | | which included commits to RCS files with non-trunk default branches. Notes: svn path=/head/; revision=132978
| * Import of a BSD-licensed version of `patch', which will eventuallyGarance A Drosehn2004-08-0114-0/+4726
| | | | | | | | | | | | | replace the version we currently have in src/gnu/usr.bin/patch/. Among other things, this version includes a --posix option for strict POSIX conformance. This version is the current source from OpenBSD as of today. It is their 3.5-release, plus a few updates to patch.c and pch.c that they made about three weeks ago. Notes: svn path=/vendor/OpenBSD/dist/; revision=132977
* kill the undeadPeter Wemm1997-07-1317-3441/+0
| | | | Notes: svn path=/head/; revision=27369
* Finish importing Lite2's src/usr.bin, except for ex, diff, grep, mail,Bruce Evans1997-07-0617-0/+3441
pascal and vmstat.sparc. All changed files on the vendor branch should already have been imported. Notes: svn path=/vendor/CSRG/dist/; revision=27241