History log of /freebsd/usr.bin/patch/inp.c (Results 1 – 25 of 37)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 25696725 19-Apr-2024 Martin Tournoij <martin@arp242.net>

patch: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBS

patch: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

show more ...


Revision tags: release/13.3.0, release/14.0.0
# 42b38843 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0
# c384a278 22-Jul-2021 Pedro F. Giffuni <pfg@FreeBSD.org>

patch: cleanup variable initialization a bit.

musl libc fgetln is a bit more pickier.

Hinted by: chimera-linux (git 31491e1de2e1241885984cd9e4b978965f14eda4)


Revision tags: release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# c79126f2 12-Jan-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r327624 through r327885.


# 21ab148d 11-Jan-2018 Kyle Evans <kevans@FreeBSD.org>

patch(1): Don't check for NUL bytes in Plan A

Plan A mmap()'s the entire input file and operates on it in memory. The
map(2) call succeeded, so we shouldn't need to bother checking for the NUL
byte

patch(1): Don't check for NUL bytes in Plan A

Plan A mmap()'s the entire input file and operates on it in memory. The
map(2) call succeeded, so we shouldn't need to bother checking for the NUL
byte as long as we're within our buffer space.

This was clearly intentional to match "the behavior of the original code",
but it creates a discrepancy between Plan A and Plan B that doesn't seem
sensible and it's not inherently wrong to allow a NUL byte.

This change was motivated by the gemspec in net/rubygem-grpc failing to
patch, despite the patch being generated with diff, because a NUL byte was
used as a delimiter in the header briefly in an otherwise text file.

An alternative was considered: to fallback to plan B if plan A won't process
the entire file due to a NUL byte, but I deemed this to be the better option
since plan A isn't failing due to memory limitations and will fail later on
if it's really dealing with a file it shouldn't be.

PR: 224842 (exp-run)
Reported by: swills
Reviewed by: emaste, pfg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13738

show more ...


Revision tags: release/10.4.0, release/11.1.0
# 63433bc9 05-Mar-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

bc/dc/patch: make some use of reallocarray(3).

reallocarray(3) is a non portable extension from OpenBSD. Given that it is
already in FreeBSD, make easier future merges by adopting in some cases
wher

bc/dc/patch: make some use of reallocarray(3).

reallocarray(3) is a non portable extension from OpenBSD. Given that it is
already in FreeBSD, make easier future merges by adopting in some cases
where the code has some shared heritage with OpenBSD.

Obtained from: OpenBSD

show more ...


Revision tags: release/11.0.1, release/11.0.0, release/10.3.0
# 11d38a57 28-Oct-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Merge from head

Sponsored by: Gandi.net


# b5ff185e 12-Sep-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Merge from head


# 00176600 09-Sep-2015 Navdeep Parhar <np@FreeBSD.org>

Merge r286744-r287584 from head.


# 23a32822 25-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Merge from HEAD


# 6fdf637e 17-Aug-2015 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r286697 through r286857.


# e678759c 15-Aug-2015 Xin LI <delphij@FreeBSD.org>

Remove automatic checkout feature.

Obtained from: DragonFly via OpenBSD
Relnotes: yes
MFC: never


# ab875b71 14-Aug-2015 Navdeep Parhar <np@FreeBSD.org>

Catch up with head, primarily for the 1.14.4.0 firmware.


# f98ee844 12-Aug-2015 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r286422 through r286684.


Revision tags: release/10.2.0
# 812aa46f 11-Aug-2015 Xin LI <delphij@FreeBSD.org>

Use __DECONST instead of doing strdup/free.

Suggested by: ed
MFC after: 2 weeks


# 2cf624f6 10-Aug-2015 Xin LI <delphij@FreeBSD.org>

use posix_spawn(3) instead of fork() and exec() manually as suggested
by jmg@.

Reviewed By: pfg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3353


# 1347814c 07-Aug-2015 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r285924 through r286421.


# 1e3e5815 28-Jul-2015 Xin LI <delphij@FreeBSD.org>

Fix shell injection vulnerability in patch(1) and drop SCCS
support by replacing system() with execve().

Future revisions may remove the functionality completely.

Obtained from: Bitrig
Security: CV

Fix shell injection vulnerability in patch(1) and drop SCCS
support by replacing system() with execve().

Future revisions may remove the functionality completely.

Obtained from: Bitrig
Security: CVE-2015-1416

show more ...


# 416ba5c7 22-Jun-2015 Navdeep Parhar <np@FreeBSD.org>

Catch up with HEAD (r280229-r284686).


# 98e0ffae 27-May-2015 Simon J. Gerraty <sjg@FreeBSD.org>

Merge sync of head


# 7757a1b4 03-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Merge from head


# 7263c8c0 22-Apr-2015 Glen Barber <gjb@FreeBSD.org>

MFH: r280643-r281852

Sponsored by: The FreeBSD Foundation


# df6e4074 21-Apr-2015 Pedro F. Giffuni <pfg@FreeBSD.org>

patch(1): small include changes.

Mostly to match OpenBSD, no functional change.

Obtained from: OpenBSD


# a45060f0 07-Apr-2015 Pedro F. Giffuni <pfg@FreeBSD.org>

patch: Bring small updates from OpenBSD

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

patch: Bring small updates from OpenBSD

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

show more ...


Revision tags: release/10.1.0, release/9.3.0, release/10.0.0, release/9.2.0
# cfe30d02 19-Jun-2013 Gleb Smirnoff <glebius@FreeBSD.org>

Merge fresh head.


12