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 handling of quotes in rpath wrapper #4722

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

In some software the compiler must be invoked with an argument containing a literal single quote which requires escaping in the call. E.g.: gcc -DFOO=\'value\'

However the current rpath wrapper would remove those single quotes causing errors during compilation or erronous behavior of the compiled binary.

Fix by replacing the eval of the rpath_args.py output by readarray -t. An array asignment could be used (CMD_ARGS=( $(rpath_args.py ...) )) but that would break up arguments containing spaces. Quotes from the output are kept literally, so quoting to avoid this is not possible. readarray -t works and is widely available.

Also some minor fixes related to quoting in the bash script template.

In some software the compiler must be invoked with an argument
containing a literal single quote which requires escaping in the call.
E.g.: `gcc -DFOO=\'value\'`

However the current rpath wrapper would remove those single quotes
causing errors during compilation or erronous behavior of the compiled binary.

Fix by replacing the `eval` of the `rpath_args.py` output by `readarray -t`.
An array asignment could be used (`CMD_ARGS=( $(rpath_args.py ...) )`)
but that would break up arguments containing spaces.
Quotes from the output are kept literally, so quoting to avoid this is not possible.
`readarray -t` works and is widely available.

Also some minor fixes related to quoting in the bash script template.
Tests expected output of the rpath Python script to be space separated
but now it is line separated.
Also the output does not include the name of the array anymore.

To aid with debugging a helper method is introduced and the output is
compared as a list with one line each.
@boegel boegel added the bug fix label Dec 18, 2024
@boegel boegel added this to the release after 4.9.4 milestone Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants