Running dwalk with stat and without stat doesn't return the same flist
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 200
- Forks
- 85
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 2
Description
Hello,
I was running some tests and noticed that when I run dwalk with stat, it returns a flist in a depth-first–like order, whereas without stat it returns a flist in a breadth-first–like order. The same entry appears at the end in both cases, but I expected the order to be identical since I did not use the --sort option.
After reading the code, I couldn’t find a reason for this difference in behavior. Is there a specific reason why the implementation uses different algorithms depending on whether stat is enabled? Is this intentional?
Examples:
With stat:
$ dwalk -q test --print
drwxr-xr-x root root 30.000 B Feb 27 2026 07:44 /test
drwxr-xr-x root root 19.000 B Feb 27 2026 07:44 /test/dir
-rw-r--r-- root root 0.000 B Feb 27 2026 07:44 /test/dir/fileB
-rw-r--r-- root root 0.000 B Feb 27 2026 07:44 /test/fileA
Without stat:
$ dwalk -q --lite test --print
Type=DIR File=/test
Type=REG File=/test/fileA
Type=DIR File=/test/dir
Type=REG File=/test/dir/fileB
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the dwalk command paths exercised by --stat and --lite, using the provided commands to reproduce their differing entry order. Trace how each mode builds and emits its flist, then determine whether the order difference is intentional. Done means the behavior is explained and, if unintended, the two modes follow the agreed ordering with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100