Skip to content

Commit e1a3663

Browse files
committed
Move various sed operations from build.sh to Dockerfile.
To make build.sh more idempotent.
1 parent 24ddd2f commit e1a3663

File tree

16 files changed

+45
-63
lines changed

16 files changed

+45
-63
lines changed

projects/astc-encoder/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ RUN apt-get update && apt-get install -y make autoconf automake libtool
1919
RUN git clone --depth 1 https://github.com/ARM-software/astc-encoder
2020
WORKDIR astc-encoder/Source
2121
COPY build.sh $SRC/
22+
RUN sed -i 's/c++14/c++17/g' $SRC/astc-encoder/Source/Fuzzers/build.sh

projects/astc-encoder/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616
################################################################################
1717

1818
# build project and project-hosted fuzzers
19-
sed -i 's/c++14/c++17/g' $SRC/astc-encoder/Source/Fuzzers/build.sh
2019
$SRC/astc-encoder/Source/Fuzzers/build.sh

projects/clickhouse/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,10 @@ RUN apt-get update -y \
4242

4343
RUN git clone -j 8 --recursive https://github.com/ClickHouse/ClickHouse $SRC/ClickHouse
4444
WORKDIR $SRC/ClickHouse
45+
# It will be hard to maintain any compilation fails (if any) in two repositories.
46+
# Also ClickHouse won't compile without this.
47+
# It is very strange, because we have as many warnings as you could imagine.
48+
RUN sed -i -e '/warnings.cmake)/d' $SRC/ClickHouse/CMakeLists.txt && \
49+
sed -i -e 's/add_warning(/no_warning(/g' $SRC/ClickHouse/CMakeLists.txt
4550

4651
COPY build.sh $SRC/

projects/clickhouse/build.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ mkdir -p $SRC/ClickHouse/build && cd $SRC/ClickHouse/build
2121
[ -e CMakeLists ] && rm -rf CMakeFiles
2222
[ -e CMakeCache.txt ] && rm -rf CMakeCache.txt
2323

24-
sed -i -e '/warnings.cmake)/d' $SRC/ClickHouse/CMakeLists.txt
25-
26-
# It will be hard to maintain any compilation fails (if any) in two repositories.
27-
# Also ClickHouse won't compile without this.
28-
# It is very strange, because we have as many warnings as you could imagine.
29-
sed -i -e 's/add_warning(/no_warning(/g' $SRC/ClickHouse/CMakeLists.txt
30-
3124
# ClickHouse uses libcxx from contrib.
3225
# Enabling libstdc++ manually will cause duplicate symbols at linker stage.
3326
# Plus we want to fuzz the same binary as we have in our CI

projects/libgd/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ RUN git clone --depth 1 https://github.com/libgd/libgd
2121
ADD https://lcamtuf.coredump.cx/afl/demo/afl_testcases.tgz $SRC/afl_testcases.tgz
2222
WORKDIR libgd
2323
COPY run_tests.sh build.sh *.cc $SRC/
24+
RUN sed -i 's/-Werror//g' configure.ac && \
25+
# Limit the size of buffer allocations to avoid bogus OOM issues
26+
# https://github.com/libgd/libgd/issues/422
27+
sed -i 's/INT_MAX/100000/' src/gd_security.c

projects/libgd/build.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@
1515
#
1616
################################################################################
1717

18-
sed -i 's/-Werror//g' ./configure.ac
1918
./bootstrap.sh
2019

21-
# Limit the size of buffer allocations to avoid bogus OOM issues
22-
# https://github.com/libgd/libgd/issues/422
23-
sed -i'' -e 's/INT_MAX/100000/' "$SRC/libgd/src/gd_security.c"
24-
2520
./configure --prefix="$WORK" --disable-shared
2621
make -j$(nproc) install
2722

projects/llamacpp/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,14 @@ FROM gcr.io/oss-fuzz-base/base-builder
1818
RUN apt-get update && apt-get install -y make autoconf automake xxd
1919
RUN git clone https://github.com/ggerganov/llama.cpp
2020
WORKDIR $SRC/llama.cpp
21+
# Avoid function that forks + starts instance of gdb.
22+
# Remove statefulness during fuzzing.
23+
# Patch callocs to avoid allocating large chunks.
24+
# Patch a potentially unbounded loop that causes timeouts
25+
RUN sed -i 's/ggml_print_backtrace();//g' ./ggml/src/ggml.c && \
26+
sed -i 's/static bool is_first_call/bool is_first_call/g' ./ggml/src/ggml.c && \
27+
sed -i 's/ggml_calloc(size_t num, size_t size) {/ggml_calloc(size_t num, size_t size) {\nif ((num * size) > 9000000) {GGML_ABORT("calloc err");}\n/g' ./ggml/src/ggml.c && \
28+
sed -i 's/ok = ok \&\& (info->n_dims <= GGML_MAX_DIMS);/ok = ok \&\& (info->n_dims <= GGML_MAX_DIMS);\nif (!ok) {fclose(file); gguf_free(ctx); return NULL;}/g' ./ggml/src/ggml.c
29+
2130
COPY build.sh $SRC/
2231
COPY fuzzers $SRC/llama.cpp/fuzzers

projects/llamacpp/build.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@
1717

1818
export GGML_NO_OPENMP=1
1919

20-
# Avoid function that forks + starts instance of gdb.
21-
sed -i 's/ggml_print_backtrace();//g' ./ggml/src/ggml.c
22-
23-
# Remove statefulness during fuzzing.
24-
sed -i 's/static bool is_first_call/bool is_first_call/g' ./ggml/src/ggml.c
25-
26-
# Patch callocs to avoid allocating large chunks.
27-
sed -i 's/ggml_calloc(size_t num, size_t size) {/ggml_calloc(size_t num, size_t size) {\nif ((num * size) > 9000000) {GGML_ABORT("calloc err");}\n/g' -i ./ggml/src/ggml.c
28-
29-
# Patch a potentially unbounded loop that causes timeouts
30-
sed -i 's/ok = ok \&\& (info->n_dims <= GGML_MAX_DIMS);/ok = ok \&\& (info->n_dims <= GGML_MAX_DIMS);\nif (!ok) {fclose(file); gguf_free(ctx); return NULL;}/g' ./ggml/src/ggml.c
31-
3220
# Build with CMake
3321
mkdir build
3422
cd build

projects/openbabel/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@
1717
FROM gcr.io/oss-fuzz-base/base-builder
1818
RUN apt-get update && apt install -y cmake
1919
RUN git clone --depth 1 https://github.com/openbabel/openbabel.git
20-
COPY *.sh $SRC/
2120
WORKDIR $SRC/openbabel
21+
# Remove use of deprecated functions
22+
RUN sed -i 's/CMAKE_CXX_STANDARD 11/CMAKE_CXX_STANDARD 17/g' CMakeLists.txt && \
23+
sed -i 's/std::random/\/\/std::random/g' test/*.cpp
24+
25+
COPY *.sh $SRC/

projects/openbabel/build.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
################################################################################
1717

1818
export CXXFLAGS="${CXXFLAGS} -std=c++17"
19-
sed -i 's/CMAKE_CXX_STANDARD 11/CMAKE_CXX_STANDARD 17/g' CMakeLists.txt
20-
21-
# Remove use of deprecated functions
22-
sed -i 's/std::random/\/\/std::random/g' test/*.cpp
2319

2420
# build project
2521
mkdir build && cd build

0 commit comments

Comments
 (0)