Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

TestRunCommandHelper_RejectsPathEscapingRoot/absolute_path fails on Windows

Đang mở Phù hợp với người mới
#24 0 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
67/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
cli, testing

Hướng nghiên cứu

Đọc internal/tools/tools_test.go tại TestRunCommandHelper_RejectsPathEscapingRoot và theo dõi cách run_command xác thực đối số path bằng filepath.IsAbs của Go. Quyết định cách xử lý các đường dẫn có gốc của Windows, sau đó chạy bài kiểm thử đó trên Windows và một nền tảng khác. Hoàn tất khi bài kiểm thử có các kỳ vọng nhất quán, có chủ đích trên mọi nền tảng và chạy thành công.

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

Mô tả

TestRunCommandHelper_RejectsPathEscapingRoot/absolute_path fails on Windows.

What happens

The test passes "/etc" as the path argument to run_command and expects an error result before any confirm prompt. On Windows, /etc is not an absolute path to filepath.IsAbs, so the path is not rejected there. The command reaches the interactive y/n confirm instead, and the test gets a different result.

The other three cases in the same test (../outside, a/../../etc, sub/../../secrets) pass on Windows.

Where this showed up

  • Seen on Windows in #21 and #23 (each PR's test run). Both PR authors noted that the same failure happens on the base branch (1bff3df in #23).
  • The test is in internal/tools/tools_test.go at TestRunCommandHelper_RejectsPathEscapingRoot.

Suggested direction

Decide what "absolute" means for path arguments on Windows. Either treat a leading / or \ as rooted when checking path (so /etc is rejected on every platform), or change the test to use a Windows-absolute path such as C:\Windows on Windows only. The first keeps one expectation across platforms.

I have not run this on the current main (335144d); the report above is from the PR runs.

Ngôn ngữ chính
Go
Star
1
Fork
2
Merge trung bình
18 giờ 26 phút
Pull request đã merge (30 ngày)
11

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 Edwin-metcalf/MetCode

Tất cả issue của Edwin-metcalf/MetCode

Issue tương tự

Thêm issue về Go

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.