You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a diff of two large strings, a system that is low on disk space can fail with ENOSPC when attempting to write the strings to tempfiles.
Use Case
I would like to diff strings in memory, especially if the system has trimmed down the free disk substantially. For example, we use a large Sidekiq deployment, and having overprovisioned disk for 1000s of workers (only a few of which need to run disks) ends up costing a non-trivial amount. We could create a "high disk queue", but that seems more complex than adding a generally useful diffing option here.
Implementation Ideas
Bash process substitution can be used to avoid writing the tempfiles when calling diffbin:
Hi @davidbodow-st - I'd be happy to look at a PR for the feature you're describing. You'll have to be careful that it's implemented in a way which is secure and not susceptible to shell code injection (i.e. some way data in the diffed files can be interpreted as shell commands). Let me know when you have something ready to review and we could look at getting it included in the gem.
Overview
When calling a diff of two large strings, a system that is low on disk space can fail with
ENOSPC
when attempting to write the strings to tempfiles.Use Case
I would like to diff strings in memory, especially if the system has trimmed down the free disk substantially. For example, we use a large Sidekiq deployment, and having overprovisioned disk for 1000s of workers (only a few of which need to run disks) ends up costing a non-trivial amount. We could create a "high disk queue", but that seems more complex than adding a generally useful diffing option here.
Implementation Ideas
Bash process substitution can be used to avoid writing the tempfiles when calling
diffbin
:We could handle passing the process substitution args instead of the usual args by implementing a new source in
#diff
: https://github.com/samg/diffy/blob/main/lib/diffy/diff.rb#L43Other
I'd be happy to open a PR for this if there is interest in the feature, but no bandwidth otherwise.
The text was updated successfully, but these errors were encountered: