Skip to content

Commit

Permalink
main(--install): fix an infinite loop and empty $make
Browse files Browse the repository at this point in the history
* edit: omit ^C with empty "internal_exec_int_trace"
  • Loading branch information
akinomyoga committed Feb 24, 2024
1 parent 8a32142 commit 3801a87
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 38 deletions.
61 changes: 36 additions & 25 deletions ble.pp
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,32 @@ function ble-update/.download-nightly-build {
) &&
ble-update/.reload
}
## @fn ble-update/.check-build-dependencies
## @var[out] make
function ble-update/.check-build-dependencies {
# check make
make=
if ble/bin#has gmake; then
make=gmake
elif ble/bin#has make && make --version 2>&1 | ble/bin/grep -qiF 'GNU Make'; then
make=make
else
ble/util/print "ble-update: GNU Make is not available." >&2
return 1
fi

# check git, gawk
if ! ble/bin#has git gawk; then
local command
for command in git gawk; do
ble/bin#has "$command" ||
ble/util/print "ble-update: '$command' command is not available." >&2
done
return 1
fi
return 0
}
## @fn ble-update/.check-repository
function ble-update/.check-repository {
if [[ ${_ble_base_repository-} && $_ble_base_repository != release:* ]]; then
if [[ ! -e $_ble_base_repository/.git ]]; then
Expand Down Expand Up @@ -2002,26 +2028,8 @@ function ble-update {
fi
fi

# check make
local make=
if ble/bin#has gmake; then
make=gmake
elif ble/bin#has make && make --version 2>&1 | ble/bin/grep -qiF 'GNU Make'; then
make=make
else
ble/util/print "ble-update: GNU Make is not available." >&2
return 1
fi

# check git, gawk
if ! ble/bin#has git gawk; then
local command
for command in git gawk; do
ble/bin#has "$command" ||
ble/util/print "ble-update: '$command' command is not available." >&2
done
return 1
fi
local make
ble-update/.check-build-dependencies || return 1

local insdir_doc=$_ble_base/doc
[[ ! -d $insdir_doc && -d ${_ble_base%/*}/doc/blesh ]] &&
Expand Down Expand Up @@ -2617,6 +2625,7 @@ function ble/base/sub:install {
local insdir=${1:-${XDG_DATA_HOME:-$HOME/.local/share}}/blesh

local dir=$insdir sudo=
[[ $dir == /* ]] || dir=./$dir
while [[ $dir && ! -d $dir ]]; do
dir=${dir%/*}
done
Expand All @@ -2635,23 +2644,25 @@ function ble/base/sub:install {
ble/util/print "ble.sh --install: already installed" >&2
return 1
fi
local ret
ble/string#quote-word "$insdir"; local qinsdir=$ret
ble/string#quote-word "$_ble_base"; local qbase=$ret
if [[ $sudo ]]; then
local ret
ble/string#quote-word "$insdir"; local qinsdir=$ret
ble/string#quote-word "$_ble_base"; local qbase=$ret

ble/util/print "\$ sudo mkdir -p $qinsdir"
sudo mkdir -p "$insdir"
ble/util/print "\$ sudo cp -Rf $qbase/* $qinsdir/"
sudo cp -Rf "$_ble_base"/* "$insdir/"
ble/util/print "\$ sudo rm -rf $qinsdir/{cache.d,run}"
sudo rm -rf "$insdir"/{cache.d,run}
else
ble/util/print "\$ mkdir -p $qinsdir"
ble/bin/mkdir -p "$insdir"
ble/util/print "\$ cp -Rf $qbase/* $qinsdir/"
ble/bin/cp -Rf "$_ble_base"/* "$insdir/"
ble/util/print "\$ rm -rf $qinsdir/cache.d/*"
ble/bin/rm -rf "$insdir/cache.d"/*
fi
elif ble-update/.check-repository; then
elif local make; ble-update/.check-build-dependencies && ble-update/.check-repository; then
( ble/util/print "cd into $_ble_base_repository..." >&2 &&
builtin cd "$_ble_base_repository" &&
ble-update/.make ${sudo:+--sudo} install INSDIR="$insdir" )
Expand Down
16 changes: 8 additions & 8 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
- complete: add widgets `auto_complete/insert-?word` (requested by Tommimon) `#D2127` 0c4b6772
- edit: add widgets `execute-named-command` and `history-goto` `#D2144` aa92b42a
- keymap/vi_nmap: support `shell-expand-line` `#D2145` aa92b42a
- main: support `bash ble.sh --install` `#D2169` xxxxxxxx
- util(stty): support `bleopt term_stty_restore` (requested by TheFantasticWarrior) `#D2170` xxxxxxxx
- main: support `bash ble.sh --install` `#D2169` 986d26a3 xxxxxxxx
- util(stty): support `bleopt term_stty_restore` (requested by TheFantasticWarrior) `#D2170` e64b02b7

## Changes

Expand Down Expand Up @@ -106,11 +106,11 @@
- main(unload): redirect streams to work around trap `EXIT` in bash-5.2 (reported by ragnarov) `#D2142` 38a8d571
- complete: call the `docker` command through `ble/util/conditional-sync` `#D2150` 6c3f824a
- util(joblist): fix job detection in Bash 5.3 `#D2157` 6d835818
- util(joblist): exclude more foreground dead jobs in Bash 5.3 `#D2174` xxxxxxxx
- util(joblist): exclude more foreground dead jobs in Bash 5.3 `#D2174` 8a321424
- util,complete: work around regex `/=.../` failing in Solaris nawk `#D2162` 46fdf44a
- main: fix issues in MSYS1 `#D2163` 5f0b88fb
- util: work around bash-3.1 bug that `10>&-` fails to close the fd `#D2164` b5938192
- decode: fix the problem that key always timed out in bash-3 `#D2173` xxxxxxxx
- decode: fix the problem that key always timed out in bash-3 `#D2173` 0b176e76

## Contrib

Expand All @@ -120,9 +120,9 @@
- histdb: suppress outputs from `PRAGMA quick_check;` `#D2147` 6154d71c
- histdb: fix variable leak of `ret` `#D2152` 98a2ae15
- util: fix `ble/util/time` in `bash < 4.2` `#D2161` 623dba91
- histdb: support subcommands `#D2167` xxxxxxxx
- histdb: support `top`, `stats`, `calendar`, and `week` `#D2167` xxxxxxxx
- histdb: unify the color palette selection `#D2167` xxxxxxxx
- histdb: support subcommands `#D2167` 4d7dd1ee
- histdb: support `top`, `stats`, `calendar`, and `week` `#D2167` 4d7dd1ee
- histdb: unify the color palette selection `#D2167` 4d7dd1ee
- contrib/fzf-git: update to be consistent with the upstream (motivated by arnoldmashava) `#D2054` c78e5c9f
- contrib/layer/pattern: add `{pattern}` layer `#D2074` 449d92ca
- contrib/fzf-git: fix unsupported command modes (reported by dgudim) `#D2083` ba2b8865
Expand Down Expand Up @@ -168,7 +168,7 @@
- util: work around macOS/FreeBSD failure on `exec 32>&2` (reported by tessus, jon-hotaisle) `#D2165` 8f0dfe9b
- main: fix unprocessed `-PGID` in `*.pid` for cleanup `#D2143` a5da23c0
- history: prevent `SIGPIPE` from reverting the TTY state in trap `EXIT` `#D2153` 4b8a0799
- edit: support `bleopt internal_exec_int_trace` (motivated by tessus) `#D2171` xxxxxxxx
- edit: support `bleopt internal_exec_int_trace` (motivated by tessus) `#D2171` cebea478 xxxxxxxx

<!---------------------------------------------------------------------------->
# ble-0.4.0-devel3
Expand Down
7 changes: 3 additions & 4 deletions lib/core-complete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9344,10 +9344,9 @@ function ble/complete/sabbrev/expand {
return "$exit"
}
function ble/widget/sabbrev-expand {
if ! ble/complete/sabbrev/expand; then
ble/widget/.bell
return 1
fi
ble/complete/sabbrev/expand; local ext=$?
((ext)) && ble/widget/.bell
return "$ext"
}

# sabbrev の補完候補
Expand Down
12 changes: 12 additions & 0 deletions note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,15 @@ bash_tips
- make_command.sh の整理 (scan 分離, char_width 分離)
- note.txt -> memo.txt

2024-02-25

* コマンド実行時に展開を実施する可能性 (motivated by pl643, bkerin)
https://github.com/akinomyoga/ble.sh/discussions/138
https://github.com/akinomyoga/ble.sh/issues/406#issuecomment-1939461192

sabbrev/alias/etc を設定できる様にする? これは履歴展開の処理の箇所で同時に
した方が良い。histverify 等も働くので良い。

2024-02-22

* histdb: calendar で実行時間等についても calendar を作れる様にしたい。現在は
Expand Down Expand Up @@ -7474,6 +7483,9 @@ bash_tips
短くなっていない。でも、少なくとも cp や rm を入力するよりは分かりやすくなっ
た気がするので良い事にする。

テストしていなかった。改めて実行してみたら全然動かなかった。急いで修正を行
う。序でに #D2171 の ^C についても省略する様にする変更を適用する。

2024-02-23

* 2023-06-12 [解消] stty: bash-5.2 以上 exit 後の stty 状態を正しく復元する手法? [#D2168]
Expand Down
4 changes: 3 additions & 1 deletion src/edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6922,7 +6922,9 @@ function ble-edit/exec:gexec/.TRAPINT {
local ext=130
((_ble_bash>=40300)) || ext=128 # bash-4.2 以下は 128
if [[ $_ble_attached ]]; then
ble/util/print "$_ble_term_bold^C$_ble_term_sgr0" >&2
if [[ ${bleopt_internal_exec_int_trace-} ]]; then
ble/util/print "$_ble_term_bold^C$_ble_term_sgr0" >&"$_ble_util_fd_tui_stderr"
fi
_ble_edit_exec_TRAPDEBUG_INT=$ext
ble-edit/exec:gexec/.TRAPDEBUG/trap
else
Expand Down

0 comments on commit 3801a87

Please sign in to comment.