Skip to content

Retry open_cloexec for signals other than SIGINT - #10251

Merged
faho merged 1 commit into
fish-shell:masterfrom
faho:retry-open
Jan 25, 2024
Merged

Retry open_cloexec for signals other than SIGINT#10251
faho merged 1 commit into
fish-shell:masterfrom
faho:retry-open

Conversation

@faho

@faho faho commented Jan 23, 2024

Copy link
Copy Markdown
Member

This retries {w,}open_cloexec if it gets EINTR, unless it got a cancel signal (i.e. SIGINT).

That means if you do cat >fifo (where "fifo" is a fifo without a reader), you can only stop it if you ctrl-c, not if you e.g. resize the terminal.

It also no longer prints the warning when you press ctrl-c - SIGINT is expected, we don't print anything in a lot of cases.

This affects all uses of open_cloexec, e.g. in cd. Most probably won't see a difference, the man page for open(2) on my system claims:

While blocked waiting to complete an open of a slow device (e.g., a FIFO; see fifo(7))

Fixes #10250

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

@faho faho added the bug Something that's not working as intended label Jan 23, 2024
@faho faho added this to the fish next-3.x milestone Jan 23, 2024

@mqudsi mqudsi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Lots of places in our code that can be improved to be more resilient to EINTR.

@faho
faho merged commit ac9c5ed into fish-shell:master Jan 25, 2024
@faho
faho deleted the retry-open branch January 28, 2024 13:22
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something that's not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interrupted system call (open) not handled on redirection to fifo

2 participants