refactor uu_ls so that crate users can call the ls without having to print everything to stdout#9851
Conversation
|
GNU testsuite comparison: |
|
sorry, it needs to be rebased |
|
Sorry, could you please rebase it? Sorry again |
59813c6 to
a2e601e
Compare
|
GNU testsuite comparison: |
Merging this PR will degrade performance by 10.19%
Performance Changes
Comparing Footnotes
|
|
some jobs are failing and we see some quite significant regressions |
|
|
||
| for (pos, path_data) in dirs.iter().enumerate() { | ||
| let needs_blank_line = pos != 0 || !files.is_empty(); | ||
| let _needs_blank_line = pos != 0 || !files.is_empty(); |
@sylvestre I tried to address these performance concerns. I'm not sure how to validate my changes other than pushing a commit. I also changed things up a bit because one of the most important things for nushell is streaming and I forgot that when I added the CollectorOutput, which collected, duh. I removed that and replaced it with a StreamingOutput which has a batch mode as the default. |
|
GNU testsuite comparison: |
|
@sylvestre can you start the CI so we can see if I caught everything? |
|
GNU testsuite comparison: |
|
@sylvestre hopefully this fixes the last broken test. it passes on my ubuntu vm. if we can start the ci again. i feel for y'all. so many regression tests. 🤯 |
|
GNU testsuite comparison: |
|
done! |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
the memory regressions are acceptable |
|
please let me known when it is ready to be reviewed |
|
@sylvestre it's ready. just was trying to get that memory regression closer but i've kind of had my fill of messing with it. thanks! |
|
@sylvestre any thoughts? Would like to get this landed if it's acceptible before bit rot occurs again. |
|
GNU testsuite comparison: |
|
I don't think these CI errors are related to this PR |
the internal print stdout output
update output handling to add streaming mode.
… output calculations
…rectory_entries and enter_directory functions
430a09b to
dbed28e
Compare
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
|
Thanks for your PR! |
…11930) * ls: restore WASI ".." metadata fallback in collect_directory_entries The ls refactor in #9851 dropped the WASI guard added in #11633, so `ls -al` at a preopened root once again fails with "Capabilities insufficient" when stat'ing "..". Extract the logic into a small `dotdot_path` helper and add a regression test covering `ls -al`. * Update spell-checker ignore words in test_ls.rs
I was wanting to use
uu_lsin nushell and found out that I couldn't because some of the internals weren't exposed in a way such that crate callers could really use it. So, I was wondering if something like this PR would be something worth considering?It refactors the code in such a way so that crate callers could call uu_ls and get structured data back instead of everything printing to stdout. It does this without a breaking change by implementing a type of visitor pattern through the
LsOutputtrait.I created a
TextOutputstruct that impelments theLsOutputtrait so now thelist()function now looks like this:All of this allows crate callers like nushell to now do something like this:
One last note, I know I didn't discuss this with anyone so it won't hurt my feelings if this PR isn't accepted. I'm open to whatever. I was just trying to figure out a way to reuse more of the excellent coreutils code. Thanks for such a great repo!!!