containerbuildsystem/dockerfile-parse

Not catching 'closing quotation' error

Closed this issue · 4 comments

$ cat Dockerfile
FROM ubuntu

LABEL label1='A' \
      label2='B'@C' \
      label3='D'

RUN apt-get update -qq
$ pip install dockerfile-parse==0.0.10
$ python -c "from dockerfile_parse import DockerfileParser; dfp = DockerfileParser(); print(dfp.labels)"

result:

{u'label1': u'A', u'label2': u'B@C       label3=D'}

expected:

ValueError: No closing quotation

We are bug-compatible with Docker here.

$ cat Dockerfile 
FROM scratch
LABEL label1='A' \
      label2='B'@C' \
      label3='D'
$ docker build -t test .
Sending build context to Docker daemon 2.048 kB
Step 1/2 : FROM scratch
 ---> 
Step 2/2 : LABEL label1 'A' label2 'B'@C'       label3='D'
 ---> Running in adae24e59d8f
 ---> f3c04a414023
Removing intermediate container adae24e59d8f
Successfully built f3c04a414023

I tried to use the same Dockerfile as you and got this message unexpected end of statement while looking for matching single-quote. Maybe you are using docker in a different version.

$ cat Dockerfile
FROM scratch

LABEL label1='A' \
      label2='B'@C' \
      label3='D'

$ docker --version
Docker version 18.03.1-ce, build 9ee9f40

$ docker build -t test .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM scratch
 ---> 
Step 2/2 : LABEL label1='A'       label2='B'@C'       label3='D'
failed to process "'B'@C'       label3='D'": unexpected end of statement while looking for matching single-quote

Yes, indeed, it seems to be a change in behaviour.

$ docker --version
Docker version 1.13.1, build 1ab62f1-unsupported

Closing due to lack of interest and activity. If you're still interested feel free to reopen it.