Skip to content

Conversation

Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Dec 12, 2024

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.

Note: I used the NULL separator to separate arguments in the output as there is a (very small) chance an argument to the compiler contains newlines.

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
@boegel boegel modified the milestones: release after 4.9.4, release after 5.0.0 Mar 17, 2025
@boegel
Copy link
Member

boegel commented Sep 3, 2025

@Flamefire Failing tests should be looked into, and meanwhile merge conflicts have emerged as well

@Flamefire
Copy link
Contributor Author

Flamefire commented Sep 4, 2025

Resolved the merge conflicts. Test failures were mostly due to --trace output of run_shell_cmd.

I also switched the separator to NULL similar to find -print0 to make it (even more) robust

Added in Python 3 and implies `-E -s`.
So use that fulfilling the TODO.
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