On 11/9/26 2:24 AM, Ales Musil wrote:
> 
> 
> On Fri, Nov 6, 2026 at 11:12 PM Rosemarie O'Riorden
> <[email protected] <mailto:[email protected]>> wrote:
> 
>     It's helpful to know if a binary is compiled with or without sanitizers.
>     So append "-asan" and/or "-ubsan" to the version string when OVN was
>     configured with either sanitizer.
> 
>     Example compiled with both sanitizers:
> 
>     $ ovn-controller --version
>     ovn-controller 26.09.90-asan-ubsan
> 
>     $ ovn-northd --version
>     ovn-northd 26.09.90-asan-ubsan
> 
>     Also reformat the version suffix comment in acinclude.m4 to be in line
>     with the other functions.
> 
>     Signed-off-by: Rosemarie O'Riorden <[email protected]
>     <mailto:[email protected]>>
>     ---
>     v2:
>     Introduced in v2.
>     ---
> 
> 
> Hi Rosemarie,
> 
> thank you for the patch. I have a few comments below.
>  
> 
>      Makefile.am              |  1 +
>      acinclude.m4             | 40 ++++++++++++++++++++++++++++++++++++++++
>      configure.ac <http://configure.ac>             |  2 ++
>      include/ovn/version.h.in <http://version.h.in> |  2 +-
>      utilities/ovn-lib.in <http://ovn-lib.in>     |  2 +-
>      5 files changed, 45 insertions(+), 2 deletions(-)
> 
>     diff --git a/Makefile.am b/Makefile.am
>     index 8a9bf1e91..47b5bbca3 100644
>     --- a/Makefile.am
>     +++ b/Makefile.am
>     @@ -170,6 +170,7 @@ SUFFIXES += .in
>                 -e 's,[@]OVSBUILDDIR[@],$(OVSBUILDDIR),g' \
>                 -e 's,[@]VERSION[@],$(VERSION),g' \
>                 -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
>     +           -e 's,[@]ASAN_UBSAN[@],$(ASAN_UBSAN),g' \
>                 -e 's,[@]OVSVERSION[@],$(OVSVERSION),g' \
>                 -e 's,[@]localstatedir[@],$(localstatedir),g' \
>                 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
>     diff --git a/acinclude.m4 b/acinclude.m4
>     index 82070dc52..41933469a 100644
>     --- a/acinclude.m4
>     +++ b/acinclude.m4
>     @@ -389,6 +389,8 @@ AC_DEFUN([OVN_ENABLE_VIF_PLUG], [
>          fi
>      ])
> 
>     +dnl OVN_CHECK_VERSION_SUFFIX
>     +dnl
>      dnl Append a version suffix.
>      AC_DEFUN([OVN_CHECK_VERSION_SUFFIX], [
>        AC_ARG_WITH([version-suffix],
>     @@ -399,3 +401,41 @@ AC_DEFUN([OVN_CHECK_VERSION_SUFFIX], [
>                           [Package version suffix])
>        AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
>      ])
>     +
>     +dnl OVN_CHECK_ASAN_UBSAN
>     +dnl
>     +dnl Check if OVN is configured with the address sanitizer or
>     +dnl undefined behavior sanitizer so that $ASAN_UBSAN can be appended
>     +dnl to the version string.
>     +AC_DEFUN([OVN_CHECK_ASAN_UBSAN], [
>     +    ovn_has_asan=no
>     +    AC_COMPILE_IFELSE(
>     +        [AC_LANG_SOURCE([[
>     +            #ifndef __has_feature
>     +            # define __has_feature(x) 0
>     +            #endif
>     +            #if !__has_feature(address_sanitizer) && !
>     defined(__SANITIZE_ADDRESS__)
>     +            # error "AddressSanitizer is not enabled (expected)"
>     +            #endif
>     +        ]])],
>     +        [ovn_has_asan=yes])
>     +    ovn_has_ubsan=no
>     +    AC_COMPILE_IFELSE(
>     +        [AC_LANG_SOURCE([[
>     +            #ifndef __has_feature
>     +            # define __has_feature(x) 0
>     +            #endif
>     +            #if !__has_feature(undefined_behavior_sanitizer)
>     +            # error "UndefinedBehaviorSanitizer is not enabled
>     (expected)"
>     +            #endif
>     +        ]])],
>     +        [ovn_has_ubsan=yes])
>     +    ASAN_UBSAN=""
>     +    if test "$ovn_has_asan" = "yes"; then
>     +        ASAN_UBSAN="-asan"
>     +    fi
>     +    if test "$ovn_has_ubsan" = "yes"; then
>     +        ASAN_UBSAN="$ASAN_UBSAN-ubsan"
>     +    fi
>     +    AC_SUBST([ASAN_UBSAN])
>     +])
> 
> 
> Why can't we do this directly in version.h.in <http://version.h.in>?
> Wouldn't
> that be better? If it's done this way just because the
> ovn-lib.in <http://ovn-lib.in> see my comment below.

Thank you for the pointers. I didn't realize it could be done this way.
I just sent a new version and it's much simpler.
> Also a small nit: I would prefer capital letters for both
> acronyms. And spaces between them instead of a dash,
> it's not part of the version itself.
>  
> 
>     diff --git a/configure.ac <http://configure.ac> b/configure.ac
>     <http://configure.ac>
>     index 06c3cf5d4..17b55c8f7 100644
>     --- a/configure.ac <http://configure.ac>
>     +++ b/configure.ac <http://configure.ac>
>     @@ -23,6 +23,7 @@ AM_INIT_AUTOMAKE([tar-pax])
>      #AC_CONFIG_SUBDIRS([ovs])
> 
>      AC_PROG_CC_C99
>     +
> 
> 
> nit: Unrelated newline.
>  
> 
>      AM_PROG_CC_C_O
>      AC_PROG_CXX
>      AC_PROG_CPP
>     @@ -168,6 +169,7 @@ OVS_ENABLE_WERROR
>      OVS_ENABLE_SPARSE
> 
>      OVS_CHECK_PRAGMA_MESSAGE
>     +OVN_CHECK_ASAN_UBSAN
>      OVN_CHECK_VERSION_SUFFIX
>      OVN_CHECK_OVS
>      OVN_CHECK_VIF_PLUG_PROVIDER
>     diff --git a/include/ovn/version.h.in <http://version.h.in> b/
>     include/ovn/version.h.in <http://version.h.in>
>     index 5f88931b7..cff0d39d3 100644
>     --- a/include/ovn/version.h.in <http://version.h.in>
>     +++ b/include/ovn/version.h.in <http://version.h.in>
>     @@ -19,7 +19,7 @@
>      #define OVN_VERSION_H 1
> 
>      #define OVN_PACKAGE_STRING  "@PACKAGE_STRING@"
>     -#define OVN_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
>     +#define OVN_PACKAGE_VERSION
>     "@PACKAGE_VERSION@@VERSION_SUFFIX@@ASAN_UBSAN@"
> 
>      #define OVN_LIB_VERSION     @LT_CURRENT@
>      #define OVN_LIB_REVISION    @LT_REVISION@
>     diff --git a/utilities/ovn-lib.in <http://ovn-lib.in> b/utilities/
>     ovn-lib.in <http://ovn-lib.in>
>     index 8e8eedeab..cd75f1284 100644
>     --- a/utilities/ovn-lib.in <http://ovn-lib.in>
>     +++ b/utilities/ovn-lib.in <http://ovn-lib.in>
>     @@ -39,7 +39,7 @@ else
>          ovn_dbdir='@DBDIR@'
>      fi
> 
>     -VERSION='@VERSION@@VERSION_SUFFIX@'
>     +VERSION='@VERSION@@VERSION_SUFFIX@@ASAN_UBSAN@'
> 
> 
> I don't think we need it here, this doesn't
> affect the shell part of OVN in any way so
> I would keep it just in the binaries.
>  
> 
> 
>      DAEMON_CWD=/
> 
>     -- 
>     2.56.0
> 
> 
> Regards,
> Ales 

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to