1
0
Fork 0

generate: container: Fix printf call in Environment.create

When creating the env-vars printf is called with arguments in single
quotes to prevent variable and sub-shell expansions. However, only one
single quote was passed as an argument to printf, but two format
specifiers are present in the escpaed string.

Fix this by adding another \"'\" to the variable cmd.

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-07-26 21:34:36 +02:00
parent 5237a70f3e
commit 76bdf6dab6
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -179,7 +179,7 @@ class Environment:
cmd = f"# Create env-file {self.file}\n"
for var in self.variables:
escaped_var = var.replace("'", "%b")
cmd += f"printf '{escaped_var}\\n' \"'\" >> '{self.file}'\n"
cmd += f"printf '{escaped_var}\\n' \"'\" \"'\">> '{self.file}'\n"
return cmd