Page MenuHomeFreeBSD

install: Expect EINTR while copying
ClosedPublic

Authored by des on Feb 7 2026, 5:46 PM.
Tags
None
Referenced Files
F154283972: D55168.id171770.diff
Mon, Apr 27, 2:36 PM
F154222713: D55168.id171424.diff
Mon, Apr 27, 5:54 AM
Unknown Object (File)
Fri, Apr 24, 6:48 AM
Unknown Object (File)
Fri, Apr 24, 6:03 AM
Unknown Object (File)
Thu, Apr 23, 7:55 AM
Unknown Object (File)
Tue, Apr 21, 11:51 AM
Unknown Object (File)
Sun, Apr 19, 10:52 PM
Unknown Object (File)
Sun, Apr 19, 10:52 PM
Subscribers

Details

Summary

Both copy_file_range() and read() / write() in our fallback loop can be
interrupted before copying anything at all, in which case it returns -1
and sets errno to EINTR. If that happens, we should retry, not fail.

While here, drop the size argument from copy() (we always want to copy
the entire file anyway) and add a test case that exercises the metalog
and digest functionality.

MFC after: 1 week
PR: 293028

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Feb 7 2026, 5:46 PM

Fix fallback too. This is an excellent argument for creating
something like Apple's libcopyfile...

usr.bin/xinstall/tests/install_test.sh
527

A filename with a space that needs encoded would maybe be useful here, to demonstrate that it's properly escaping

usr.bin/xinstall/tests/install_test.sh
527

The point of this test is to exercise the digest functionality, which I accidentally broke in an earlier version of this patch. What you describe belongs in a more general test of the metalog functionality, which is not my goal here.

usr.bin/xinstall/tests/install_test.sh
527

That is the impression you give by writing

test case that exercises the metalog and digest functionality.

I'm not asking for exhaustive metalog tests, just one specific bit that's easy to screw up and super easy to test while you're already here.

des marked 2 inline comments as done.Feb 11 2026, 1:43 PM
This revision is now accepted and ready to land.Feb 11 2026, 3:14 PM
This revision was automatically updated to reflect the committed changes.