summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch
Commit message (Collapse)AuthorAgeFilesLines
* MFC r306560, r306561:pfg2016-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/
* Adjust a type from r267490.pfg2016-04-241-1/+1
| | | | | Independent of the maximum length, the return type for strnlen(3) is always size_t.
* patch(1): avoid signed integer overflow when debugging.pfg2016-04-241-2/+2
| | | | | | | | Integer i is used to index p_end of type LINENUM (actually long). Match the types. MFC after: 5 days
* META MODE: Update dependencies with 'the-lot' and add missing directories.bdrewery2015-12-011-0/+18
| | | | | | | | | | | | | | 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
* Fix a ton of speelling errorseadler2015-10-211-1/+1
| | | | | | | arc lint is helpful Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com Differential Revision: https://reviews.freebsd.org/D3337
* Remove automatic checkout feature.delphij2015-08-156-167/+19
| | | | | | Obtained from: DragonFly via OpenBSD Relnotes: yes MFC: never
* Use __DECONST instead of doing strdup/free.delphij2015-08-111-10/+5
| | | | | Suggested by: ed MFC after: 2 weeks
* use posix_spawn(3) instead of fork() and exec() manually as suggesteddelphij2015-08-101-41/+40
| | | | | | | | by jmg@. Reviewed By: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D3353
* Fix shell injection vulnerability in patch(1) via ed(1) bydelphij2015-08-052-4/+16
| | | | | | | | | | 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]
* Fix shell injection vulnerability in patch(1) and drop SCCSdelphij2015-07-282-41/+65
| | | | | | | | | support by replacing system() with execve(). Future revisions may remove the functionality completely. Obtained from: Bitrig Security: CVE-2015-1416
* patch(1): Add -Vnone option to disable backup filescem2015-07-213-9/+14
| | | | | | | | | 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
* patch(1): small include changes.pfg2015-04-203-4/+5
| | | | | | Mostly to match OpenBSD, no functional change. Obtained from: OpenBSD
* patch: Bring small updates from OpenBSDpfg2015-04-071-19/+37
| | | | | | | | | | | 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
* Fixes to exit status.pfg2014-12-312-2/+2
| | | | | | | | | | | 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
* patch: Bring in xstrdup and use it when appropriate.pfg2014-12-254-18/+35
| | | | | | | | | | | | 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
* patch(1): avoid line number overflowspfg2014-12-082-34/+72
| | | | | | | | | | | | | 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
* Small space changespfg2014-12-071-8/+11
| | | | | | | Mostly to keep in sync with OpenBSD and update the TAG. Obtained from: OpenBSD MFC after: 5 days
* Prefer setvbuf() to setlinebuf().pfg2014-12-071-3/+3
| | | | | | | On FreeBSD's libc setlinebuf is a wrapper to setvbuf anyways. Obtained from: OpenBSD MFC after: 5 days
* Merge fixes from OpenBSD.pfg2014-12-061-38/+40
| | | | | | | | 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
* Update OpenBSD CVS revision for our r255232.pfg2014-12-051-1/+1
| | | | | | This is a no-op to make it easier to track changes from OpenBSD MFC after: 3 days
* patch: add dry-run alias for compatibility with other implementations.pfg2014-06-152-2/+3
| | | | | | | | | | 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
* patch: unsign the line length to avoid overflows.pfg2014-06-153-11/+15
| | | | | | | | | | | | | | | 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
* patch: cleanup some unnecessary cruft.pfg2014-06-141-16/+7
| | | | | | | | - 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
* Avoid zeroing during allocation.pfg2014-06-122-22/+11
| | | | | | | | | | | | | | 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
* Various style(9) fixes and typos in grep, sort and patch.pfg2014-04-212-27/+27
| | | | MFC after: 3 days
* Improve bsdpatch usability:delphij2013-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)
* Fix file selection logic for the RCS/SCCS case, as was done for the simplese2013-09-052-34/+27
| | | | | | | file case before. Bump version because of the changed behavior, which now matches the documentation. Reviewed by: pfg
* Drop build option switch for the older GNU patch.pfg2013-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.
* Make the BSD-licensed patch the default.pfg2013-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
* patch: style fixpfg2013-07-241-2/+4
| | | | Submitted by: gogolok
* Merge r252513 from src/gnu/usr.bin/patch into src/usr.bin/patch:obrien2013-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.
* Merge r252512 from src/gnu/usr.bin/patch into src/usr.bin/patch:obrien2013-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.
* Revert r250972 to fix build.gjb2013-05-252-4/+4
|
* The error handling for writes to the target file could lead to the finalse2013-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
* Fix target selection logic, which did not comply with the man page.se2013-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
* Remove contractions.joel2013-04-111-8/+8
|
* patch: Follow original versioning convention.pfg2013-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
* - Refresh code with latest OpenBSD revisions.delphij2013-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
* - Add a BSD-licensed patch, ported by Pedro F. Giffuni (pfg) fromgabor2013-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
* Remove these three files left-over from my unsuccessful attempt togad2004-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.
* This commit was generated by cvs2svn to compensate for changes in r132977,gad2004-08-013-0/+287
|\ | | | | | | which included commits to RCS files with non-trunk default branches.
| * Import of a BSD-licensed version of `patch', which will eventuallygad2004-08-0114-2807/+4176
| | | | | | | | | | | | | | | | | | | | 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.
* | kill the undeadpeter1997-07-1317-3441/+0
| |
| |
| \
*-. \ This commit was generated by cvs2svn to compensate for changes in r27241,bde1997-07-0617-0/+3441
|\ \ \ | | |/ | | | | | | which included commits to RCS files with non-trunk default branches.
| | * Finish importing Lite2's src/usr.bin, except for ex, diff, grep, mail,bde1997-07-0611-0/+3357
| | | | | | | | | | | | | | | pascal and vmstat.sparc. All changed files on the vendor branch should already have been imported.
| | * recording cvs-1.6 file deathpeter1995-12-3011-3357/+0
| | |
| * | Finish importing Lite2's src/usr.bin, except for ex, diff, grep, mail,bde1997-07-066-0/+84
| | | | | | | | | | | | | | | pascal and vmstat.sparc. All changed files on the vendor branch should already have been imported.
| * | recording cvs-1.6 file deathpeter1995-12-306-84/+0
| | |
* | | This commit was generated by cvs2svn to compensate for changes in r13122,peter1995-12-3017-3441/+0
| | | | | | | | | | | | which included commits to RCS files with non-trunk default branches.
* | | This commit was generated by cvs2svn to compensate for changes in r1590,rgrimes1994-05-2711-0/+3357
|\ \ \ | |/ / |/| / | |/ which included commits to RCS files with non-trunk default branches.
OpenPOWER on IntegriCloud