From c8f92878c36dfcf1ff4a32861a7a2a59b7c1cbed Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Mon, 24 Oct 2022 15:07:29 -0500 Subject: [PATCH] Fix `trap -p` Two different bugs completely broke `trap -p`. First bug broke filtering of functions with trap handlers (`functions -na` prints functions separated by a comma, not a new line). Second bug broke showing of function definitions for traps because a refactor renamed only some call sites but references to `$i` renamed. These issues were introduced in a6820cbe and appear to have been caught just in time: no released version is affected (changes made post-3.5.1). --- share/functions/trap.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/trap.fish b/share/functions/trap.fish index 8fd6f8c21..18e82ef34 100644 --- a/share/functions/trap.fish +++ b/share/functions/trap.fish @@ -63,12 +63,12 @@ function trap -d 'Perform an action when the shell receives a signal' if set -q argv[1] set names $argv else - set names (functions -na | string match "__trap_handler_*" | string replace '__trap_handler_' '') + set names (functions -a | string split ',' | string match "__trap_handler_*" | string replace '__trap_handler_' '') end for sig in (string upper -- $names | string replace -r '^SIG' '') if test -n "$sig" - functions __trap_handler_$i + functions __trap_handler_$sig else return 1 end