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

Fix discrepancies in parser scripts, bad newlines in cmdrc #525

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

echuber2
Copy link
Contributor

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.

@echuber2
Copy link
Contributor Author

Note that in the old version, Pythonbin was being set to jq by preference, which is kind of confusing. The new Jqbin variable tries to make that explicit.

@mviereck mviereck merged commit b9e0e76 into mviereck:master Apr 4, 2024
@mviereck
Copy link
Owner

mviereck commented Apr 4, 2024

Thank you very much!

I admit that I did not do a deep check of your code, just have read it and it looked well.

mviereck pushed a commit that referenced this pull request Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants