summaryrefslogtreecommitdiff
path: root/usr.bin/patch
AgeCommit message (Collapse)Author
2015-11-11exit() after perror() for pledge failure. Perhaps this got introducedTheo de Raadt
as a test idiom, either when pledge was young or during the transition to strings.... dunno
2015-11-11creat() -> open equiv; from Frederic NowakTheo de Raadt
2015-10-16Add native support for ed-style diffs. No need to pledge "proc exec" anymore.Tobias Stoeckmann
ok deraadt
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-07patch(1) can move to "stdio rpath wpath cpath tmppath fattr proc exec"Theo de Raadt
(adding proc exec), now that "exec" has arrived in the kernel. This permits the dangerous game of feeding ed-style diffs with popen() via /bin/ed. Shocked yet? Your mission, should you choose to accept it, is to replace this code with an builtin ed-style patcher, maybe cribbing code from ed itself. I'm sorry, but we can't fix the entire world all at once. Noone loves deprecating standarized features as much as we do, but there are some lines. Maybe if people become aware of how crappy the implimentations of some standard features are, they could help decide the path.
2015-10-04remove tame "proc". it is not useful, because the "ed" diffs requireTheo de Raadt
fork+execve, and execve is not going to become available in this fashion. ed diffs should be handled using a built-in handler, and various folks have been discussing this behind the scenes.
2015-10-03As pointed out by tobiasu, ed-style patches still use popen() and executeTheo de Raadt
/bin/ed. This is RETARDED. Nothing learned from the last year? Add tame "proc" until that is fixed, to allow fork+exec. I beg for someone to cross-link the guts of ed directly into patch, or write a ed-subset which can do the job.
2015-10-03patch appears to work fully with tame "stdio rpath wpath cpath tmppath fattr".Theo de Raadt
in case of exploitation, no more network access, fork, execve, etc. I wonder if we could use whitepath lists here - if it is reasonable to limit operation in directories known early on?
2015-07-31Account for newlines in substitution (s///) commands. SubstitutionTodd C. Miller
commands might contain a newline in the replacement pattern (escaped with a backslash before it), causing patch's understanding of the state the ed child process is in to diverge from reality. This can lead to patch unwillingly feeding '!' (execute shell command) lines to ed. From Martin Natano. OK deraadt@
2015-07-26Remove support for automatically checking files out of RCS. TheTodd C. Miller
behavior is confusing to users and even GNU patch no longer does it by default. OK krw@ guenther@
2015-03-13remove the first comma from constructs like ", and," and ", or,": you can useJason McIntyre
"and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;
2015-02-05Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@Todd C. Miller
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-14Handle ed command "s" as a one line command, which it is.Tobias Stoeckmann
Prevents arbitrary ed command executions in following lines. ok millert
2014-12-13The function savestr allows NULL return values during Plan A patching so inTobias Stoeckmann
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).
2014-12-09Fix division by zero for files with long lines (> 1024) in Plan B modeTobias Stoeckmann
by supporting arbitrarily long lines just like Plan A does. ok tedu
2014-12-08spacesTheo de Raadt
2014-12-01three trivial reallocarray() usesTheo de Raadt
2014-11-26Prefer setvbuf() to setlinebuf() for portability; ok deraadt@Todd C. Miller
2014-11-26Properly validate line ranges supplied in diff file to prevent overflows.Tobias Stoeckmann
Also fixes an out of boundary memory access because the resulting values are used as array indices. ok millert
2014-11-25Introduce strtolinenum to properly check line numbers while parsing:Tobias Stoeckmann
no signs, no spaces, just digits, 0 <= x <= LONG_MAX ok millert, otto
2014-11-25Prevent null pointer dereference on empty input files when diff requiresTobias Stoeckmann
a specific version. ok millert
2014-11-22Remove SCCS support. For this to work, we would need "get", which we don'tTobias Stoeckmann
even have in ports. XSI functionality of POSIX, therefore optional. ok deraadt, schwarze, tedu
2014-11-21Remove the README. It history from more than 20 years ago, and whileTheo de Raadt
interesting it has no impact on the maintainance of this stuff. ok tobias
2014-11-18Avoid iterating over end of string.Tobias Stoeckmann
ok millert, otto
2014-11-17Check fstat return value. Also, use off_t for file size and offsets asTobias Stoeckmann
suggested by bluhm@. ok schwarze@
2014-11-15Call munmap with the same size argument as mmap.Tobias Stoeckmann
ok millert, otto
2014-10-08userland reallocarray audit.Doug Hogan
Replace malloc() and realloc() calls that may have integer overflow in the multiplication of the size argument with reallocarray(). ok deraadt@
2014-05-20Use errc/warnc to simplify code.Philip Guenther
Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@
2014-04-15patch was moved from user portability (UP) to base in issue 7Jason McIntyre
and is no longer optional;
2013-11-26unsigned char casts for ctypeTheo de Raadt
ok krw
2013-11-12pull in local .h files to satisfy protoTheo de Raadt
2013-07-11Bring file selection in accordance with the man page; from Stefan EsserOtto Moerbeek
ok millert@
2012-05-15Fix confusing patch(1) output on failure when using -C. FromTodd C. Miller
dragonflybsd via Loganaden Velvindron. OK mikeb@ and deraadt@
2012-04-11Silence gcc warnings.Antoine Jacoutot
ok deraadt@
2012-04-10Don't try to mmap a zero length file, from NetBSD.Antoine Jacoutot
Needed after the recent mmap(2) change. ok ariane@
2010-09-03add an EXIT STATUS section for /usr/bin;Jason McIntyre
2010-07-24Send normal output to stdout instead of everything to stderr. ThisRay Lai
is currently done in the latest versions of GNU patch. Please watch out for output appearing out-of-order. Discussed with millert and deraadt. OK deraadt
2010-01-08Don't leak memory after strdup() in makedirs().Owain Ainsworth
From Igor Zinovik; thanks! ok stsp@, millert@
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2009-04-05If no patch can be found in input, in addition to complaining on stderr,Stefan Sperling
have the exit code indicate failure, not success. Discrepancy with GNU patch pointed out by Arfrever Frehtes Taifersar Arahesis. Help from and ok djm@, "sounds good to me" millert@
2009-02-08updates to IEEE Std 1003.1-2008;Jason McIntyre
2009-02-08bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewJason McIntyre
updates to follow;
2008-10-19over-rule -> overrule; from Thomas PfaffJason McIntyre
2008-08-20The code to detect multiple applied diffs to empty files I introduced 4Otto Moerbeek
years ago is not correct if the diff has an empty context for other reasons, so revert that change. Problem found by Joerg Sonnenberger; ok tedu@ millert@
2008-06-06update the description of -b and STANDARDS; suggested by grunkJason McIntyre
ok millert
2008-01-11providing MLINKS for shell builtins makes little sense: what we had was outJason McIntyre
of date for ever (no ksh builtins), and since we have two shells, pointing to one page or the other is never going to work; so remove MLINKS for csh(1); the cd(1) and wait(1) pages (also builtins); and update any trailing Xr's; please, there are tools like whence, man, and locate for finding this stuff; ok deraadt miod
2007-09-02use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgTheo de Raadt
2007-05-31convert to new .Dd format;Jason McIntyre
2007-05-31- note some apps which are xpg4, not posixJason McIntyre
- note that some apps are optional to posix after some discussion w/ otto