`Server.kill_session(name)` kills a session whose name only starts with `name`

Đang mở Phù hợp với người mới
#839 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
83/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Đọc src/libtmux/server.py quanh Server.kill_session (dòng 483–500) và so sánh cách xử lý mục tiêu với has_session(exact=True) quanh dòng 429. Sau đó, tìm các bài kiểm thử kill-session liên quan và chạy chúng. Hoàn thành khi việc kết thúc một tên chính xác không tồn tại gây ra lỗi, còn phiên có tên chỉ chung tiền tố đó vẫn được giữ lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Summary

Server.kill_session("doom") removes a session named doomsday when no doom exists. It passes the bare name to kill-session -t, and tmux resolves a bare target by prefix and fnmatch(3). The docstring says so ("'asdf' will kill 'asdfasd'"), while Server.has_session() already defaults to exact=True. Scripts that kill by name can end someone else's session.

Reproduction
  1. Create two sessions and kill by the shorter name:
import libtmux
srv = libtmux.Server(socket_name="kill-prefix", config_file="/dev/null")
srv.new_session("probe", window_command="sh")
srv.new_session("doomsday", window_command="sh")
srv.kill_session("doom")
print(sorted(s.name for s in srv.sessions))
srv.kill()
Expected

kill_session("doom") raises because no session named doom exists, and doomsday survives.

Actual

It returns normally and doomsday is gone: ['probe'].

Environment
  • libtmux: master at 886b1cd (v0.62.0 plus 114 commits)
  • tmux: 3.8 (system build reports 3.8a)
  • Python: run with uv run --frozen from the libtmux checkout
  • OS: Linux (WSL2), private -L socket, -f /dev/null
References
Ngôn ngữ chính
Python
Star
1.2k
Fork
127
Merge trung bình
2 giờ 37 phút
Pull request đã merge (30 ngày)
33

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tmux-python/libtmux

Tất cả issue của tmux-python/libtmux

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.