CSV rows for stdout sit in a 4 KB buffer until the run ends
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 internal/output/writer.go 开始:ensureCSV 将 stdout 包装在 csv.NewWriter 中,而 writeCSVRows 在写入每一行时不做刷新,因此刷新只发生在 Finish 中。使用 -simulate -format csv ... | cat 与 -format jsonl 进行对比复现。完成标准是:stdout 上的每一条 CSV 行在写入时即被刷新;并且 output 包中的一个测试(使用 -simulate 或本地 DNS 测试服务器,而非真实域名)能在运行结束前从 stdout 读取到一行。
由索引模型根据 Issue 内容生成。
描述
Summary
With -format csv, results reach stdout only when 4 KB has accumulated or the run finishes, unlike text, JSON and JSONL, which are written as each result is found; a force quit loses the buffered rows.
Where
internal/output/writer.go:328internal/output/writer.go:354internal/output/writer.go:390internal/output/writer.go:30
Details
ensureCSV wraps stdout in csv.NewWriter(w.stdOut()) (line 328) and writeCSVRows only calls w.csvStdout.Write(row) (line 355). encoding/csv.Writer buffers through a bufio.Writer and is flushed in exactly one place, Finish (lines 390-392; git grep "Flush()" confirms). Text, JSONL and even the JSON array (w.stdOut().Write(data), line 279) are written to stdout as each result is found. The FormatCSV doc comment says it "streams" rows (line 30).
Impact
With -format csv, nothing reaches stdout until 4 KB of rows have accumulated or the run finishes: a consumer on a pipe sees no live results, on a terminal the rows appear after the "Scan complete" breakdown instead of as they are found, and a force quit (the second Ctrl+C, which main_session.go:519-521 deliberately restores) loses every buffered row. The other three formats do not behave this way.
Steps to reproduce
subenum -simulate -hit-rate 100 -rate 2 -format csv -w examples/sample_wordlist.txt example.com | cat prints nothing until the scan ends; the same command with -format jsonl prints a line per hit.
Suggested fix
Call w.csvStdout.Flush() at the end of writeCSVRows when w.csvStdout != nil (stdout only; the file writer already sits on the -o bufio.Writer and can stay buffered).
Acceptance criteria
- Each CSV row written to stdout is flushed when it is written
- A test reads a row from stdout before the run finishes
Getting started
- Relevant files:
internal/output/writer.go - How to run tests:
make test(orgo test ./...). Tests must stay hermetic: use-simulate,-simulate-zoneor the local DNS test server, never a live domain. - Related docs:
docs/DEVELOPER_GUIDE.md,docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at d0c56f0. Severity: low. Effort: S. audit-key: bug|internal/output/writer.go|writeCSVRows
- 主要语言
- Go
- 星标
- 1
- 派生
- 1
- 平均合并
- 6 小时 42 分钟
- 30 天内合并 PR
- 7
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TMHSDigital/subenum 的其他 Issue
-
good first issue severity: low tech-debt
难度 2/5 半天 新手友好度 75/100
TMHSDigital/subenum#329 ·
维护者通常 1 天内回复
-
area: docs documentation good first issue severity: low
难度 2/5 1-3 小时 新手友好度 85/100
TMHSDigital/subenum#327 ·
维护者通常 1 天内回复
-
area: release dependencies good first issue severity: low
难度 2/5 1-3 小时 新手友好度 66/100
TMHSDigital/subenum#324 ·
维护者通常 1 天内回复
-
ci good first issue severity: low
难度 2/5 1-3 小时 新手友好度 62/100
TMHSDigital/subenum#323 ·
维护者通常 1 天内回复
-
community documentation good first issue
难度 2/5 1-3 小时 新手友好度 85/100
TMHSDigital/subenum#135 ·
维护者通常 1 天内回复
查看 TMHSDigital/subenum 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
GillMacedo/godebugdiff#13 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
GillMacedo/racesift#14 ·
-
IsTextFile reads the whole file into memory (OOM on large files in the file watcher)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
gtsteffaniak/filebrowser#3395 ·
维护者通常 1 天内回复
-
effort:s impact:low raised-by:worker risk:low
难度 1/5 1 小时以内 新手友好度 70/100
medici-finance/assay#6496 · 1 条评论 ·
维护者通常 1 天内回复
-
kind/bug require/reproduce require/severity
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复