Fix discrepancies in parser scripts, bad newlines in cmdrc #525
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.
There were discrepancies between the jq and python versions of the injected parser script for the container info. In particular, the jq version was behaving badly and injecting newlines into the parsed result. Further, the generated cmdrc was splitting some messages with newlines, causing erroneous commands.
I posted an old/new comparison with output here (note the issue with test 3 especially):
https://github.com/echuber2/x11docker-parser-test
Fixes #485
Fixes #493
Fixes #504
(I hope others can test and confirm the fixed issues. There may have been additional issues related to this. Test at your own risk. I can't guarantee this won't remove files unexpectedly based on the parsed results.)
The issues with parsing here make me nervous for safety of using the scripts, especially in relation to the cleanup command that removes files and directories. I hope I haven't made things any worse with these changes.
Since the container runtimes have a built-in parser (using
--format
, see the Docker docs for example), maybe it would be better to remove these parsers entirely and just let the runtime fetch what you need. Or, make one of either jq or python a hard requirement, to at least ensure consistency or simplify testing. I suppose that jq is smaller than python to keep as a system requirement, but the python version might be easier to debug and maintain.