Skip to content

Commit

Permalink
zfsbootmenu: protect stdout of main interface
Browse files Browse the repository at this point in the history
fzf forces us to capture stdout to know which key combination was
pressed and which item was selected. A bug has been lurking for ages:

* Hit mod-l on the main screen to see the warning/error log
* Hit enter to select whatever is shown
* Hit mod-p to look at the pool status screen

When the sub fzf instance used to draw logs exits with a selection (e.g.
with the enter key), it writes that to stdout. Then when the lower level
fzf instance exits (e.g. the main menu screen) with a selection, stdout
from both instances is captured by the subshell.

This solution protects against that by discarding stdout from all of the
sub-instances of fzf.
  • Loading branch information
zdykstra committed Oct 13, 2023
1 parent 6528649 commit 7532d1f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions zfsbootmenu/lib/fzf-defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
fuzzy_default_options=(
"--ansi" "--no-clear" "--cycle" "--color=16"
"--layout=reverse-list" "--inline-info" "--tac"
"--bind" '"alt-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} ]"'
"--bind" '"ctrl-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} ]"'
"--bind" '"ctrl-alt-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} ]"'
"--bind" "\"alt-l:execute[ /bin/zlogtail ]${HAS_REFRESH:++refresh-preview}\""
"--bind" "\"ctrl-l:execute[ /bin/zlogtail ]${HAS_REFRESH:++refresh-preview}\""
"--bind" "\"ctrl-alt-l:execute[ /bin/zlogtail ]${HAS_REFRESH:++refresh-preview}\""
"--bind" '"alt-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} 1>/dev/null ]"'
"--bind" '"ctrl-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} 1>/dev/null ]"'
"--bind" '"ctrl-alt-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} 1>/dev/null ]"'
"--bind" "\"alt-l:execute[ /bin/zlogtail 1>/dev/null ]${HAS_REFRESH:++refresh-preview}\""
"--bind" "\"ctrl-l:execute[ /bin/zlogtail 1>/dev/null ]${HAS_REFRESH:++refresh-preview}\""
"--bind" "\"ctrl-alt-l:execute[ /bin/zlogtail 1>/dev/null ]${HAS_REFRESH:++refresh-preview}\""
)

if [ -n "${HAS_BORDER}" ]; then
Expand Down

0 comments on commit 7532d1f

Please sign in to comment.