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 <mihaimaruseac@google.com>

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
This commit is contained in:
Mihai Maruseac 2023-02-06 13:05:57 -08:00 committed by GitHub
parent 7d75ea2605
commit f4cefbcfde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -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/

View File

@ -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/