diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 99efbdd8..3638ab9f 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -195,6 +195,7 @@ - mandb: process less formatting sequences in parsing `--help` `#D2244` 60d36ba5 - mandb: hook into bash-completion's `_comp_command_offset` `#D2255` cbcce625 - canvas: update tables for Unicode 16.0.0 `#D2283` 5b43ca3f 25a10a6f +- complete: work around `mawk <= 1.3.4-20200525` type-inference bug (reported by KaKi87) `#D2295` xxxxxxxx ## Contrib diff --git a/lib/core-complete.sh b/lib/core-complete.sh index 7043a654..b1f73b35 100644 --- a/lib/core-complete.sh +++ b/lib/core-complete.sh @@ -3941,8 +3941,7 @@ function ble/complete/progcomp/.filter-and-split-compgen { } } - function mandb_process_items(items, _, i, n, items_count, item, name, entry, record, desc, option, optarg, suffix) { - n = length(items); + function mandb_process_items(items, n, _, i, items_count, item, name, entry, record, desc, option, optarg, suffix) { items_count = 0; mandb_count = 0; for (i = 1; i <= n; i++) { @@ -3989,8 +3988,7 @@ function ble/complete/progcomp/.filter-and-split-compgen { # filters # uniq, remove empty - function uniq_items(items, _, n, m, i, item, uniq) { - n = length(items); + function uniq_items(items, n, _, m, i, item, uniq) { m = 0; for (i = 1; i <= n; i++) { item = items[i]; @@ -4003,8 +4001,7 @@ function ble/complete/progcomp/.filter-and-split-compgen { } # filter by regex, restore if nothing matches - function filter_items_by_regex(items, rex_filter, _, n, m, i, item) { - n = length(items); + function filter_items_by_regex(items, n, rex_filter, _, m, i, item) { m = 0; for (i = 1; i <= item_count; i++) { item = items[i]; @@ -4049,7 +4046,7 @@ function ble/complete/progcomp/.filter-and-split-compgen { } # 1. uniq - item_count = uniq_items(items); + item_count = uniq_items(items, item_count); # 2. rtrim if (c_enable_rtrim) { @@ -4059,7 +4056,7 @@ function ble/complete/progcomp/.filter-and-split-compgen { # 3. filter-by-prefix if (c_enable_filter) { - item_count = filter_items_by_regex(items, c_rex_filter); + item_count = filter_items_by_regex(items, item_count, c_rex_filter); } # 4. sort @@ -4073,7 +4070,7 @@ function ble/complete/progcomp/.filter-and-split-compgen { # 5. mandb has_mandb = 0; if (c_enable_mandb) { - item_count = mandb_process_items(items); + item_count = mandb_process_items(items, item_count); has_mandb = mandb_count != 0; } diff --git a/memo/D2295.bashrc b/memo/D2295.bashrc new file mode 100644 index 00000000..ef54fefc --- /dev/null +++ b/memo/D2295.bashrc @@ -0,0 +1,7 @@ +# bashrc + +source ~/.opt/bash-completion/2.11/share/bash-completion/bash_completion +source ~/.mwg/src/ble.sh/out/ble.sh --norc +#ble/bin/awk() { mawk-1.3.4-20230525 -v AWKTYPE=mawk "$@"; } +ble/bin/awk() { mawk-1.3.4-20200120 -v AWKTYPE=mawk "$@"; } +unset -f ble/bin/gawk diff --git a/note.txt b/note.txt index 56f398f8..5a2e27c5 100644 --- a/note.txt +++ b/note.txt @@ -7700,6 +7700,21 @@ bash_tips Done (実装ログ) ------------------------------------------------------------------------------- +2024-12-11 + + * complete: mawk-1.3.4-20230525 以前でプログラム補完が全く効かない (reported by KaKi87) [#D2295] + https://github.com/akinomyoga/ble.sh/issues/535 + + どうも mawk-1.3.4-20230525 以前では関数引数が配列の時に a[] よりも前に + length(a) があると、勝手にその引数はスカラー文字列と判定してコンパイルを実 + 行する様である。そしてこの振る舞いはずっと昔からだった様である。これまで報 + 告を受けなかったのは、gawk が入っているシステムでは mawk よりも gawk を優先 + してこの部分の処理で使っていたため。git clone してビルドする方式だと何れに + しても gawk が要求されるので、殆どのユーザーは gawk をいれていたのだった。 + 一方で、報告者は nightly version を使っていた。 + + 取り敢えず修正した。動作確認もした。 + 2024-11-28 * README: README 及び wiki によく行う説明をまとめる [#D2294] @@ -7781,7 +7796,8 @@ bash_tips と思ったがやはりこれは関係ない事の気がするし、いつの間にかに他の人が色々 別の話をしているので気にしない事にする。 - * 返信 https://www.reddit.com/r/bash/comments/1gzn6gu/blesh_performance_tune_help/?show=original + * done; 返信 https://www.reddit.com/r/bash/comments/1gzn6gu/blesh_performance_tune_help/?show=original + * done: 返信 https://github.com/akinomyoga/ble.sh/discussions/525 * done: profiler の使い方等についても記述するべきではないか。というか、そ もそも performance を改善する為にできることはないかと質問しているのは、