CSV rows for stdout sit in a 4 KB buffer until the run ends
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
internal/output/writer.go から始めてください。ensureCSV は stdout を csv.NewWriter でラップし、writeCSVRows は各行をフラッシュせずに書き込むため、フラッシュは Finish でしか行われません。-simulate -format csv ... | cat と -format jsonl を比較して再現してください。完了条件は、stdout に書き込まれる CSV の各行が書き込まれた時点でフラッシュされること、そして output パッケージのテスト(-simulate またはローカルの DNS テストサーバーを使用し、実在のドメインは使わない)が、実行終了前に stdout から1行読み取れることです。
索引モデルが 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分
- マージ済み PR(30日)
- 7
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 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 日以内に返信