jlevy / jlevy/tryscript

An unset variable in path: puts the working directory on PATH

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

还没有人认领这个 Issue。

主要语言
TypeScript
星标
13
派生
1
平均合并
3 小时 38 分钟
30 天内合并 PR
3

描述

An unset variable in a `path:` entry expands to an empty string, and an empty `PATH`
element means the current directory to POSIX. So this front matter:

```yaml
path:
- $TOOL_DIR
```

silently puts the working directory on `PATH` when `TOOL_DIR` is not set, instead of
contributing nothing.

That is the wrong failure. A test that names a directory it cannot resolve should get a
clear "command not found", not a lookup that quietly searches somewhere the author never
named — and in a sandboxed run the working directory contains fixtures, which is exactly
where a stray executable could sit.

## Proposal

Drop entries that expand to empty, rather than passing them through.

A test asserting that a bare `$VAR` does not put the working directory on `PATH` would pin
it: today that assertion fails.

## Related

jlevy/tryscript#54 asks for `requires:`, which addresses the same underlying problem from
the other side — knowing which binary a run actually resolved rather than trusting `PATH`
composition to have gone as intended.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

调研方向

定位扩展 path: 条目的代码,并检查未设置的变量如何变成 PATH 元素。添加使用裸 $VAR 的提议测试,然后验证空扩展会被省略且不会搜索工作目录;该测试应产生明确的 command-not-found 结果。

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

评估

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

把新 issue 发到你的邮箱

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