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)
Sat, Apr 20, 4:20 AM
Unknown Object (File)
Jan 29 2024, 5:17 PM
Unknown Object (File)
Jan 12 2024, 3:34 PM
Unknown Object (File)
Oct 6 2023, 4:27 PM
Unknown Object (File)
Oct 6 2023, 4:21 PM
Unknown Object (File)
Sep 23 2023, 10:48 AM
Unknown Object (File)
Jun 26 2023, 12:25 PM
Unknown Object (File)
Jun 15 2023, 6:50 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.