From 65ffe70a7a7c79ff4ff2918b18a6ea0e8469e0f2 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Wed, 2 Mar 2022 19:08:46 +0900 Subject: [PATCH] mandb: fix a bug that the man page is not correctly searched (fixup 2365e09) --- docs/ChangeLog.md | 1 + lib/core-complete.sh | 32 +++++++++++++++++++------------- note.txt | 15 +++++++++++---- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 916e0596..a5df7875 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -176,6 +176,7 @@ - mandb: insert a comma in brace expansions instead of a space `#D1719` 0ac7f03 - mandb: support man-page format of `rsync` `#D1733` 7900144 - mandb: fix a bug that the description is inserted for `--no-OPTION` `#D1761` 88614b8 + - mandb: fix a bug that the man page is not correctly searched (fixup 2365e09) `#D1794` 0000000 - edit: work around the wrong job information of Bash in trap handlers (reported by 3ximus) `#D1435` `#D1436` bc4735e - edit (command-help): work around the Bash bug that tempenv vanishes with `builtin eval` `#D1438` 8379d4a - global: suppress missing locale errors (reported by 3ximus) `#D1440` 4d3c595 diff --git a/lib/core-complete.sh b/lib/core-complete.sh index ea2ae123..61599050 100644 --- a/lib/core-complete.sh +++ b/lib/core-complete.sh @@ -3832,6 +3832,12 @@ function ble/complete/mandb/search-file/.check { return 1 fi } +## @fn ble/complete/mandb/search-file command +## 指定したコマンドに対応する man ページのファイルを検索します。 +## @var[out] ret +## 見つかったファイルへのパスを格納します。 +## @exit +## 該当するファイルが見つかった時に成功します。 function ble/complete/mandb/search-file { local command=$1 @@ -3840,7 +3846,7 @@ function ble/complete/mandb/search-file { ble/complete/mandb/search-file/.check "$path" && return # Get manpaths - local ret; ble/string#split ret : "$MANPATH" + ble/string#split ret : "$MANPATH" # Replace empty paths with the default manpaths ((${#ret[@]})) || ret=('') @@ -3858,25 +3864,25 @@ function ble/complete/mandb/search-file { local path for path in "${manpath[@]}"; do [[ -d $path ]] || continue - ble/complete/mandb/search-file/.check "$path/man1/$command.1" && return - ble/complete/mandb/search-file/.check "$path/man1/$command.8" && return + ble/complete/mandb/search-file/.check "$path/man1/$command.1" && return 0 + ble/complete/mandb/search-file/.check "$path/man1/$command.8" && return 0 if ble/is-function ble/bin/gzip; then - ble/complete/mandb/search-file/.check "$path/man1/$command.1.gz" && return - ble/complete/mandb/search-file/.check "$path/man1/$command.8.gz" && return + ble/complete/mandb/search-file/.check "$path/man1/$command.1.gz" && return 0 + ble/complete/mandb/search-file/.check "$path/man1/$command.8.gz" && return 0 fi if ble/is-function ble/bin/bzcat; then - ble/complete/mandb/search-file/.check "$path/man1/$command.1.bz" && return - ble/complete/mandb/search-file/.check "$path/man1/$command.1.bz2" && return - ble/complete/mandb/search-file/.check "$path/man1/$command.8.bz" && return - ble/complete/mandb/search-file/.check "$path/man1/$command.8.bz2" && return + ble/complete/mandb/search-file/.check "$path/man1/$command.1.bz" && return 0 + ble/complete/mandb/search-file/.check "$path/man1/$command.1.bz2" && return 0 + ble/complete/mandb/search-file/.check "$path/man1/$command.8.bz" && return 0 + ble/complete/mandb/search-file/.check "$path/man1/$command.8.bz2" && return 0 fi if ble/is-function ble/bin/xzcat; then - ble/complete/mandb/search-file/.check "$path/man1/$command.1.xz" && return - ble/complete/mandb/search-file/.check "$path/man1/$command.8.xz" && return + ble/complete/mandb/search-file/.check "$path/man1/$command.1.xz" && return 0 + ble/complete/mandb/search-file/.check "$path/man1/$command.8.xz" && return 0 fi if ble/is-function ble/bin/lzcat; then - ble/complete/mandb/search-file/.check "$path/man1/$command.1.lzma" && return - ble/complete/mandb/search-file/.check "$path/man1/$command.8.lzma" && return + ble/complete/mandb/search-file/.check "$path/man1/$command.1.lzma" && return 0 + ble/complete/mandb/search-file/.check "$path/man1/$command.8.lzma" && return 0 fi done return 1 diff --git a/note.txt b/note.txt index f02f4dbb..fdfb6d5f 100644 --- a/note.txt +++ b/note.txt @@ -1813,10 +1813,6 @@ bash_tips 2022-02-20 - * BUG complete: cygwin$ pdflatex [TAB] で /usr/bin/cat: '': No such file or - directory というエラーが出力される。chat では再現しない。bash-completion は - ロードされていない。 - * より一般の補完 framework に向けたインターフェイスについて https://github.com/rsteube/carapace/issues/431 @@ -6152,6 +6148,17 @@ bash_tips 2022-03-02 + * complete: BUG cygwin$ pdflatex [TAB] で /usr/bin/cat: '': No such file or directory というエラー [#D1794] + Ref #D1637 + + chat では再現しない。bash-completion はロードされていない。 + + うーん。これは 2365e09c によるバグである。今迄5ヶ月間ずっと mandb を正しく + 抽出する事ができていなかったという事になる。今迄何故気付かなかったのだろう。 + 不思議である。或いは、また別の方法によって抽出できていたという事か? → そう + いう事だ。つまり、Linux 等では man -w 等を使ってファイルを決定できていたの + で問題がなかったのである。 + * edit (exec_elapsed_mark): やはり既定で時・日などの分解能の表示にも対応する [#D1793] 長時間ログインしていた後等にはやはり長い時間経過している事がある。