mattn / mattn/files

大量のファイルがあるディレクトリで Asynchronized find すると結果がおかしい?

Open
#9 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
101
Forks
15
PR merge metrics
No merged PRs in 30d

Description

大量のファイルがあるディレクトリで Asynchronized find オプションをつけて実行したところ、結果を wc -l した数値が実行するたびに違いました。

$ files -a ./ | wc -l
  301490

$ files -a ./ | wc -l
  301490

$ files -a ./ | wc -l
  301490
$ files -a -A ./ | wc -l
  266893

$ files -a -A ./ | wc -l
  264223

$ files -a -A ./ | wc -l
  255086

まだこれだけの情報しかないですが報告します。
数万ファイル程度では何度 -A 付きで実行しても上記のようなズレが発生することはなかったです。

macOS 10.12.1

$ file `which files`
/Users/hirofumiwakasugi/.go/bin/files: Mach-O 64-bit executable x86_64

$  go version
go version go1.7.3 darwin/amd64

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing files -a -A ./ | wc -l with a very large directory on the reported macOS and Go versions, comparing repeated runs with and without -A. Trace the CLI entry point and asynchronous find path to identify where results can be lost, then verify that repeated counts are stable before and after the fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.