Skip to content

Conversation

@Flamefire
Copy link
Contributor

Avoid that variables are resolved when the echo is run. shlex.quote outputs a properly escaped string so nothing will be interpreted by the shell. It uses single quotes for that. Putting that inside double quotes means single quotes are used literally and and any variable will be resolved during the echo as shlex.quote put them in single quotes to avoid that.

So end the double-quotes and append the shlex-quoted string. To make it look neither add single quotes around it.

Example before:

# Shell for the command: 'export PYTHONPATH=/tmp/easybuild-tmp/eb-u1gfjbyj/tmpzw6qefg8/lib/python3.10/site-packages: &&  cd test && PYTHONUNBUFFERED=1 /software/Python/3.10.8-GCCcore-12.2.0/bin/python run_test.py --continue-through-error  --verbose -x distributed/test_distributed_spawn distributions/test_constraints doctests test_native_mha distributed/rpc/test_tensorpipe_agent'
# Use command history, exit to stop

after:

# Shell for the command: 'export PYTHONPATH=/tmp/easybuild-tmp/eb-u1gfjbyj/tmpzw6qefg8/lib/python3.10/site-packages:$PYTHONPATH &&  cd test && PYTHONUNBUFFERED=1 /software/Python/3.10.8-GCCcore-12.2.0/bin/python run_test.py --continue-through-error  --verbose -x distributed/test_distributed_spawn distributions/test_constraints doctests test_native_mha distributed/rpc/test_tensorpipe_agent'
# Use command history, exit to stop

Avoid that variables are resolved when the `echo` is run.
`shlex.quote` outputs a properly escaped string so nothing will be
interpreted by the shell. It uses single quotes for that.
Putting that inside double quotes means single quotes are used literally
and and any variable will be resolved during the echo as shlex.quote
put them in single quotes to avoid that.

So end the double-quotes and append the shlex-quoted string.
To make it look neither add single quotes around it.
@boegel boegel added bug fix EasyBuild-5.0 EasyBuild 5.0 labels Mar 16, 2025
@boegel boegel added this to the 5.0 milestone Mar 16, 2025
@boegel boegel merged commit 6a275ed into easybuilders:5.0.x Mar 16, 2025
37 checks passed
@Flamefire Flamefire deleted the cmdshell branch March 17, 2025 08:16
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