]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
wafsamba: Set env variables before calling command
authorNoel Power <noel.power@suse.com>
Fri, 2 May 2025 09:56:15 +0000 (10:56 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 16 May 2025 09:33:41 +0000 (09:33 +0000)
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 <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/fuzzing/README.md
lib/fuzzing/oss-fuzz/do_build.sh

index d3e34bd79a36cf01efb4b29629e48ca35d0859e6..ba8a89bf9d522b2b4ee60791b55c10b4bb22953c 100644 (file)
@@ -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
index 29a6ceb38a1b4aff3e4ef94efed6affbd31b7c87..3da49843d6ea23f806651e4aa9d4eb4de8cf367a 100755 (executable)
@@ -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