From e2ec89c013636124319556b61b04b33d7ff0f395 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Mon, 20 Feb 2023 11:45:44 +0900 Subject: [PATCH] main (ble/bin/awk): add workaround for macOS awk-32 --- README-ja_JP.md | 10 +-- README.md | 17 ++--- ble.pp | 16 ++++- docs/ChangeLog.md | 36 ++++++----- note.txt | 159 +++++++++++++++++++++++++++++----------------- src/util.sh | 2 +- 6 files changed, 148 insertions(+), 92 deletions(-) diff --git a/README-ja_JP.md b/README-ja_JP.md index 8b5805fe..6787c5b4 100644 --- a/README-ja_JP.md +++ b/README-ja_JP.md @@ -26,6 +26,7 @@ ## 簡単設定 `ble.sh` をお使いいただくには Bash 3.0 以上 (及び POSIX の基本的なコマンド) が必要です。 + `ble.sh` を取得するには主に2つの方法があります: `git` を用いてソースを取得しビルドする方法と `curl` または `wget` を用いて nightly ビルドをダウンロードする方法です。 詳細は、試用またはインストールに関しては [節1.1](#get-from-source) と [節1.2](#get-from-tarball) を、 `~/.bashrc` の設定に関しては [節1.3](#set-up-bashrc) を御覧ください。 @@ -38,20 +39,21 @@ ```bash # 簡単お試し (インストールせずにお試しいただけます) -git clone --recursive https://github.com/akinomyoga/ble.sh.git +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git make -C ble.sh source ble.sh/out/ble.sh # インストール & .bashrc 簡単設定 (動かない場合は節1.3を御参照下さい) -git clone --recursive https://github.com/akinomyoga/ble.sh.git +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git make -C ble.sh install PREFIX=~/.local echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc ``` 生成過程では、複数のBashスクリプトファイルを結合することで `ble.sh` を生成し、 他の関連ファイルを正しく配置し、またソースコード中のコードコメントを削除してロードを最適化します。 -生成過程は、C/C++ のコンパイルも伴わずバイナリも生成しませんので、コンパイラを準備していただく必要はありません。 + +※生成過程は、C/C++ のコンパイルも伴わずバイナリも生成しませんので、コンパイラを準備していただく必要はありません。
curl を用いて nightly ビルドをダウンロード @@ -126,7 +128,7 @@ bash /path/to/ble.sh --update ```bash # ビルド & パッケージ作成用コマンド -git clone --recursive https://github.com/akinomyoga/ble.sh.git +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git make -C ble.sh install DESTDIR=/tmp/blesh-package PREFIX=/usr/local ``` diff --git a/README.md b/README.md index fcf255a0..6fca195d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ *Bash Line Editor* (`ble.sh`) is a command line editor written in pure Bash which replaces the default GNU Readline. Current devel version is 0.4. -This script supports Bash 3.0 or higher although we recommend to use `ble.sh` with release versions of Bash 4.0 or higher. +This script supports Bash 3.0 or higher although we recommend to use `ble.sh` with release versions of **Bash 4.0 or higher**. Currently, only `UTF-8` encoding is supported for non-ASCII characters. This script is provided under the [**BSD License**](LICENSE.md) (3-clause BSD license). @@ -28,6 +28,7 @@ In fact, I personally call it simply /biːɛliː/ or verbosely read it as /biː ## Quick instructions To use `ble.sh`, Bash 3.0+ and POSIX standard utilities are required. + There are two ways to get `ble.sh`: to download and build `ble.sh` using `git`, or to download the nightly build using `curl` or `wget`. For the detailed descriptions, see [Sec 1.1](#get-from-source) and [Sec 1.2](#get-from-tarball) for trial/installation, and [Sec 1.3](#set-up-bashrc) for the setup of your `~/.bashrc`. @@ -40,26 +41,24 @@ In the following, please replace `make` with `gmake` if your system provides GNU ```bash # TRIAL without installation -git clone --recursive https://github.com/akinomyoga/ble.sh.git +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git make -C ble.sh source ble.sh/out/ble.sh # Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3) -git clone --recursive https://github.com/akinomyoga/ble.sh.git +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git make -C ble.sh install PREFIX=~/.local echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc ``` The build process integrates multiple Bash script files into a single Bash script `ble.sh`, place other module files in appropriate places, and strip code comments for shorter initialization time. -This does not involve any C/C++/Fortran compilations and generating binaries, so C/C++/Fortran compilers are not needed. - -[ Some people seem to bilindly believe that one always need to use `make` with C/C++/Fortran compilers to generate binaries. +Note: This does not involve any C/C++/Fortran compilations and generating binaries, so C/C++/Fortran compilers are not needed. +Some people seem to bilindly believe that one always need to use `make` with C/C++/Fortran compilers to generate binaries. They complain about `ble.sh`'s make process, which comes from the lack of knowledge on `make`. One should learn the general principle of `make`. - C/C++ programs in the repository is used to update the Unicode character table from the Unicode database when a new Unicode standard appears. The generated table is included in the repository: [`canvas.GraphemeClusterBreak.sh`](https://github.com/akinomyoga/ble.sh/blob/master/src/canvas.GraphemeClusterBreak.sh), @@ -69,9 +68,7 @@ and [`canvas.emoji.sh`](https://github.com/akinomyoga/ble.sh/blob/master/src/can so there is no need to run these C/C++ programs in the build process. Another C file is used as an adapter in a old system MSYS1, which is used with an old compiler toolchain in Windows, but it will never be used in Unix-like systems. - -Each file used in the build process is explained in [make/README.md](make/README.md). ] - +Each file used in the build process is explained in [`make/README.md`](make/README.md).
Download the nightly build with curl diff --git a/ble.pp b/ble.pp index d9ba3a16..b569548a 100644 --- a/ble.pp +++ b/ble.pp @@ -1088,9 +1088,21 @@ function ble/bin/awk/.instantiate { _ble_bin_awk_type=unknown fi builtin eval "function ble/bin/awk { '${path//$q/$Q}' -v AWKTYPE=$_ble_bin_awk_type \"\$@\"; }" && ext=0 - [[ $_ble_bin_awk_type == [gmn]awk ]] && - ! ble/is-function "ble/bin/$_ble_bin_awk_type" && + if [[ $OSTYPE == darwin* && $path == /usr/bin/awk && $_ble_bin_awk_type == nawk ]]; then + # Note #D1974: macOS の awk-32 の multibyte character support が怪しい。 + # 問題は GitHub Actions の上では再現できていないが特別の入力で失敗す + # るのかもしれない。または、報告者の環境が壊れているだけの可能性もあ + # る。テスト不可能だが、そもそも nawk は UTF-8 に対応していない前提な + # ので、取り敢えず LC_CTYPE=C で実行する。 + function ble/bin/awk { + local LC_ALL= LC_CTYPE=C 2>/dev/null + /usr/bin/awk -v AWKTYPE=nawk "$@"; local ext=$? + ble/util/unlocal LC_ALL LC_CTYPE 2>/dev/null + return "$ext" + } + elif [[ $_ble_bin_awk_type == [gmn]awk ]] && ! ble/is-function "ble/bin/$_ble_bin_awk_type" ; then builtin eval "function ble/bin/$_ble_bin_awk_type { '${path//$q/$Q}' -v AWKTYPE=$_ble_bin_awk_type \"\$@\"; }" + fi fi fi return "$ext" diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 04310c00..fb69cef0 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -25,7 +25,7 @@ - keymap/vi: add `ble/keymap:vi/script/get-mode` for user-defined mode strings `#D1488` f25a6e8 462918d - prompt: support multiline `prompt_rps1` `#D1502` 4fa139a - canvas: fix wrong coordinate calculation on linefolding (reported by telometto) `#D1602` 9badb5f - - prompt: fix coordinates after `prompt_rps1` `#D1972` xxxxxxx + - prompt: fix coordinates after `prompt_rps1` `#D1972` e128801 - syntax: support tilde expansions in parameter expansions `#D1513` 0506df2 - decode: support `ble-bind -m KEYMAP --cursor DECSCUSR` (motivated by jmederosalvarado) `#D1514` `#D1515` `#D1516` 79d671d - decode: reflect changes after `ble-bind --cursor` `#D1873` 39efcf9 @@ -64,7 +64,7 @@ - syntax: highlight quotes of the `\?` form `#D1584` 5076a03 - syntax: recognize escape \" in double-quoted strings `#D1641` 4b71449 - prompt: support a new backslash sequence `\g{...}` `#D1609` be31391 - - prompt: accept more general `[TYPE:]SPEC` in `\g{...}` like `ble-face` `#D1963` xxxxxxx + - prompt: accept more general `[TYPE:]SPEC` in `\g{...}` like `ble-face` `#D1963` 81b3b0e - complete: add a new option `bleopt complete_limit_auto_menu` `#D1618` 1829d80 - canvas: support grapheme clusters (motivated by huresche) `#D1619` c0d997b - canvas (`ble/util/c2w`): use `EastAsianWidth` and `GeneralCategory` to mimic `wcwidth` `#D1645` 9a132b7 @@ -82,7 +82,7 @@ - prompt: fix hanging by a zero-width `prompt_ruler` `#D1673` 9033f29 - edit: support `bleopt canvas_winch_action` (requested by Johann-Goncalves-Pereira, guptapriyanshu7) `#D1679` 2243e91 - blerc: fix the name of the option `bleopt canvas_winch_action` (reported by Knusper) b1be640 - - edit: go back to the previous lines with `redraw-here` more aggressively `#D1966` xxxxxxx + - edit: go back to the previous lines with `redraw-here` more aggressively `#D1966` a125187 - menu (menu-style:desc): improve descriptions (motivated by Shahabaz-Bagwan) `#D1685` 4de1b45 - menu (menu-style:desc): support multicolumns (motivated by Shahabaz-Bagwan) `#D1686` 231dc39 - menu (menu-style:desc): fix not working `bleopt menu_desc_multicolumn_width=` `#D1727` 2140d1e @@ -120,12 +120,12 @@ - auto-complete: cancel auto-complete for `magic-space` `#D1913` 01b4f67 - complete: support ambiguous completion for command paths `#D1922` 8a716ad - complete: preserve original path segments as long as possible `#D1923` `#D1924` e3cdb9d -- main: support `BLE_SESSION_ID` and `BLE_COMMAND_ID` `#D1925` 44d9e10 `#D1947` 46ac426 `#D1954` xxxxxxx +- main: support `BLE_SESSION_ID` and `BLE_COMMAND_ID` `#D1925` 44d9e10 `#D1947` 46ac426 `#D1954` 651c70c - main: support an option `--inputrc={diff,all,user,none}` `#D1926` 92f2006 - util (`ble/builtin/trap`): support Bash 5.2 `trap -P` `#D1937` 826a275 -- syntax: highlight `\?` in here documents `#D1959` xxxxxxx -- syntax: recognize history expansion in here documents, `"...!"` (bash <= 4.2), and `$!` (bash <= 4.1) `#D1959` xxxxxxx -- syntax: support context after `((...))` and `[[ ... ]]` in bash-5.2 `#D1962` xxxxxxx +- syntax: highlight `\?` in here documents `#D1959` e619e73 +- syntax: recognize history expansion in here documents, `"...!"` (bash <= 4.2), and `$!` (bash <= 4.1) `#D1959` e619e73 +- syntax: support context after `((...))` and `[[ ... ]]` in bash-5.2 `#D1962` 67cb967 ## Changes @@ -189,7 +189,7 @@ - edit (command-help): show source files for functions `#D1779` 7683ab9 - edit (`ble/builtin/exit`): defer exit in trap handlers (motivated by SuperSandro2000) `#D1782` f62fc04 6fdabf3 - util (`blehook`): fix a bug that the the hook arguments are lost (reported by SuperSandro2000) `#D1804` 479795d - - edit: fix a bug of `ble/builtin/exit` inside subshells in the `EXIT` trap `#D1973` xxxxxxx + - edit: fix a bug of `ble/builtin/exit` inside subshells in the `EXIT` trap `#D1973` 0451521 - complete (`source:command/get-desc`): show function location and body `#D1788` 496e798 - edit (`ble-detach`): prepend a space to `stty sane` for `HISTIGNORE=' *'` `#D1796` 26b532e - decode (`bind`): do not treat non-beginning `#` as comments `#D1820` 65c4138 @@ -226,7 +226,7 @@ - canvas: update Unicode version 15.0.0 `#D1880` 49e55f4 - decode (`vi_imap-rlfunc.txt`): update the widget for `backward-kill-word` as `kill-backward-{u => c}word` `#D1896` e19b796 - term (`_ble_term_TERM`): detect wezterm-20220408 `#D1909` 486564a -- color: rearrange color table by `ble palette` (suggested by stackoverflow/caoanan) `#D1961` xxxxxxx +- color: rearrange color table by `ble palette` (suggested by stackoverflow/caoanan) `#D1961` bb8541d ## Fixes @@ -364,7 +364,7 @@ - README: add a link to the explanation on the "more reliable setup" of bashrc (motivated by telometto) `#D1905` 09bb4d3 - README: describe `contrib/fzf` integration (reported by SuperSandro2000, tbagrel1) `#D1907` 3bc3bea b568ade - README: add links to Manual pages for *kspec* and `modifyOtherKeys` `#D1917` fb7bd0b1 b568ade -- README: explain the build process `#D1964` `#D1965` xxxxxxx +- README: explain the build process `#D1964` `#D1965` 14ca1e5 ## Optimization @@ -468,6 +468,7 @@ - main: never load `/etc/inputrc` in openSUSE (motivated by Ultra980) `#D1926` 92f2006 0ceb0cb - canvas: refine detection of `bleopt char_width_mode=musl` `#D1929` b0c16dd - term (`terminology`): work around terminal glitches `#D1946` 9a1b4f9 +- main (`ble/bin/awk`): add workaround for macOS `awk-32` `#D1974` xxxxxxx ## Test @@ -537,7 +538,7 @@ - edit: update prompts on g2sgr change `#D1906` 40625ac - util, decode, vi: fix leak variables `#D1933` 8d5cab8 - util: support `bleopt debug_idle` `#D1945` fa10184 -- global: work around bash-4.4 no-argument return in trap `#D1970` xxxxxxx +- global: work around bash-4.4 no-argument return in trap `#D1970` eb4ffce ## Contrib @@ -560,12 +561,13 @@ - histdb: kill orphan `sqlite3` processes `#D1943` 36e1c89 - histdb: back up the database `#D1944` 36e1c89 - histdb: fix miscellaneous SQL query errors `#D1947` 46ac426 - - histdb: output error messages to tty `#D1952` xxxxxxx - - histdb: fix remaining debug function name "assign{2 => }" in bash <= 3.2 `#D1953` xxxxxxx - - histdb: fix a problem that the background process fails to start in bash-3.0 `#D1956` xxxxxxx - - histdb: fix a bug that history search fails with a single quote in the commandline `#D1957` xxxxxxx - - histdb: fix `histdb-word` completions in the middle of the commandline `#D1968` xxxxxxx - - histdb: support `bleopt histdb_remarks` `#D1968` xxxxxxx + - histdb: output error messages to tty `#D1952` 651c70c + - histdb: fix remaining debug function name "assign{2 => }" in bash <= 3.2 `#D1953` 651c70c + - histdb: fix a problem that the background process fails to start in bash-3.0 `#D1956` 651c70c + - histdb: fix a bug that history search fails with a single quote in the commandline `#D1957` 651c70c + - histdb: fix `histdb-word` completions in the middle of the commandline `#D1968` adaec05 + - histdb: support `bleopt histdb_remarks` `#D1968` adaec05 + - histdb: support timeout of background processes `#D1971` e0566bd - integration: move `fzf` and `bash-preexec` integrations to subdir `#D1939` 86d9467 diff --git a/note.txt b/note.txt index a7dafb2d..0af00859 100644 --- a/note.txt +++ b/note.txt @@ -876,6 +876,11 @@ bash_tips https://github.com/hyperupcall/autoenv ... これは bash にも対応している。記 録ファイル ~/.autoenv_authorized は zsh-autoenv と同じ様である。 + https://github.com/jamesob/desk ... これも似たような事を実装しているが、恐 + らく予め設定した内容だけでなく現在のディレクトリやコマンド履歴などの動的な + 情報も「セッション」として記録している気がする。然しここまで来ると screen + で良いのではないかという気がしてくる。 + 2021-12-31 * "function f {}" vs "f() {}" [#M0022] @@ -1937,6 +1942,13 @@ bash_tips - keymap の移動 (これは別 commit にする?) - make_command.sh の整理 (scan 分離, char_width 分離) +2023-02-19 + + * cygwin: sudo すると PS1 の \u が bash に化けてしまう。何故? + + PS1='\u' だと発生しない。 PS1='\u\$ ' だと発生する。Cygwin では '\$' を特別 + 視してこれが含まれている時には自前処理している。 + 2023-02-12 * syntax: 5.0 以降では関数名として function `xxx` 等も実は許されている。5.3 @@ -2282,64 +2294,6 @@ bash_tips 未だちゃんと動かない。これは後でちゃんと調べる必要がある。 -2022-06-09 - - * macOS の nawk の振る舞いが変だという事 (reported in killermoehre) - https://github.com/akinomyoga/ble.sh/issues/190 - - % workaround を追加できるのかどうかも定かではないが、取り敢えずおかしな振る舞 - % いをするという事までは確かめていた。これについては改めて調べる事にする。特 - % に binding の状態について確認する。 - % - % 調べてみるとどうも "上下左右 home/end" などの unbind を正しく実行できていな - % い様である。 - % - % a bind/unbind 用のスクリプトに問題がある可能性? → と思ったが別にこれらのファ - % イルはその場で awk によって生成されるのではなくて、昔作ったキャッシュによっ - % て生成された物を再利用しているだけに見える。なので今回は関係ないのではな - % いか。 - % - % 逆に言うと報告されている問題は壊れた nawk によってキャッシュが生成される - % 事により被害が拡大している可能性もある。 - % - % b TERM による bash の上書きを検出できていない可能性? これが怪しい気がする。 - % これの検出を行っている部分のコードを確認する。うーん。先ず勝手に上書きさ - % れたという事が検出されたという訳でもない。或いは検出できないという事が問 - % 題になっているのだろうか。然し、検出には awk は使っていないので awk の - % version で振る舞いが変わるのも変である。 - % - % 正常に動作する awk の場合にも TERM/is-dirty で引っかかっている様子はない。 - % やはりこれは本当に TERM が書き換わった時にだけ起こる問題なのではないか。 - % - % c 改めて unbind のコードの部分で何が起こっているのかについて確認する。 - % - % うーん。unbind 用のコードは - % ble/decode/bind/.generate-source-to-unbind-default で生成している。なので - % 別にキャッシュをしていた訳ではない。よく考えてみたら、ユーザーがその場で - % binding を変えているかもしれないので、毎回その場で unbind のコードを生成 - % しなければならないのだった。 - % - % →何と generate-source-to-unbind-default が何も出力していないのだった。うー - % ん。エラーメッセージは、標準エラー出力を使って記録している .save の方に記 - % 録されていると思われる → と思ったが標準エラー出力ですら空であった。awk - % が途中で終了してしまっているのだろうか。 - % - % うーん。然しこの箇所の awk は LC_ALL=C で動かしている様なので unicode サ - % ポート関係で失敗する訳もないと思われる。一方で報告を受けたエラーはどうも - % unicode サポート関係の様である。 - % - % 実際に awk に読み取らせている内容をファイルにダンプして、自分で awk に入れ - % てみてどの様な問題が起こっているのか確認する。と思ったら何も表示されない。 - % END まで到達していない。更に確かめていくとそもそもこの自前でコンパイルした - % awk は何を入力しても全く動作していないという事が判明した。つまり、この awk - % は全く動作していない。逆に何故これで今まで微妙にでも動いている様に見えたの - % かが謎である。改めてちゃんと動く apple awk を作る事が必要である。 - % - % [結論] Linux 上でコンパイルした apple nawk は実はちゃんとコンパイルできてい - % なくてそもそも全く動作していなかった。 - - Apple nawk を改めて確認するべきかもしれない。 - 2022-06-02 * bash-4.4 crash (reported by notmike-5) @@ -6641,6 +6595,95 @@ bash_tips Done (実装ログ) ------------------------------------------------------------------------------- +2023-02-20 + + * 2022-06-09 macOS の nawk の振る舞いが変だという事 (reported in killermoehre) [#D1974] + https://github.com/akinomyoga/ble.sh/issues/190 + + % workaround を追加できるのかどうかも定かではないが、取り敢えずおかしな振る舞 + % いをするという事までは確かめていた。これについては改めて調べる事にする。特 + % に binding の状態について確認する。 + % + % 調べてみるとどうも "上下左右 home/end" などの unbind を正しく実行できていな + % い様である。 + % + % a bind/unbind 用のスクリプトに問題がある可能性? → と思ったが別にこれらのファ + % イルはその場で awk によって生成されるのではなくて、昔作ったキャッシュによっ + % て生成された物を再利用しているだけに見える。なので今回は関係ないのではな + % いか。 + % + % 逆に言うと報告されている問題は壊れた nawk によってキャッシュが生成される + % 事により被害が拡大している可能性もある。 + % + % b TERM による bash の上書きを検出できていない可能性? これが怪しい気がする。 + % これの検出を行っている部分のコードを確認する。うーん。先ず勝手に上書きさ + % れたという事が検出されたという訳でもない。或いは検出できないという事が問 + % 題になっているのだろうか。然し、検出には awk は使っていないので awk の + % version で振る舞いが変わるのも変である。 + % + % 正常に動作する awk の場合にも TERM/is-dirty で引っかかっている様子はない。 + % やはりこれは本当に TERM が書き換わった時にだけ起こる問題なのではないか。 + % + % c 改めて unbind のコードの部分で何が起こっているのかについて確認する。 + % + % うーん。unbind 用のコードは + % ble/decode/bind/.generate-source-to-unbind-default で生成している。なので + % 別にキャッシュをしていた訳ではない。よく考えてみたら、ユーザーがその場で + % binding を変えているかもしれないので、毎回その場で unbind のコードを生成 + % しなければならないのだった。 + % + % →何と generate-source-to-unbind-default が何も出力していないのだった。うー + % ん。エラーメッセージは、標準エラー出力を使って記録している .save の方に記 + % 録されていると思われる → と思ったが標準エラー出力ですら空であった。awk + % が途中で終了してしまっているのだろうか。 + % + % うーん。然しこの箇所の awk は LC_ALL=C で動かしている様なので unicode サ + % ポート関係で失敗する訳もないと思われる。一方で報告を受けたエラーはどうも + % unicode サポート関係の様である。 + % + % 実際に awk に読み取らせている内容をファイルにダンプして、自分で awk に入れ + % てみてどの様な問題が起こっているのか確認する。と思ったら何も表示されない。 + % END まで到達していない。更に確かめていくとそもそもこの自前でコンパイルした + % awk は何を入力しても全く動作していないという事が判明した。つまり、この awk + % は全く動作していない。逆に何故これで今まで微妙にでも動いている様に見えたの + % かが謎である。改めてちゃんと動く apple awk を作る事が必要である。 + % + % [結論] Linux 上でコンパイルした apple nawk は実はちゃんとコンパイルできてい + % なくてそもそも全く動作していなかった。 + + Apple nawk を改めて確認するべきかもしれない。 + + 2023-02-19 改めて apple の awk を見てみたがまた最近更新されている。然し、こ + れに関連する部分が修正された様な形跡はない。恐らくずっとエラーを出力し続け + るつもりなのだろう。よく考えてみたら nawk は元々 unicode にサポートしていな + かったので、macOS awk を強制的に LC_ALL= LC_CTYPE=C で動かしても問題はない + のではないか。 + + * github actions + + うーん。これに関しては取り敢えず GitHub Actions の macos-latest を使って + 実験してみる? 取り敢えずダミーのリポジトリを作って見てその上で振る舞いを + 実験してみる。 + + awk --version の出力は "awk version 20200816" であり当てにならない。報告 + されている awk も同じ年月日を出力している様だが、blame を見ると問題のエラー + メッセージがソースコードに埋め込まれたのは awk-32 (2021-02-08 もしくは 16 + Feb) である。strings で "towc: multibyte conversion failure on:" という文 + 字列を抽出して見る? →実際にこれを試してみた所、ちゃんと文字列が含まれて + いるという事が分かった。 + + うーん。LC_ALL=en_US.UTF-8 で特に問題もなく動作している気がする。というか + 最初から en_US.UTF-8 が設定されている。色々変えたがよく分からない。因みに + macos-11 ではそもそも multibyte conversion failure のエラーメッセージが + /usr/bin/awk に含まれていないので、これは影響がないのだろうと思われる。 + + github actions の上で awk-32 をコンパイルする様にしてみたが、それでもエラー + メッセージは再現しない。或いは特定の環境だけで起こる問題? 或いは特定の文 + 字列に対してだけ発生する問題? + + 何時迄も保留にしていても仕方がないので取り敢えず対策を入れておく。単に + LC_CTYPE=C を指定する。 + 2023-02-19 * edit: EXIT trap の中のサブシェルの中で exit が動作しない [#D1973] diff --git a/src/util.sh b/src/util.sh index 83b69cd5..3594bfca 100644 --- a/src/util.sh +++ b/src/util.sh @@ -6619,7 +6619,7 @@ function ble/util/s2bytes { ble/util/unlocal LC_ALL LC_CTYPE ble/util/.cache/update-locale return "$?" -} >/dev/null +} &>/dev/null # bind で使用される keyseq の形式