From 2d78c9a0d97d4853064191444ebaa1b2b4425ad0 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 31 Jan 2021 15:42:35 -0800 Subject: [PATCH] Poll the uvar notifier when the reader is interrupted by a signal While the user waits at the prompt, fish is waiting in select(), on stdin. The sigio based universal notifier interrupts select() by arranging for a signal to be delivered, which causes select() to return with EINTR. However we weren't polling the notifier at that point so we would not notice uvar changes, until we got some real input. I didn't notice this when testing, because my testing was changing fish prompt colors which updated the prompt for other reasons. Fixes #7671. --- src/input_common.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/input_common.cpp b/src/input_common.cpp index 3b2e4dc0e..2f1bef66d 100644 --- a/src/input_common.cpp +++ b/src/input_common.cpp @@ -79,6 +79,10 @@ char_event_t input_event_queue_t::readb() { res = select(fd_max + 1, &fdset, nullptr, nullptr, usecs_delay > 0 ? &tv : nullptr); if (res == -1) { if (errno == EINTR || errno == EAGAIN) { + // Some uvar notifiers rely on signals - see #7671. + if (notifier.poll()) { + env_universal_barrier(); + } if (interrupt_handler) { if (auto interrupt_evt = interrupt_handler()) { return *interrupt_evt;