Skip to content

fix(cosh-ng): suppress bashdb warning on Alibaba Cloud Linux#1247

Open
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/cosh-ng-bashdb-warning
Open

fix(cosh-ng): suppress bashdb warning on Alibaba Cloud Linux#1247
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/cosh-ng-bashdb-warning

Conversation

@kongche-jbw

Copy link
Copy Markdown
Collaborator

Description

On Alibaba Cloud Linux, /etc/sysconfig/bash-prompt-history detects
shopt extdebug and 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

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional change)
  • Performance improvement
  • CI/CD or build changes

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)
  • Multiple / Project-wide

Checklist

  • I have read the Contributing Guide
  • My code follows the project's code style
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation accordingly
  • For cosh-ng: cargo clippy --all-targets -- -D warnings and cargo fmt --check pass

Testing

  • Verified bash syntax with bash -n
  • Verified $? preservation through _cosh_suspend_extdebug (exit code 42 → preserved correctly)
  • cargo check -p cosh-shell passes

Additional Notes

The return 1 (intercept) path in preexec cannot disable extdebug before
returning — bash checks extdebug AFTER the trap returns to decide whether
to honor the skip. The prepended _cosh_suspend_extdebug in
PROMPT_COMMAND covers this case: after an intercept, the next
PROMPT_COMMAND cycle disables extdebug before system scripts run.

    - 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant