Skip to content

Improve the E2BIG detection #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zimbatm opened this issue Sep 13, 2021 · 3 comments
Open

Improve the E2BIG detection #127

zimbatm opened this issue Sep 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@zimbatm
Copy link
Member

zimbatm commented Sep 13, 2021

Is your feature request related to a problem? Please describe.

This is a follow-up on #10 . In ab23c9f I limited the number of arguments to 1024, which is a conservative value that should work across all systems.

Describe the solution you'd like

Implement a mechanism that selects something closer to what is supported in the system. On my machine, getconf ARG_MAX returns 2097152 for example. I think that's the number of bytes total that argv can take, including the \0 separators.

Describe alternatives you've considered

Change the treefmt formatter interface to take the list of files to format from stdin instead. It might be good to do that in the future, but formatters don't generally support that method. I would still be up for allowing to select the interface per formatter.

Additional context

User report:

used to run in a few ms on my test tree now it's ~1s

@zimbatm zimbatm added the enhancement New feature or request label Sep 13, 2021
@Mic92
Copy link
Member

Mic92 commented Oct 25, 2021

@zimbatm
Copy link
Member Author

zimbatm commented Oct 25, 2021

Thanks, I went hunting for a rust xargs and found this relevant issue: rust-lang/rust#40384

@zimbatm
Copy link
Member Author

zimbatm commented Oct 25, 2021

Maybe a better heuristic is to invoke the command, and split it into two commands on E2BIG, recurse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants