Fix handling of copy_file_range() return value
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-06-22T07:19:59Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-handling-of-copy_file_range-return-value.patch (text/plain) patch 0001
While checking return/error handling of file system calls, I found that the copy_file_range() call in pg_combinebackup has a potential problem. If copy_file_range() returns 0, which is a documented condition, then the loop never makes progress and could spin forever. The other uses of copy_file_range() in the tree are surrounded by different logic and don't appear to have this problem. My suggested fix is to make a return value of 0 an error. It most likely indicates that the source file has an unexpected size.
Commits
-
Fix handling of copy_file_range() return value
- 090ce6934c34 17 (unreleased) landed
- d36b728949bf 18 (unreleased) landed
- 994f770a0fd5 19 (unreleased) landed
-
Allow using copy_file_range in write_reconstructed_file
- ac8110155132 17.0 cited
-
Add support for incremental backup.
- dc212340058b 17.0 cited