From 902967f1117dab3463aebcd241d94b339eadcc5f Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 16 Nov 2026 06:10:38 -0700 Subject: [PATCH] Sync Neovim's plugins once more if Neovim crashes Neovim 0.12.6 segfaulted on the way out after a finished Lazy! sync (report CD-P8RUBS), and the update step failed though the plugins were up to date. If nvim dies from a signal, run the sync once more; it fails if Neovim crashes again, and an ordinary failure isn't retried. Co-Authored-By: Claude Opus 5.5 --- tests/neovim.bats | 29 +++++++++++++++++++++++++++++ updates.d/46-neovim.sh | 12 +++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/neovim.bats b/tests/neovim.bats index 708e3fb..27d3f1e 100644 --- a/tests/neovim.bats +++ b/tests/neovim.bats @@ -70,3 +70,32 @@ update_neovim() { [ -f "$LAZY/lazy.nvim/untracked.so" ] [ ! -e "$BACKUPS" ] } + +@test "a sync that crashes Neovim is run once more" { + plugin lazy.nvim + # Crash the first time only + stub nvim '[ -e "$HOME/crashed" ] && exit 0; touch "$HOME/crashed"; exit 139' + + run update_neovim + [ "$status" -eq 0 ] + [[ "$output" == *"Neovim crashed (signal 11)"* ]] + [ "$(grep -c '^nvim ' "$STUB_LOG")" -eq 2 ] +} + +@test "a sync that crashes Neovim twice fails" { + plugin lazy.nvim + stub nvim 'exit 139' + + run update_neovim + [ "$status" -eq 139 ] + [ "$(grep -c '^nvim ' "$STUB_LOG")" -eq 2 ] +} + +@test "a sync that fails without crashing isn't run again" { + plugin lazy.nvim + stub nvim 'exit 1' + + run update_neovim + [ "$status" -eq 1 ] + [ "$(grep -c '^nvim ' "$STUB_LOG")" -eq 1 ] +} diff --git a/updates.d/46-neovim.sh b/updates.d/46-neovim.sh index f95b9ae..d767ff2 100755 --- a/updates.d/46-neovim.sh +++ b/updates.d/46-neovim.sh @@ -33,5 +33,15 @@ set_aside_broken_plugins() { run_update() { echo "Updating Neovim plugins..." set_aside_broken_plugins - nvim --headless "+Lazy! sync" +qa + # Neovim has crashed on the way out after a finished sync (a segfault on + # 0.12.6, report CD-P8RUBS, 2026-11-11). If it dies from a signal, sync once + # more: that finishes anything left over, and fails if it crashes again. + local status=0 + nvim --headless "+Lazy! sync" +qa || status=$? + if [ "$status" -gt 128 ]; then + echo " Neovim crashed (signal $((status - 128))), so syncing the plugins once more..." + nvim --headless "+Lazy! sync" +qa + return + fi + return "$status" }