Skip to content

Commit

Permalink
complete: work around the variable leaks by "virsh" completion from "…
Browse files Browse the repository at this point in the history
…libvirt"
  • Loading branch information
akinomyoga committed Nov 23, 2021
1 parent ec91574 commit f985b9a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
9 changes: 5 additions & 4 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
- rlfunc: support nsearch widgets in `vi_nmap` keymap (requested by cornfeedhobo) `#D1651` 9a7c8b1
- prompt: support `bleopt prompt_ruler` (motivated by Barbarossa93) `#D1666` 05cf638
- prompt: fix hanging by a zero-width `prompt_ruler` `#D1673` 9033f29
- edit: support `bleopt canvas_winch_action` (requested by Johann-Goncalves-Pereira, guptapriyanshu7) `#D1679` 0000000
- edit: support `bleopt canvas_winch_action` (requested by Johann-Goncalves-Pereira, guptapriyanshu7) `#D1679` 2243e91

## Changes

Expand Down Expand Up @@ -180,7 +180,7 @@
- canvas: update prompt trace on `char_width_mode` change (reported by Barbarossa93) `#D1642` 68ee111
- decode (`cmap/initialize`): fix unquoted special chars in the cmap cache `#D1647` 7434d2d
- decode: fix a bug that the characters input while initialization are delayed `#D1670` 430f449
- util (`ble/util/readfile`): fix a bug of always exiting with 1 in `bash <= 3.2` (reported by laoshaw) `#D1678` 0000000
- util (`ble/util/readfile`): fix a bug of always exiting with 1 in `bash <= 3.2` (reported by laoshaw) `#D1678` 61705bf

## Documentation

Expand Down Expand Up @@ -218,7 +218,7 @@
- main: work around MSYS2 .inputrc (reported by n1kk) `#D1534` 9e786ae
- util (`modifyOtherKeys`): work around a quirk of Kitty (reported by NoahGorny) `#D1549` f599525
- util (`modifyOtherKeys`): update the workaround for a new quiark of kitty `#D1627` 3e4ecf5
- util (`modifyOtherKeys`): use the kitty protocol for kitty 0.23+ which removes the support of `modifyOtherKeys` `#D1681` 0000000
- util (`modifyOtherKeys`): use the kitty protocol for kitty 0.23+ which removes the support of `modifyOtherKeys` (reported by kovidgoyal) `#D1681` ec91574
- global: work around empty `vi_imap` cache by `tmux-resurrect` `#D1562` 560160b
- decode: identify `kitty` and treat `\e[27u` as isolated ESC (reported by lyiriyah) `#D1585` c2a84a2
- complete: suppress known error messages of `bash-completion` (reported by oc1024, Lun4m) `#D1622` d117973
Expand All @@ -230,7 +230,8 @@
- cmap: freeze the internal codes of <kbd>find</kbd>/<kbd>select</kbd> and kitty special keys `#D1674` fdfe62a
- main: work around self-modifying `PROMPT_COMMAND` by `bash-preexec` (reported by cornfeedhobo) `#D1650` 39ebf53
- decode: work around openSUSE broken `/etc/inputrc` `#D1662` e5b0c86
- decode: work around the overwritten builtin `set` (reported by eadmaster) `#D1680`
- decode: work around the overwritten builtin `set` (reported by eadmaster) `#D1680` a6b4e2c
- complete: work around the variable leaks by `virsh` completion from `libvirt` (reported by telometto) `#D1682` 0000000

## Internal changes and fixes

Expand Down
5 changes: 4 additions & 1 deletion lib/core-complete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2575,8 +2575,11 @@ function ble/complete/progcomp/.compgen {
local q="'" Q="'\''"
compgen_compv="'${compgen_compv//$q/$Q}'"
fi
# WA #D1682: libvirt の virsh 用の補完が勝手に変数 IFS 及び word を書き換えて
# そのまま放置して抜けてしまう。仕方がないので tmpenv で変数の内容を復元する
# 事にする。
local progcomp_prefix=
ble/util/assign compgen 'builtin compgen "${compoptions[@]}" -- "$compgen_compv" 2>/dev/null'
IFS=$IFS word= ble/util/assign compgen 'builtin compgen "${compoptions[@]}" -- "$compgen_compv" 2>/dev/null'

# Note: complete -D 補完仕様に従った補完関数が 124 を返したとき再度始めから補完を行う。
# ble/complete/progcomp/.compgen-helper-func 関数内で補間関数の終了ステータスを確認し、
Expand Down
12 changes: 11 additions & 1 deletion note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5450,7 +5450,17 @@ bash_tips

2021-11-23

* util (modifyOtherKeys): kitty は modifyOtherKeys を廃止する (reported by kovid) [#D1681]
* progcomp: libvirt virsh completion に対する防御 (reported by telometto) [#D1682]
https://github.com/akinomyoga/ble.sh/issues/147

virsh completion を実行した直後にエラーメッセージが出るという事。これは
virsh の補完が IFS=$'\n' と書き換えを行ってそのまま放置するのが原因である。

libvirt に対して patch を送った。accept された。然しこれが実際に
distributions に反映されるのには時間がかかるだろう。workaround として IFS
及び word を tmpenv にする事にした。

* util (modifyOtherKeys): kitty は modifyOtherKeys を廃止する (reported by kovidgoyal) [#D1681]
https://github.com/akinomyoga/ble.sh/issues/110#issuecomment-975732850

* ok: kitty のインストーラのリンクからダウンロードできない。証明書がおかし
Expand Down

0 comments on commit f985b9a

Please sign in to comment.