Fix backtick evaluation in add-script and run-script inline scripts#263
Merged
Fix backtick evaluation in add-script and run-script inline scripts#263
Conversation
Agent-Logs-Url: https://github.com/devcontainer-community/devcontainer-features/sessions/d2225e5d-fb26-4975-97f2-47b2a7d49117 Co-authored-by: sebst <592313+sebst@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix backtick handling in add-script and run-script
Fix backtick evaluation in add-script and run-script inline scripts
Mar 31, 2026
Agent-Logs-Url: https://github.com/devcontainer-community/devcontainer-features/sessions/c2ae8d45-408c-4b82-ad03-40b5db72a1d9 Co-authored-by: sebst <592313+sebst@users.noreply.github.com>
Contributor
Author
Fixed in c2ea83f. The |
sebst
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The devcontainer CLI generates
devcontainer-features.envwith option values in double quotes (SCRIPT="echo \date`"). When the wrapper sources this file via. ./devcontainer-features.env, bash command-substitutes backticks beforeinstall.sh` ever runs — so the script content is already corrupted.Fix
Re-read
SCRIPTverbatim fromdevcontainer-features.envusingawkat the top ofinstall()in both features, bypassing shell evaluation entirely:Without this fix:
SCRIPT="echo \hostname`"→SCRIPT=echo myhostWith this fix:SCRIPTretains the literal `` echohostname` ``Tests
add-script: newtest-backtickscenario writes a script containing`hostname`and asserts the file contains the literal backtick syntaxrun-script: newtest-backtickscenario runsecho backtick_test=`hostname`and asserts the substitution actually executed (non-empty value written to output file)Versions
Both features bumped
1.0.0→1.1.0.