Skip to content

fix: check the close of files copyTo publishes - #98

Merged
HaoZeke merged 1 commit into
developfrom
fix/fsx-copyto-close
Nov 26, 2026
Merged

HaoZeke merged 1 commit into
developfrom
fix/fsx-copyto-close

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

copyTo now closes its temporary file before the rename, and returns a failed close instead of publishing the destination. A write that a network file system reports lost only at close no longer replaces the destination while copyTo reports success.

The close goes through publish_ops like the other publish closes. On failure the destination is left as it was and the temporary file is removed. The caller still gets an open descriptor of the published file, positioned at the end.

copyTo now closes its temporary file before the rename.

copyTo used to rename the synced temporary file while it was still
open. The caller closed it later and ignored the result. A write that
a network file system reports lost only at close had already replaced
the destination, and copyTo returned success.

The close goes through publish_ops, like the other publish closes. A
failed close is returned, the destination is left as it was, and the
temporary file is removed. A close that a signal interrupts counts as
success and is not retried. A cleanup close after an earlier error
keeps that error. The caller still gets an open descriptor of the
published file, positioned at the end.
@HaoZeke
HaoZeke merged commit 33c0333 into develop Nov 26, 2026
8 checks passed
@HaoZeke
HaoZeke deleted the fix/fsx-copyto-close branch November 26, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant