fix(cosh-ng): suppress bashdb warning on Alibaba Cloud Linux#1247
Open
kongche-jbw wants to merge 1 commit into
Open
fix(cosh-ng): suppress bashdb warning on Alibaba Cloud Linux#1247kongche-jbw wants to merge 1 commit into
kongche-jbw wants to merge 1 commit into
Conversation
- toggle extdebug off during PROMPT_COMMAND execution
- add _cosh_suspend_extdebug to preserve $? across toggle
- re-enable extdebug in precmd for next DEBUG trap cycle
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.
Description
On Alibaba Cloud Linux,
/etc/sysconfig/bash-prompt-historydetectsshopt extdebugand attempts to load/usr/share/bashdb/bashdb-main.inc,producing a warning when bashdb is not installed. This happens because
cosh-ng enables extdebug for DEBUG trap interception, and system scripts
in PROMPT_COMMAND see it on subsequent prompt draws.
Fix: disable extdebug at the end of preexec (before command runs) and
prepend a suspend helper in PROMPT_COMMAND, then re-enable in precmd
(which runs last). System scripts now execute with extdebug off — their
normal expected environment — while cosh's intercept still works.
Related Issue
no-issue: environment-specific warning fix with no tracking issue
Type of Change
Scope
cosh(copilot-shell)cosh-ng(cosh-ng)sec-core(agent-sec-core)skill(os-skills)sight(agentsight)tokenless(tokenless)ckpt(ws-ckpt)memory(agent-memory)anolisa(anolisa-cli)skillfs(SkillFS)Checklist
cosh-ng:cargo clippy --all-targets -- -D warningsandcargo fmt --checkpassTesting
bash -n$?preservation through_cosh_suspend_extdebug(exit code 42 → preserved correctly)cargo check -p cosh-shellpassesAdditional Notes
The
return 1(intercept) path in preexec cannot disable extdebug beforereturning — bash checks extdebug AFTER the trap returns to decide whether
to honor the skip. The prepended
_cosh_suspend_extdebuginPROMPT_COMMAND covers this case: after an intercept, the next
PROMPT_COMMAND cycle disables extdebug before system scripts run.