git: patch(1): Sync with FreeBSD

John Marino marino at
Thu Feb 6 03:29:25 PST 2014

commit 5027f2b859b3278b388cbe51b3500242a1661f2c
Author: John Marino <draco at>
Date:   Thu Feb 6 12:22:53 2014 +0100

    patch(1): Sync with FreeBSD
    FreeBSD has taken our patch(1) completely (29 JAN 2013), forked it, and
    has improved on it.  It's a relatively simple sync.  Selected change log:
    More user friendly:
     - Ask only once for "apply anyway"
     - Tell user which patch failed rather than only # of hunk failures
    Handle lines with null character:
     - read buffer for pgets properly populated
     - callers of pgets still misprocess buffer contents, but at least
       pgets is more accurate
    Make "patch < fubar" and "patch -i fubar" equivalent:
     - previous behavior was source of "unexpected end of file in patch"
       errors when null characters came from stdin
    Fixed error handling where final fclose got skipped
    Fixed target selection logic to match was was documented on man page
    Synced with OpenBSD base

Summary of changes:
 usr.bin/patch/common.h |  24 +++---
 usr.bin/patch/inp.c    |  23 +++--
 usr.bin/patch/patch.1  |  34 ++++----
 usr.bin/patch/patch.c  |  57 ++++++++-----
 usr.bin/patch/pch.c    | 225 +++++++++++++++++++++++++++++--------------------
 usr.bin/patch/util.c   |  26 +++---
 6 files changed, 223 insertions(+), 166 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list