Skip to content

Commit c4d5fb9

Browse files
committed
cstrans-df-run: ignore space after trailing backslash
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. Fixes: https://issues.redhat.com/browse/OSH-391
1 parent e7b064b commit c4d5fb9

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/cstrans-df-run.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DockerFileTransformer {
5959
const RE reLineRunExec_ = RE("^RUN *\\[(.*)\\] *$");
6060

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

6464
/// match in-line comments
6565
const RE reComment_ = RE("^\\s*#.*$");

tests/cstrans-df-run/0010-stdout.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-
2727

2828
# Rootless/unprivileged buildah configurations
2929
# https://github.com/containers/buildah/blob/main/docs/tutorials/05-openshift-rootless-build.md
30-
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 && \\ "]
31-
sed -i 's/short-name-mode="enforcing"/short-name-mode="permissive"/g' /etc/containers/registries.conf && \
32-
mkdir /certs /home/podman/.config/cni && chown podman:podman /certs /home/podman/.config/cni
30+
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"]
3331

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

0 commit comments

Comments
 (0)