Skip to content

Commit

Permalink
mandb: fix a bug that the man page is not correctly searched (fixup 2…
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Mar 4, 2022
1 parent 699dabb commit 65ffe70
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Expand Up @@ -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
Expand Down
32 changes: 19 additions & 13 deletions lib/core-complete.sh
Expand Up @@ -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

Expand All @@ -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=('')
Expand All @@ -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
Expand Down
15 changes: 11 additions & 4 deletions note.txt
Expand Up @@ -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

Expand Down Expand Up @@ -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]

長時間ログインしていた後等にはやはり長い時間経過している事がある。
Expand Down

0 comments on commit 65ffe70

Please sign in to comment.