fs.globSync returns incorrect results with non-UTF8 encoded file names.
未关闭
还没有人认领这个 Issue。
confirmed-bug
fs
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
For example... on Linux, where file names are just byte sequences...
const { writeFileSync, existsSync, globSync } = require('node:fs');
const path = Buffer.from([0xe9]);
writeFileSync(path, 'hello');
existsSync(path); // true
console.log(globSync('[^a-z]')); // [ '�' ] non-utf8 bytes in the file name end up replaced.
The globSync, et. al APIs likely need an encoding option that instructs it to return the filenames as Buffer objects.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 fs.globSync 入口点开始,使用包含字节 0xe9 的文件名重现 Linux 示例。跟踪 glob 结果的解码方式,并检查相关 glob API 的行为是否一致。完成的标准是:非 UTF-8 文件名可以在不出现替换字符的情况下返回,并且提议的面向 Buffer 的编码选项已由测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100