Skip to content

Fix shell escaping for Slurm env var values#18

Open
Pr030304 wants to merge 1 commit into
outerbounds:mainfrom
Pr030304:fix-shell-escape-env-vars
Open

Fix shell escaping for Slurm env var values#18
Pr030304 wants to merge 1 commit into
outerbounds:mainfrom
Pr030304:fix-shell-escape-env-vars

Conversation

@Pr030304

Copy link
Copy Markdown

Summary

Fix shell escaping for environment variable values in generated Slurm job scripts.

Context

Fixes #17

SlurmJobScript.shell_env_setup interpolates env var values directly into single-quoted shell strings. Values containing a single quote produce invalid shell syntax and can break Slurm job startup.

Changes Made

  • shell-escape env var values when rendering export lines

Before fix, it looked like:

export MY_VAR='O'Reilly'

After fix, it looks like:

export MY_VAR='O'"'"'Reilly'

Testing

  • Manually reproduced the bug by generating a script with {"MY_VAR": "O'Reilly"}
  • Verified the generated script is shell-safe after the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: SlurmJobScript does not shell-escape env var values containing single quotes

1 participant