ls: don't show . and .. on orphaned directories - #13924
Conversation
|
please add a test to make sure we don't regress, thanks |
|
Binary size comparison: |
|
GNU testsuite comparison: |
Merging this PR will degrade performance by 53.8%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | ls_recursive_long_all_wide_tree[(15000, 1500)] |
231.4 ms | 7,723.9 ms | -97% |
| ❌ | Simulation | ls_recursive_long_all_balanced_tree[(6, 4, 15)] |
284.4 ms | 335.2 ms | -15.16% |
| ❌ | Simulation | ls_recursive_long_all_mixed_tree |
5.6 ms | 6.5 ms | -13.82% |
| ❌ | Simulation | ls_recursive_long_all_deep_tree[(100, 4)] |
6.3 ms | 6.8 ms | -7.43% |
| ⚡ | Simulation | complex_relative_date |
330.6 µs | 318.6 µs | +3.77% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing zveihander:ls-orphan-directory-dots (c2e3bc7) with main (a56bff2)
Footnotes
-
50 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. ↩
Fixes #12968
When a directory is deleted and replaced by another file system object while a process still has it open as its working directory, runing
lswith the-aflag from the orphaned directory still shows.and... the GNUlsdoes not show anything in this case.The dots were being added unconditionally whenever
-awas used, without checking whether the directory is still in the filesystem tree.It now checks whether the directory is still reachable from the parent by comparing inode and device against the parent's stats before it adds the dots.