aws / aws/amazon-q-developer-cli
bug: (short issue descriptionDuplicate ~/.local/bin in PATH due to incorrect path existence check in Amazon Q shell scripts)
- 主要言語
- Rust
- スター
- 2k
- フォーク
- 439
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
### Operating system
Linux (Ubuntu/Debian-based distribution)
### Expected behaviour
Describe the bug
Amazon Q shell scripts (profile.pre.bash and profile.post.bash) incorrectly check for the existence of ~/.local/bin in the PATH
variable, which leads to this path being added twice to the PATH. The current check [[ ":$PATH:" != ":$_Q_LOCAL_BIN:" ]] doesn't
properly detect if the path is already present.
Regression Issue
Select this option if this issue appears to be a regression.
Expected Behavior
The PATH variable should contain ~/.local/bin only once. The check in Amazon Q shell scripts should correctly detect if the path is
already present in PATH and not add it again.
### Actual behaviour
Current Behavior
The PATH variable contains ~/.local/bin twice:
/home/user/.local/bin:/other/paths:/home/user/.local/bin
This happens because:
~/.profile adds ~/.local/bin to PATH
Amazon Q shell scripts (profile.pre.bash and profile.post.bash) add it again due to incorrect path existence check
### Steps to reproduce
Reproduction Steps
Have ~/.local/bin added to PATH in ~/.profile (standard in many Linux distributions)
Install Amazon Q CLI
Check PATH variable with echo $PATH
Observe that ~/.local/bin appears twice in the PATH
Possible Solution
Replace the current check in both profile.pre.bash and profile.post.bash:
From:
bash
[[ ":$PATH:" != ":$_Q_LOCAL_BIN:" ]] && PATH="${PATH:+"$PATH:"}$_Q_LOCAL_BIN"
To a more accurate check using regex:
bash
if [[ ! "$PATH" =~ (^|:)"$_Q_LOCAL_BIN"(:|$) ]]; then
PATH="${PATH:+"$PATH:"}$_Q_LOCAL_BIN"
fi
This regex properly checks if the path exists as a complete segment in the PATH variable.
Additional Information/Context
This issue doesn't cause functional problems but is a minor inefficiency as the shell has to search the same directory twice when
looking for executables.
CLI version used
Amazon Q CLI (latest version)
コントリビューションガイド
調査の方向性
まず profile.pre.bash と profile.post.bash を読み、次に ~/.local/bin がすでに PATH に存在する状態で問題を再現し、既存の存在チェックを調べます。各スクリプトが ~/.local/bin を単一の完全な PATH セグメントとして残すようになれば、Ubuntu/Debian の記載されたセットアップも含めて作業は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- shell
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100