Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update processing to be more general
The eval implementation assumes certain forms for input which results in complex strings from the token to be parsed into commands. This is unwanted, as programs can generate quite complicated commands in string form, with different shapes (for safety for ex.) like single-, double- quotes, backticks, and other characters that bash, python and json may interpret/parse differently. The implementation in this commit changes the bash part to leave the input string intact, and not split it into pieces. Moreover, the shell part of python is changed into default behaviour of subprocess, along with listing the input, which also helps with parsing complex strings properly. This was tested with string containing escaped characters in nested and nonnested forms, and is more robust.
- Loading branch information
6ab7f4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes seem fine to me. Using "bash -c" instead of "eval" creates a subshell. I don't know if this may have unforeseen consequences, but at least not for the simple examples in the repo.
Can you specify the test case for which the old implementation causes problems and the new one fixes it?
6ab7f4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the test cases in the Jira issue:
6ab7f4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see, the comment section of github is also interpreting special characters, similarly eval and bash may or may not interpret special characters depending on syntax.
In our case we have text coming from json objects into bash that should be preserved properly.