Skip to content
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

api: replace here-string in log_diagnose with process substitution #2658

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

theofficialgman
Copy link
Collaborator

a here-string creates a temporary file on disk which can lead to failure to process all greps in the case of disk space exhaustion. a here-string is also subject to max argument length exhaustion on some systems/kernels leading to failure to process all greps.

process substitution occurs in memory and is not subject to the same limitations.

@Botspot
Copy link
Owner

Botspot commented Oct 10, 2024

a here-string creates a temporary file on disk

Are you sure?
20241009_21h20m24s_grim

api Outdated Show resolved Hide resolved
@theofficialgman
Copy link
Collaborator Author

theofficialgman commented Oct 10, 2024

a here-string creates a temporary file on disk

Are you sure?

See top answer https://askubuntu.com/questions/678915/whats-the-difference-between-and-in-bash

a here-string creates a temporary file on disk which can lead to failure to process all greps in the case of disk space exhaustion. a here-string is also subject to max argument length exhaustion on some systems/kernels leading to failure to process all greps.

process substitution occurs in memory and is not subject to the same limitations.
@theofficialgman
Copy link
Collaborator Author

Also just an FYI regarding ChatGPT and its use for specific technical questions. The use of ChatGPT will not give you consistent good/accurate results. It is a large language model, aka, complicated autocomplete. The question you asked was very leading and didn't provide any background information for it to "attempt" to autocomplete an answer for. It wasn't trained to get the answer correct but instead to answer in a way that sounded "natural". It is unreasonable for you to ask a technical question like that and expect an accurate answer.

Also to provide justification from my statement beyond the askubuntu answer I checked the bash code and quickly found what is responsible for this. The short of it is except in a few specific cases (zero length and short files) a temporary file is made.

https://github.com/bminor/bash/blob/6794b5478f660256a1023712b5fc169196ed0a22/redir.c#L433-L578

@Botspot
Copy link
Owner

Botspot commented Oct 11, 2024

Merge at will.

@theofficialgman theofficialgman marked this pull request as ready for review October 12, 2024 22:57
@theofficialgman theofficialgman merged commit e211b78 into master Oct 12, 2024
3 checks passed
@theofficialgman theofficialgman deleted the diagnosis-rework branch October 12, 2024 22:57
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.

2 participants