Skip to content

libutil/fs-sink: Flush FdSink before closing the file descriptor#15486

Merged
lovesegfault merged 1 commit into
masterfrom
restore-regular-file-flush-in-destructor
Mar 16, 2026
Merged

libutil/fs-sink: Flush FdSink before closing the file descriptor#15486
lovesegfault merged 1 commit into
masterfrom
restore-regular-file-flush-in-destructor

Conversation

@xokdvium

Copy link
Copy Markdown
Contributor

Motivation

In 08887ca I neglected the case of interrupts and got bitten by destruction order. fd gets closed before FdSink destructor gets a chance to run. This doesn't matter in the successful code path, but does get hit during interrupts and leads to a bunch of annoying ignored error messages:

error (ignored): write of 16384 bytes: Bad file descriptor
error (ignored): write of 16384 bytes: Bad file descriptor

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

In 08887ca I neglected the case of
interrupts and got bitten by destruction order. fd gets closed before
FdSink destructor gets a chance to run. This doesn't matter in the successful
code path, but does get hit during interrupts and leads to a bunch of annoying
ignored error messages:

error (ignored): write of 16384 bytes: Bad file descriptor
error (ignored): write of 16384 bytes: Bad file descriptor
@xokdvium xokdvium requested a review from edolstra as a code owner March 15, 2026 23:50
@xokdvium xokdvium added the backport 2.34-maintenance Automatically creates a PR against the branch label Mar 15, 2026
@lovesegfault lovesegfault enabled auto-merge March 15, 2026 23:55
@lovesegfault lovesegfault added this pull request to the merge queue Mar 16, 2026
Merged via the queue into master with commit e656f41 Mar 16, 2026
20 checks passed
@lovesegfault lovesegfault deleted the restore-regular-file-flush-in-destructor branch March 16, 2026 01:30
@internal-nix-ci

Copy link
Copy Markdown

Successfully created backport PR for 2.34-maintenance:

brittonr pushed a commit to brittonr/nix that referenced this pull request Apr 1, 2026
…in-destructor

libutil/fs-sink: Flush FdSink before closing the file descriptor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.34-maintenance Automatically creates a PR against the branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants