From f4cefbcfde9bd475c5412d0ebfc2f447f81fdfd6 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Mon, 6 Feb 2023 13:05:57 -0800 Subject: [PATCH] Install Python3 explicitly (#9507) The issue in #8915 is that the environment no longer has a leftover `python3` binary in `/bin/python3`. This uncovers a bug in the `upb` and `jwt-verify-lib` Dockerfiles where `python2` was installed (or no Python was installed). The issue seems to show up on Bazel projects only due to the way Bazel executes commands: it uses `env -` to run them in a clear environment, meaning that even `$PATH` is altered. Before bc02fd0 the issues in the Dockerfiles were hidden by the fact that the environment contained multiple versions of Python and one happened to be matched by this search path. This fixes #8915, reverting #8914 and #8909 tweaks to #8915. I did not do a similar thing for #8930 as maybe that can be fixed by changing the base python image? Tested: Tested that I can build the `upb` fuzzers with this change. Signed-off-by: Mihai Maruseac Signed-off-by: Mihai Maruseac --- projects/jwt-verify-lib/Dockerfile | 6 +++--- projects/upb/Dockerfile | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/jwt-verify-lib/Dockerfile b/projects/jwt-verify-lib/Dockerfile index 5f6f2362a..77d25e00e 100644 --- a/projects/jwt-verify-lib/Dockerfile +++ b/projects/jwt-verify-lib/Dockerfile @@ -14,9 +14,9 @@ # ################################################################################ -# TODO: workaround https://github.com/google/oss-fuzz/issues/8915 -FROM gcr.io/oss-fuzz-base/base-builder@sha256:a723398a016b23d0e2b29f5c0203a6734900e404d09fdd44a555c1514ca513fa +FROM gcr.io/oss-fuzz-base/base-builder -RUN git clone https://github.com/google/jwt_verify_lib.git +RUN apt-get update && apt-get install python3 -y +RUN git clone --depth 1 https://github.com/google/jwt_verify_lib.git WORKDIR $SRC/jwt_verify_lib/ COPY build.sh $SRC/ diff --git a/projects/upb/Dockerfile b/projects/upb/Dockerfile index 7fa94f1b8..15a28e1da 100644 --- a/projects/upb/Dockerfile +++ b/projects/upb/Dockerfile @@ -14,9 +14,9 @@ # ################################################################################ -FROM gcr.io/oss-fuzz-base/base-builder@sha256:a723398a016b23d0e2b29f5c0203a6734900e404d09fdd44a555c1514ca513fa +FROM gcr.io/oss-fuzz-base/base-builder -RUN apt-get update && apt-get install python -y +RUN apt-get update && apt-get install python3 -y RUN git clone --depth 1 https://github.com/protocolbuffers/upb.git upb WORKDIR upb COPY build.sh $SRC/