-
-
Notifications
You must be signed in to change notification settings - Fork 36.8k
os.sendfile() can return a bogus number of transferred bytes on illumos #154324
Copy link
Copy link
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesOS-unsupportedextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesOS-unsupportedextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Bug report
os.sendfile()on Solaris/illumos can return a bogus number of transferred bytes instead of raising an error.illumos
sendfile(3EXT)is a wrapper around thesendfilev(3EXT)system call. It returns the number of transferred bytes by adding it to*off, but does not initialize it, so*offis advanced by an indeterminate value if the transfer failed before writing any data.os_sendfile_impl()derives the number of transferred bytes from the change of the offset, to support partial writes (gh-86403), and therefore turns such errors into a positive result:shutil.copyfile()can therefore silently leave the destination file incomplete, andtest_shutil.TestZeroCopySendfile.test_same_filefails.sendfilev()reports the number of transferred bytes in an explicit out parameter and can be used instead.Linked PRs