Skip to content

Iterative loop for ls recursive directory search#8728

Open
kimono-koans wants to merge 98 commits intouutils:mainfrom
kimono-koans:recursive_loop
Open

Iterative loop for ls recursive directory search#8728
kimono-koans wants to merge 98 commits intouutils:mainfrom
kimono-koans:recursive_loop

Conversation

@kimono-koans
Copy link
Contributor

@kimono-koans kimono-koans commented Sep 24, 2025

Would resolve: #8725

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 24, 2025

CodSpeed Performance Report

Merging #8728 will degrade performance by 6.93%

Comparing kimono-koans:recursive_loop (a81624d) with main (6c5fae7)

Summary

⚡ 1 improvement
❌ 3 regressions
✅ 123 untouched
⏩ 6 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Efficiency
ls_recursive_deep_tree[(200, 2)] 2.2 ms 1.8 ms +23.04%
ls_recursive_long_all_wide_tree[(15000, 1500)] 142.9 ms 153.6 ms -6.93%
ls_recursive_long_all_balanced_tree[(6, 4, 15)] 134.5 ms 141.3 ms -4.85%
ls_recursive_long_all_mixed_tree 2.9 ms 3.1 ms -6.36%

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail/overlay-headers. tests/tail/overlay-headers is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail/overlay-headers. tests/tail/overlay-headers is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

GNU testsuite comparison:

GNU test failed: tests/ls/follow-slink. tests/ls/follow-slink is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

GNU testsuite comparison:

GNU test failed: tests/ls/capability. tests/ls/capability is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/ls/follow-slink. tests/ls/follow-slink is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

GNU testsuite comparison:

GNU test failed: tests/ls/follow-slink. tests/ls/follow-slink is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

@github-actions
Copy link

github-actions bot commented Oct 2, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

@kimono-koans kimono-koans marked this pull request as ready for review October 2, 2025 01:34
@kimono-koans kimono-koans marked this pull request as draft October 2, 2025 15:50
@kimono-koans kimono-koans marked this pull request as ready for review October 4, 2025 01:49
@sylvestre
Copy link
Contributor

Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

it is a regression, sorry

@kimono-koans
Copy link
Contributor Author

kimono-koans commented Oct 6, 2025

Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

it is a regression, sorry

It's not a very good GNU test unfortunately. It seems purely about some internal GNU implementation detail which is years outdated. Because this branch works displaying colors when a file has a capability and ca=1 is set in LS_COLORS.

See the test below:

touch file || framework_failure_

setcap 'cap_net_bind_service=ep' file ||
  skip_ "setcap doesn't work"

LS_COLORS=ca=1; export LS_COLORS
strace -e capget ls --color=always > /dev/null 2> out || fail=1
$EGREP 'capget\(' out || skip_ "your ls doesn't call capget"

Now -- setcap and getcap are packaged together, and can you guess how getcap obtains the capability? Like my branch, it also checks the xattr of the file.

getxattr("./file", "security.capability", "\1\0\0\2\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 20

Right now, capget, the syscall, is AFAICT only for obtaining a thread's capabilities, not a files, so I really have no idea what GNU is doing here. This test works without calling capget, and has AFAICT for every kernel since 2.6.24. Prior to 2.6.24, there didn't seem to be any VFS support (read: any cap support for files).

See: https://man7.org/linux/man-pages/man2/capget.2.html

Also, IMHO, in no world, was this ever passing for uutils, because, in no world, was any code running which called capget in main/master.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

Copy link
Contributor

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still need love to fix

Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Note: The gnu test tests/ls/no-cap is now being skipped but was previously passing.

@sylvestre
Copy link
Contributor

i am sorry but it needs to be rebased :)

@sylvestre
Copy link
Contributor

@kimono-koans ping ? :)

@oech3
Copy link
Contributor

oech3 commented Mar 8, 2026

@kimono-koans Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ls: enter_directory should use an iterative loop instead of recursing

4 participants