microsoft / microsoft/vscode-containers
Erroneous "failed to process string" error and syntax highlighting for Dockerfile parameter substitution modifier `-`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 139
- Forks
- 87
- Avg merge
- 9h 15m
- Merged PRs (30d)
- 9
Description
I'm getting an erroneous error message for the following string:
"failed to process "${HTTP_PROXY-http://corporate-proxy.com:8080}": unsupported modifier (/) in substitution dockerfile-utils(44)
This string replacement is in fact not an error, - is recognized as a valid environment replacement modifier and / is interpreted as the literal character, not a substitution modifier, when performing the substitution (see: https://github.com/docker/docs/issues/23165).
It appears that this is also breaking syntax highlighting.
Tested and confirmed locally:
# Dockerfile
ARG HTTP_PROXY
ENV http_proxy=${HTTP_PROXY-http://corporate-proxy.com:8080}
RUN echo $http_proxy
# No build arg
$ docker build -f Dockerfile .
> http://corporate-proxy.com:8080
# Build arg null
$ docker build --build-arg HTTP_PROXY="" -f Dockerfile .
>
# Build arg value
$ docker build --build-arg HTTP_PROXY="override" -f Dockerfile .
> override
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported Dockerfile example with the three HTTP_PROXY cases and inspect the Dockerfile processing and syntax-highlighting entry points that report dockerfile-utils(44). Confirm that the '-' modifier accepts the URL containing '/', then verify that the diagnostic disappears and the substitution is highlighted correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dockerfile
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100