History log of /netbsd/usr.bin/patch/util.c (Results 1 – 25 of 30)
Revision Date Author Comments
# 5631a155 25-May-2021 cjep <cjep@NetBSD.org>

As per OpenBSD, use malloc for the line buffer. Fixes the known issue
with long lines and makes our ATF test suite pass fully.
Closes PR bin/54620 from coypu who suggested the approach.
Reviewed by c

As per OpenBSD, use malloc for the line buffer. Fixes the known issue
with long lines and makes our ATF test suite pass fully.
Closes PR bin/54620 from coypu who suggested the approach.
Reviewed by christos.

show more ...


# fa4e3871 17-Nov-2020 rhialto <rhialto@NetBSD.org>

Remove heuristic for dealing with trailing newlines being truncated by mailers.

Patch and explanation taken from bsdimp:
https://bsdimp.blogspot.com/2020/08/a-35-year-old-bug-in-patch-found-in.html

Remove heuristic for dealing with trailing newlines being truncated by mailers.

Patch and explanation taken from bsdimp:
https://bsdimp.blogspot.com/2020/08/a-35-year-old-bug-in-patch-found-in.html
https://svnweb.freebsd.org/base?view=revision&revision=364291

Every version of patch since the first one posted to mod.sources in 1985 have
included a heuristic for coping with the state of email messaging at the
time. This heuristic would add up to 4 blank lines to a patch if it thought it
needed it. The trouble is, though this causes at least one bug.

The bug in my case is that if you have a context diff whose last hunk only
deletes 3 or fewer lines, then if you try to reverse apply it with -R, it will
fail. The reason for this is the heuristic builds an internal representation
that includes those blank lines. However, it should really replicate the lines
from the pattern lines line it would any other time, not assume they are blank
lines. Removing this heuristic will prevent patch from misapplying the lines
removed after applying a 'fuzz' factor to the previous blank line in the file. I
believe this will only affect 'new-style' 4.3BSD context diffs and not the
older-style 4.2BSD diffs and plain, non-context diffs. It won't affect any of
the newer formats, since they don't use the 'omitted' construct in the same way.

Since this heuristic was put into patch at a time when email / etc ate trailing
white space on a regular basis, and since it's clear that this heuristic is the
wrong thing to do at least some of the time, it's better to remove it
entirely. It's not been needed for maybe 20 years since patch files are not
usually corrupted. If there are a small number of patch files that would benefit
from this corruption fixing, those already-currupt patches can be fixed by the
addition of blank lines. I'd wager that no one will ever come to me with an
example of a once-working patch file that breaks with this change. However, I
have 2 patches from the first 195 patches to 2.11BSD that are affected by this
bug, suggesting that the relative frequency of the issue has changed
signficantly since the original heuristic was put into place.

show more ...


# dc14de11 18-Jun-2018 christos <christos@NetBSD.org>

Keep things portable (requested by joerg) by not depending on reallocarr
and instead doing the overflow check ourselves.


# 726f1c18 07-Nov-2015 joerg <joerg@NetBSD.org>

paths.h is not used.


# 2724492d 02-Oct-2010 wiz <wiz@NetBSD.org>

Print version string to stdout instead of stderr;
it is user-requested and not an error.


# 06c042e9 10-Jan-2010 joerg <joerg@NetBSD.org>

Plug a memory leak. From Igor Zinovik.


# d5b2c9a8 19-Sep-2008 joerg <joerg@NetBSD.org>

Update patch to the version used by DragonFly and derived from OpenBSD.
Major changes are:
- better detection of double applied patches
- rejects remain unified diffs for unified patches
- far less l

Update patch to the version used by DragonFly and derived from OpenBSD.
Major changes are:
- better detection of double applied patches
- rejects remain unified diffs for unified patches
- far less limitations, e.g. patch lines may be arbitrary long

This addresses PR standards/11220 by changing patch -b behavior to be
POSIX compliant. Old behavior can be obtained using --suffix, which
works since NetBSD 1.4. pkgsrc has been adjusted accordingly.

show more ...


# bd560fde 14-Oct-2007 lukem <lukem@NetBSD.org>

Convert to using raise_default_signal(3).


# bd21f849 09-Apr-2006 christos <christos@NetBSD.org>

Coverity CID 1253, 1254: Don't assign the return of read or write to size_t.
It will never be negative.


# 4f9669ed 25-Mar-2005 skd <skd@NetBSD.org>

add --dry-run like gnu patch.


# 58d3abc9 30-Oct-2004 dsl <dsl@NetBSD.org>

Add (unsigned char) cast to ctype functions
Stop infinite loop if get lower case char with no upper case equiv.


# 38b27406 30-Jul-2003 itojun <itojun@NetBSD.org>

remove unused macros


# 75c32b46 30-Jul-2003 itojun <itojun@NetBSD.org>

use bounded string op


# c0970755 12-Jul-2003 itojun <itojun@NetBSD.org>

pedantic check around unsafe strncpy.
XXX this code needs a serious rewrite


# ef4b3d62 12-Jul-2003 itojun <itojun@NetBSD.org>

copyright missing in files, copy them from README


# b86c323d 30-May-2003 kristerw <kristerw@NetBSD.org>

Simplify handling of memory allocation, and make sure all return values
from malloc etc. are handled.

This removes the old behavior to retry the operation with a less memory-
consuming method in cas

Simplify handling of memory allocation, and make sure all return values
from malloc etc. are handled.

This removes the old behavior to retry the operation with a less memory-
consuming method in case malloc failed (this mechanism has never really
worked, and is hard to test. Besides, it is less useful now than it was
20 years ago when the code was written...)

show more ...


# 2a9882e7 29-May-2003 kristerw <kristerw@NetBSD.org>

Be consistent with use of types (e.g. do not use LINENUM for quantities
that are not line numbers).


# 1035faff 06-Jan-2003 wiz <wiz@NetBSD.org>

writable, not writeable.


# 93318b47 16-Mar-2002 kristerw <kristerw@NetBSD.org>

Check result of malloc and strdup
Made some functions static
Removed unneccessary buffer
Increased size of some buffers that could overflow


# 2b96113f 11-Mar-2002 kristerw <kristerw@NetBSD.org>

KNF


# 175b5054 11-Mar-2002 kristerw <kristerw@NetBSD.org>

Ansify
Remove unused defines
Remove #ifndef lint
Remove redundant and incorrect casts.


# 8bcbaa7b 08-Mar-2002 kristerw <kristerw@NetBSD.org>

Ansify
Remove 'register'
Make local functions static.
Remove most '#ifndef lint'


# 135600f9 11-Oct-2000 is <is@NetBSD.org>

More format string cleanup by sommerfeld.


# 141aa9e5 09-Feb-1999 sommerfe <sommerfe@NetBSD.org>

Fix PR2429: catch doubly-applied patches which create new files.


# b239b35f 06-Nov-1998 christos <christos@NetBSD.org>

char -> unsigned char
rindex -> strrchr


12