Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

TestRunCommandHelper_RejectsPathEscapingRoot/absolute_path fails on Windows

未关闭 适合新手
#24 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
67/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
cli, testing

调研方向

阅读 internal/tools/tools_test.go 中的 TestRunCommandHelper_RejectsPathEscapingRoot,并追踪 run_command 如何通过 Go 的 filepath.IsAbs 验证其 path 参数。决定应如何处理 Windows 根路径,然后在 Windows 和另一个平台上运行该测试。完成标准是该测试在各个平台上的预期一致且经过明确设计,并且通过。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Go
星标
1
派生
2
平均合并
16 小时 20 分钟
30 天内合并 PR
13

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Edwin-metcalf/MetCode 的其他 Issue

查看 Edwin-metcalf/MetCode 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。