From: Noel Power Date: Fri, 2 May 2025 09:56:15 +0000 (+0100) Subject: wafsamba: Set env variables before calling command X-Git-Tag: tevent-0.17.0~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8428b564885e158bc155f7f9ad98091cf440d0d;p=thirdparty%2Fsamba.git wafsamba: Set env variables before calling command Old optparse handling in third_party/waf/waflib/Options.py would process leftover arguments and distinguish between env var overrides and commands. In waf 2.1.5 Options.py no longer will do this and we can see this with config command like (from fuzz job) ./configure.developer -C --without-gettext --enable-debug --enable-developer --enable-libfuzzer --address-sanitizer --disable-warnings-as-errors --abi-check-disable --fuzz-target-ldflags=-Wl,--disable-new-dtags --nonshared-binary=ALL --enable-afl-fuzzer --with-prometheus-exporter LINK_CC= failing like below 'configure' finished successfully (1m11.100s) ==> /builds/samba-team/devel/samba/samba-fuzz.stderr <== No function 'LINK_CC=' defined in /builds/samba-testbase/samba-fuzz/wscript 2025-05-02 08:58:21,615 samba-fuzz: [fuzzers-build] failed 'OUT=/builds/samba-testbase/prefix/samba-fuzz LIB_FUZZING_ENGINE= SANITIZER=address CXX= CFLAGS= ADDITIONAL_LDFLAGS='-fuse-ld=bfd' ./lib/fuzzing/oss-fuzz/build_samba.sh --enable-afl-fuzzer --with-prometheus-exporter' with status 1 Now we should just use the needed env directly e.g. for example above you should call configure as below LINK_CC= ./configure.developer -C --without-gettext --enable-debug --enable-developer --enable-libfuzzer --address-sanitizer --disable-warnings-as-errors --abi-check-disable --fuzz-target-ldflags=-Wl,--disable-new-dtags --nonshared-binary=ALL --enable-afl-fuzzer --with-prometheus-exporter This patch adjusts some documentation and a build script to reflect this change. Signed-off-by: Noel Power Reviewed-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- diff --git a/lib/fuzzing/README.md b/lib/fuzzing/README.md index d3e34bd79a3..ba8a89bf9d5 100644 --- a/lib/fuzzing/README.md +++ b/lib/fuzzing/README.md @@ -17,10 +17,10 @@ Example command line to build binaries for use with [honggfuzz](https://github.com/google/honggfuzz/): ```sh +CC=.../honggfuzz/hfuzz_cc/hfuzz-clang \ +LINK_CC=.../honggfuzz/hfuzz_cc/hfuzz-clang \ ./configure -C --without-gettext --enable-debug --enable-developer \ - --address-sanitizer --enable-libfuzzer --abi-check-disable \ - CC=.../honggfuzz/hfuzz_cc/hfuzz-clang \ - LINK_CC=.../honggfuzz/hfuzz_cc/hfuzz-clang + --address-sanitizer --enable-libfuzzer --abi-check-disable ``` @@ -43,9 +43,8 @@ Example command line to build binaries for use with [afl](http://lcamtuf.coredump.cx/afl/) ```sh -./configure -C --without-gettext --enable-debug --enable-developer \ - --enable-afl-fuzzer --abi-check-disable \ - CC=afl-gcc +CC=afl-gcc ./configure -C --without-gettext --enable-debug --enable-developer \ + --enable-afl-fuzzer --abi-check-disable ``` ## Fuzzing tiniparser diff --git a/lib/fuzzing/oss-fuzz/do_build.sh b/lib/fuzzing/oss-fuzz/do_build.sh index 29a6ceb38a1..3da49843d6e 100755 --- a/lib/fuzzing/oss-fuzz/do_build.sh +++ b/lib/fuzzing/oss-fuzz/do_build.sh @@ -80,15 +80,14 @@ esac # --disable-new-dtags linker flag creates fuzzer binaries with RPATH # header instead of RUNPATH header. Modern linkers use RUNPATH by # default. -./configure -C --without-gettext --enable-debug --enable-developer \ +LINK_CC="$CXX" ./configure -C --without-gettext --enable-debug --enable-developer \ --enable-libfuzzer \ $SANITIZER_ARG \ --disable-warnings-as-errors \ --abi-check-disable \ "--fuzz-target-ldflags=-Wl,--disable-new-dtags $LIB_FUZZING_ENGINE" \ --nonshared-binary=ALL \ - "$@" \ - LINK_CC="$CXX" + "$@" make -j