paste: serial mode exhausts file descriptors by opening every input simultaneously
维护者通常 1 天内回复
评估
调研方向
从 src/uu/paste/src/paste.rs 开始,重点查看第 101–115 行打开输入的循环以及串行处理分支。使用 issue 中的 Bash 命令重现文件描述符限制导致的失败,然后检查串行模式是否逐个处理输入。重现步骤以预期的输出和状态成功运行,即表示完成;issue 报告称现有的 27 个 paste 集成测试全部通过。
由索引模型根据 Issue 内容生成。
描述
With paste -s, uutils opens every input file before processing any of them. This makes serial mode fail with "Too many open files" on batches that GNU paste processes successfully one file at a time.
Reproduced on Linux x86_64 at commit c1f172886c6643f61ffde5a1ce3db0aaf14e182b, in both debug and release builds. Compared with GNU coreutils 9.7 and the project-recommended GNU 9.12 reference package (Ubuntu 9.12-0ubuntu1~ppa1).
Reproducer
Run in Bash from the repository root:
cargo build --no-default-features --features paste
d=$(mktemp -d)
for i in {1..40}; do
printf 'a\nb\n' > "$d/f$i"
done
(ulimit -n 32; LC_ALL=C target/debug/coreutils paste -s "$d"/f*)
echo "status: $?"
Actual: no stdout, status 1, and:
paste: Too many open files
Expected: 40 lines containing a<TAB>b, status 0. Replacing target/debug/coreutils paste with GNU paste gives that result under the same limit.
The limit change applies only to the subshell. The reproducer leaves its temporary input directory in place.
Validation and cause
The failure also occurs with 1,032 files under a 1,024-descriptor limit, with --serial, custom delimiters, and -z. Small batches succeed. Both GNU versions passed all 12 tested combinations; each uutils build failed the six combinations exceeding the descriptor limit. All 27 existing paste integration tests pass.
The input-opening loop in paste.rs, lines 101-115 retains every file handle before reaching the serial branch. Serial mode should open, process, and close each file individually.
Related reports
Searches of open/closed issues, PRs, and comments for paste plus "too many open", "file descriptors", "RLIMIT_NOFILE", "EMFILE", and "opens all" found no matching report. #15254 and #15642 concern missing-file errors; this reproducer uses only existing, readable files.
Investigation and report prepared with AI assistance.
- 主要语言
- Rust
- 星标
- 24.3k
- 派生
- 2.1k
- 平均合并
- 1 天 21 小时
- 30 天内合并 PR
- 357
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
uutils/coreutils 的其他 Issue
-
fmt: stops at an unreadable file operand and says only 'read error' for a directory可能已有人在做 @emirmrkaljevic 今天认领。 未关闭U - fmt
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
shuf: exhausted random source destroys the input during an in-place shuffle可能已有人在做 @limadog9 于 1 天前认领。 未关闭U - shuf
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
unexpand: final newline prevents conversion of leading Unicode blanks可能已有人在做 @Ybucaille 今天认领。 未关闭U - unexpand
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
chmod -v: missing 'could not be accessed' line for operands that can't be stat'ed可能已有人在做 @emirmrkaljevic 于 1 天前认领。 未关闭U - chmod
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
chown, chgrp: 'cannot dereference' instead of 'cannot access' for a missing operand可能已有人在做 @emirmrkaljevic 于 1 天前认领。 未关闭U - chgrp U - chown
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
type: enhancement
难度 2/5 1-3 小时 新手友好度 62/100
franciscoBSalgueiro/en-croissant#1061 ·
维护者通常 3 天内回复
-
chore good first issue macros spire
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
groupmod -U: members change in /etc/group but not in /etc/gshadow可能已有人在做 @jayhemnani9910 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复