SVNews r327826

NOTE: This service is experimental and subject to change! Use at your own risk!

2018-01-11 15:01:48 - r327826 by kevans (kevans)

Complete list of files affected by revision r327826:

(Note: At the moment, these links point to ViewVC on They are probably slow. Do not overuse.)

  History   Contents   Diff   MODIFY   /head/usr.bin/patch/inp.c  

Commit message:

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:


Powered by Python FreeBSD support by secnetix GmbH & Co. KG

Page generated in 9 ms, 1 file printed. Current time is 2018-03-19 12:40:32. All times are in UTC/GMT.