Remove the last of the signal blocking and checks

fish's signal handlers are now sufficiently innocuous that there should
be no reason to block signals (outside of temporarily, when creating a
thread and we need to manipulate the signal mask).
This commit is contained in:
ridiculousfish
2019-02-23 14:07:17 -08:00
parent ec65ba3427
commit 130f2266d0
7 changed files with 0 additions and 74 deletions

View File

@@ -63,7 +63,6 @@ int autoload_t::unload(const wcstring &cmd) { return this->evict_node(cmd); }
int autoload_t::load(const wcstring &cmd, bool reload) {
int res;
CHECK_BLOCK(0);
ASSERT_IS_MAIN_THREAD();
// TODO: Justify this principal_parser.

View File

@@ -272,19 +272,6 @@ inline bool is_whitespace(const wchar_t *input) { return is_whitespace(wcstring(
[[noreturn]] void __fish_assert(const char *msg, const char *file, size_t line, int error);
/// Check if signals are blocked. If so, print an error message and return from the function
/// performing this check.
#define CHECK_BLOCK(retval)
#if 0
#define CHECK_BLOCK(retval) \
if (signal_is_blocked()) { \
debug(0, "function %s called while blocking signals. ", __func__); \
bugreport(); \
show_stackframe(L'E'); \
return retval; \
}
#endif
/// Shorthand for wgettext call in situations where a C-style string is needed (e.g., fwprintf()).
#define _(wstr) wgettext(wstr).c_str()

View File

@@ -254,18 +254,6 @@ static void event_fire_internal(const event_t &event) {
}
}
// No matches. Time to return.
if (fire.empty()) return;
if (signal_is_blocked()) {
// Fix for #608. Don't run event handlers while signals are blocked.
input_common_add_callback([event]() {
ASSERT_IS_MAIN_THREAD();
event_fire(event);
});
return;
}
// Iterate over our list of matching events. Fire the ones that are still present.
for (const shared_ptr<event_handler_t> &handler : fire) {
// Only fire if this event is still present

View File

@@ -483,8 +483,6 @@ static wchar_t input_read_characters_only() {
}
wint_t input_readch(bool allow_commands) {
CHECK_BLOCK(R_NULL);
// Clear the interrupted flag.
reader_reset_interrupted();
// Search for sequence in mapping tables.

View File

@@ -647,7 +647,6 @@ int parser_t::eval(wcstring cmd, const io_chain_t &io, enum block_type_t block_t
}
void parser_t::eval(parsed_source_ref_t ps, const io_chain_t &io, enum block_type_t block_type) {
CHECK_BLOCK(1);
assert(block_type == TOP || block_type == SUBST);
if (!ps->tree.empty()) {
// Execute the first node.
@@ -662,8 +661,6 @@ int parser_t::eval_node(parsed_source_ref_t ps, tnode_t<T> node, const io_chain_
static_assert(
std::is_same<T, grammar::statement>::value || std::is_same<T, grammar::job_list>::value,
"Unexpected node type");
CHECK_BLOCK(1);
// Handle cancellation requests. If our block stack is currently empty, then we already did
// successfully cancel (or there was nothing to cancel); clear the flag. If our block stack is
// not empty, we are still in the process of cancelling; refuse to evaluate anything.

View File

@@ -29,9 +29,6 @@ struct lookup_entry {
const wchar_t *desc;
};
/// The number of signal blocks in place. Increased by signal_block, decreased by signal_unblock.
static int block_count = 0;
/// Lookup table used to convert between signal names and signal ids, etc.
static const struct lookup_entry signal_table[] = {
#ifdef SIGHUP
@@ -413,19 +410,6 @@ void get_signals_with_handlers(sigset_t *set) {
}
}
void signal_block() {
ASSERT_IS_MAIN_THREAD();
sigset_t chldset;
if (!block_count) {
sigfillset(&chldset);
DIE_ON_FAILURE(pthread_sigmask(SIG_BLOCK, &chldset, NULL));
}
block_count++;
// debug( 0, L"signal block level increased to %d", block_count );
}
/// Ensure we did not inherit any blocked signals. See issue #3964.
void signal_unblock_all() {
sigset_t iset;
@@ -433,21 +417,3 @@ void signal_unblock_all() {
sigprocmask(SIG_SETMASK, &iset, NULL);
}
void signal_unblock() {
ASSERT_IS_MAIN_THREAD();
block_count--;
if (block_count < 0) {
debug(0, _(L"Signal block mismatch"));
bugreport();
FATAL_EXIT();
}
if (!block_count) {
sigset_t chldset;
sigfillset(&chldset);
DIE_ON_FAILURE(pthread_sigmask(SIG_UNBLOCK, &chldset, 0));
}
}
bool signal_is_blocked() { return static_cast<bool>(block_count); }

View File

@@ -29,15 +29,6 @@ void signal_handle(int sig, int do_handle);
/// Ensure we did not inherit any blocked signals. See issue #3964.
void signal_unblock_all();
/// Block all signals.
void signal_block();
/// Unblock all signals.
void signal_unblock();
/// Returns true if signals are being blocked.
bool signal_is_blocked();
/// Returns signals with non-default handlers.
void get_signals_with_handlers(sigset_t *set);