init: Fix error upon deleting file on non-GNU systems #658
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When passing arguments to
xargs
binaries can only be used, we cannot use a shells builtin command, so this issue cannot be subverted just by installing bash. In this instance, my systemsprintf
implementation does not support the%q
format specification—specifically a GNU extension. Yielding this error upon trying to delete a file:For a more visual example;
Remedying this is just a case of not using
xargs
and instead iterating through each line of the output pipe, then calling bash's builtinprintf
(oppose to an actual binary). While bash is still a hard requirement, this makes things less of a headache for new users on non-GNU-like system, in my case FreeBSD (to my understanding neither of the other BSD's support the %q format, seems to be another GNU-ism).Retrospectively looking, I can only find
xargs
mentioned in the documentation;It might be worthwhile combing through the available plugins that may make use of
xargs
and GNU extensions.Many thanks, and thank you for your continued work on xplr.
Closes: #652