~/.bash_history is truncated after copilot executes a Bash command
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
### Describe the bug
See: https://github.com/github/copilot-cli/issues/501 for additional context. I believe that #501 should be re-opened, as the fixes mentioned in it are incomplete.
TL;DR: When Copilot executes a Bash command, it truncates the user's `~/.bash_history`, ignoring the user's `HISTFILESIZE`. This is a consequence of the manner in which Bash is invoked (an interactive shell spawned with `bash --norc --noprofile`)
### Affected version
v1.0.11
### Steps to reproduce the behavior
1. Observe `wc -l ~/.bash_history`
2. Instruct copilot to run a Bash command
3. Observe `wc -l ~/.bash_history`
### Expected behavior
Copilot does not modify `~/.bash_history` in any way, especially not truncation.
### Additional context
This issue can be worked around by adding the following shim to your `~/.bashrc`.
```
copilot() {
HISTFILE=/dev/null command copilot "$@"
}
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Start by reproducing the issue with the listed wc -l ~/.bash_history steps on v1.0.11, then inspect how Copilot invokes Bash with --norc --noprofile and how HISTFILESIZE is handled. Done means executing a Bash command no longer modifies or truncates ~/.bash_history, while the existing workaround provides a comparison.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- bash
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 55/100