Page MenuHomeFreeBSD

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

Authored by kevans on Jan 2 2018, 5:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 30, 10:44 PM
Unknown Object (File)
Mon, May 26, 2:45 AM
Unknown Object (File)
Fri, May 16, 11:44 AM
Unknown Object (File)
Apr 29 2025, 2:56 PM
Unknown Object (File)
Apr 28 2025, 5:02 PM
Unknown Object (File)
Apr 11 2025, 6:05 PM
Unknown Object (File)
Mar 19 2025, 3:13 AM
Unknown Object (File)
Mar 2 2025, 10:57 PM
Subscribers

Details

Summary

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

Admittedly, I don't know what the "behavior of the original code" is that this is trying to maintain, but this actively broke patching of net/rubygem-grpc at the very least. If this is wrong, I have an alternative patch to make this fallback to plan B, but I don't see any reason for this NUL check.

I will be requested an exp-run for this, but a couple of test patches using plan A worked just fine.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Out of curiosity why are there NUL bytes in the first place?

Out of curiosity why are there NUL bytes in the first place?

I have no clue. If I understood @swills correctly, it's been this way since this port was created and this is a gemspec produced by some Google{r,-tool}. I guess it must be a valid delimiter, given that it's been this way for so long.

I should also note that gpatch(1) is ok with the patch makepatch created and subsequently fail to apply. The patch (that I failed to actually link to here) can be found in the ports patch on the exp-run.

The associated exp-run is now completed.

This revision is now accepted and ready to land.Jan 11 2018, 3:08 AM
This revision was automatically updated to reflect the committed changes.