netbsd's patch(1)

Robert Connolly robert at
Sat Sep 16 18:09:47 PDT 2006

Hello. I was looking for an alternative version to GNU Patch, and found that 
NetBSD's netbsd/src/usr.bin/patch will compile, and work, on Linux without 
any modification! It depends on strlcpy/strlcat (which is a good thing), and 
does not use mktemp(3) (which is another good thing). I tested it, it works, 
but one notifiable difference is that BSD's patch(1) will print out the 
patch's header... so you will see the Submitted/Date/Description when you 
apply the patch (this isn't a bad thing), so it's a bit more verbose.

For the mktemp(3) and strlcpy/strlcat reasons, this is a more secure version 
of Patch, and its also being actively maintained. It uses mkstemp, btw.

The Makefile is BSD make format, so it doesn't work with GNU's make. Use:

gcc patch.c pch.c inp.c version.c util.c backupfile.c -o patch -Dlint

There are two ways to get this source, either:
cvs -q -d anoncvs at get -P \
	-rnetbsd-4 src/usr.bin/patch/

3.0.1 is actually the latest stable release, 4.0 is the next stable's 
prerelease branch.

Using this Patch would of course make Glibc's strlcpy patch non-optional.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the hlfs-dev mailing list