uber-archive / makisu

Fast and flexible Docker image building tool, works in unprivileged containerized environments like Mesos and Kubernetes.
Apache License 2.0
2.41k stars 156 forks source link

Dockerfile parsing error when # appears in quotes - redis:5.0 Dockerfile fails to build with makisu #287

Open rgeary1 opened 4 years ago

rgeary1 commented 4 years ago

Describe the bug Building the redis:5.0 image succeeds with docker build, fails with makisu. Looks like a Dockerfile parsing error

Error message :

a-certificates          wget                            gcc             libc6-dev               make    ;       rm -rf /var/lib/apt/lists/*;            wget -O redis.tar.gz "http://download.redis.
io/releases/redis-5.0.6.tar.gz";        echo "6624841267e142c5d5d5be292d705f8fb6070677687c5aad1645421a936d22b3 *redis.tar.gz" | sha256sum -c -;         mkdir -p /usr/src/redis;        tar -xzf red
is.tar.gz -C /usr/src/redis --strip-components=1;       rm redis.tar.gz;                grep -q '^  (c8fc8ee1)                                                                                      
1.572061455198217e+09   error   Command exited with 2                                                                                                                                               

1.572061455198289e+09   error   sh: 1: Syntax error: Unterminated quoted string                                                                                                                     

1.572061455281933e+09   error   failed to execute build plan: execute stage: build stage 0: build node: do execute: execute step: cmd wait: exit status 2                                           

To Reproduce

git clone https://github.com/docker-library/redis.git
cd redis/5.0
makisu build -t redis:5.0 .

where the last line evaluates to :

docker run -i --rm --net host -v /var/run/docker.sock:/docker.sock -e DOCKER_HOST=unix:///docker.sock -v $HOME/redis/5.0:/makisu-context -v /tmp/makisu-storage:/makisu-storage makis
u:v0.1.11 build --log-fmt=console -t redis:5.0 --commit=explicit --modifyfs=true --load /makisu-context

Expected behavior makisu build should succeed where docker build succeeds

rgeary1 commented 4 years ago

Appears to be caused by this line in the RUN statement, which contains a # character grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 1$' /usr/src/redis/src/server.h;

Simple repro : FROM alpine RUN echo hi; \ echo hello | grep -v '^#world'; \ echo end

I guess that the comment parser is not aware of quotation marks