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 天內回覆