Skip to content

Commit

Permalink
cstrans-df-run: ignore space after trailing backslash
Browse files Browse the repository at this point in the history
Although it does not make any sense, `podman build` seems to do it as
well while parsing `Dockerfile`.  We need to emulate this behavior to
stay compatible.

Resolves: https://issues.redhat.com/browse/OSH-391
Closes: #148
  • Loading branch information
kdudka committed Nov 3, 2023
1 parent 32c06d3 commit d059bc7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cstrans-df-run.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DockerFileTransformer {
const RE reLineRunExec_ = RE("^RUN *\\[(.*)\\] *$");

/// match ... in ... BS-NL
const RE reLineCont_ = RE("(^.*[^\\\\])\\\\$");
const RE reLineCont_ = RE("(^.*[^\\\\])\\\\ *$");

/// match in-line comments
const RE reComment_ = RE("^\\s*#.*$");
Expand Down
4 changes: 1 addition & 3 deletions tests/cstrans-df-run/0010-stdout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-

# Rootless/unprivileged buildah configurations
# https://github.com/containers/buildah/blob/main/docs/tutorials/05-openshift-rootless-build.md
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-c", "touch /etc/subgid /etc/subuid && chmod g=u /etc/subgid /etc/subuid /etc/passwd && echo 'podman:100000:65536' > /etc/subuid && echo 'podman:100000:65536' > /etc/subgid && \tmkdir -p /home/podman/.config/containers && (echo '[storage]';echo 'driver = \"vfs\"') > /home/podman/.config/containers/storage.conf && \\ "]
sed -i 's/short-name-mode="enforcing"/short-name-mode="permissive"/g' /etc/containers/registries.conf && \
mkdir /certs /home/podman/.config/cni && chown podman:podman /certs /home/podman/.config/cni
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-c", "touch /etc/subgid /etc/subuid && chmod g=u /etc/subgid /etc/subuid /etc/passwd && echo 'podman:100000:65536' > /etc/subuid && echo 'podman:100000:65536' > /etc/subgid && \tmkdir -p /home/podman/.config/containers && (echo '[storage]';echo 'driver = \"vfs\"') > /home/podman/.config/containers/storage.conf && sed -i 's/short-name-mode=\"enforcing\"/short-name-mode=\"permissive\"/g' /etc/containers/registries.conf && \tmkdir /certs /home/podman/.config/cni && chown podman:podman /certs /home/podman/.config/cni"]

VOLUME ["/tmp", "/certs"]

Expand Down

0 comments on commit d059bc7

Please sign in to comment.