Repository navigation
修复 #632:zsh 下 service_is_active 误报导致 clashctl ui 端口随机重分配 - #633
Merged
Merged
Conversation
Zsh cannot evaluate the Bash-only constructs used by the service layers
(read -r -a, ${!arr[@]}, ${s:i:1}, $BASHPID, $BASH_SOURCE). Under zsh,
service_is_active reported false while the kernel was still running, so
_detect_ext_addr treated its own external-controller port as a foreign
conflict and reassigned a random port on every clashctl ui run, leaving the
printed address out of sync with the live kernel and forcing users to change
the URL repeatedly.
Add scripts/lib/shell.sh with one bash -c forwarder, route every
non-shell-mutating subcommand through it from the dispatcher, and keep
on/off/update/help/version in the current shell. Fold the duplicated
per-command ZSH_VERSION guards into the shared helper and extend
tests/zsh-commands.sh to assert the forwarding contract.
Up to standards ✅🟢 Issues
|
将服务和控制地址替身写入测试安装目录,确保 zsh 转发后的 Bash 子进程也能重新加载。固定测试服务管理方式为 nohup,避免宿主机已有的 systemd 服务掩盖替身失效。
Owner
|
感谢修复! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
zsh 无法求值服务层使用的 Bash 专有构造(
read -r -a、${!arr[@]}、${s:i:1}、$BASHPID、$BASH_SOURCE)。在 zsh 下,service_is_active会在内核仍在运行时报告 false,导致_detect_ext_addr将其自身的 external-controller 端口视为外部冲突,并在每次clashctl ui运行时重新分配随机端口,使打印出的地址与正在运行的内核不同步,用户不得不反复修改 URL。变更
scripts/lib/shell.sh,其中包含一个bash -c转发器。on/off/update/help/version保留在当前 shell 中执行。ZSH_VERSION防护合并到共享 helper 中。tests/zsh-commands.sh,以断言转发契约。Fixes #632