From 216fcd196b0f157c5dba9536853649463035ac7a Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Fri, 21 Jun 2024 10:38:40 +1200 Subject: [PATCH 1/2] buildtools: sanitise strange characters in vendor strings There is no reason to think '-' and '+' are the only characters that might sneak into a vendor string; Debian habitually use '~'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15673 Signed-off-by: Douglas Bagnall Reviewed-by: Jo Sutton (cherry picked from commit 0bc5b6f29307ce758774c1b2f48ce62315fdc7f9) --- buildtools/wafsamba/samba_abi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py index 2d9505d255c8..c82ba3424f99 100644 --- a/buildtools/wafsamba/samba_abi.py +++ b/buildtools/wafsamba/samba_abi.py @@ -286,7 +286,7 @@ def abi_build_vscript(task): f.close() def VSCRIPT_MAP_PRIVATE(bld, libname, orig_vscript, version, private_vscript): - version = version.replace("-", "_").replace("+","_").upper() + version = re.sub(r'\W', '_', version).upper() t = bld.SAMBA_GENERATOR(private_vscript, rule=abi_build_vscript, source=orig_vscript, @@ -314,8 +314,8 @@ def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None, p libname = os.path.basename(libname) version = os.path.basename(version) - libname = libname.replace("-", "_").replace("+","_").upper() - version = version.replace("-", "_").replace("+","_").upper() + libname = re.sub(r'\W', '_', libname).upper() + version = re.sub(r'\W', '_', version).upper() t = bld.SAMBA_GENERATOR(vscript, rule=abi_build_vscript, -- 2.34.1 From d458e47dc5447d98163b025f1c322766779a2671 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Fri, 21 Jun 2024 10:40:59 +1200 Subject: [PATCH 2/2] build: --vendor-suffix instead of --vendor-patch-revision --vendor-name In practice there isn't a use for two options, and neither quite matched what people thought they were doing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15673 Signed-off-by: Douglas Bagnall Reviewed-by: Jo Sutton (cherry picked from commit 673c8e6ca5994973e4887641c3599707a66a608c) --- script/autobuild.py | 4 ++-- wscript | 12 +----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/script/autobuild.py b/script/autobuild.py index 7291522c26d3..0388342bc239 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -892,10 +892,10 @@ tasks = { ("ldb-make", "cd lib/ldb && make"), ("ldb-install", "cd lib/ldb && make install"), - ("nondevel-configure", samba_libs_envvars + " ./configure --vendor-name=autobuild-TEST-STRING --vendor-patch-revision=5 ${PREFIX}"), + ("nondevel-configure", samba_libs_envvars + " ./configure --vendor-suffix=TEST-STRING~5.1.2 ${PREFIX}"), ("nondevel-make", "make -j"), ("nondevel-check", "./bin/smbd -b | grep WITH_NTVFS_FILESERVER && exit 1; exit 0"), - ("nondevel-check", "./bin/smbd --version | grep -e '-autobuild-TEST-STRING-5' && exit 0; exit 1"), + ("nondevel-check", "./bin/smbd --version | grep -F 'TEST-STRING~5.1.2' && exit 0; exit 1"), ("nondevel-no-libtalloc", "find ./bin | grep -v 'libtalloc-report' | grep 'libtalloc' && exit 1; exit 0"), ("nondevel-no-libtdb", "find ./bin | grep -v 'libtdb-wrap' | grep 'libtdb' && exit 1; exit 0"), ("nondevel-no-libtevent", "find ./bin | grep -v 'libtevent-util' | grep 'libtevent' && exit 1; exit 0"), diff --git a/wscript b/wscript index 167a3a7e79da..b9e7786ed184 100644 --- a/wscript +++ b/wscript @@ -140,27 +140,17 @@ def options(opt): dest='with_smb1server', help=("Build smbd with SMB1 support (default=yes).")) - opt.add_option('--vendor-name', + opt.add_option('--vendor-suffix', help=('Specify a vendor (or packager) name to include in the version string'), type="string", dest='SAMBA_VERSION_VENDOR_SUFFIX', default=None) - opt.add_option('--vendor-patch-revision', - help=('Specify a vendor (or packager) patch revision number include in the version string (requires --vendor-name)'), - type="int", - dest='SAMBA_VERSION_VENDOR_PATCH', - default=None) def configure(conf): if Options.options.SAMBA_VERSION_VENDOR_SUFFIX: conf.env.SAMBA_VERSION_VENDOR_SUFFIX = Options.options.SAMBA_VERSION_VENDOR_SUFFIX - if Options.options.SAMBA_VERSION_VENDOR_PATCH: - if not Options.options.SAMBA_VERSION_VENDOR_SUFFIX: - raise conf.fatal('--vendor-patch-revision requires --vendor-version') - conf.env.SAMBA_VERSION_VENDOR_PATCH = Options.options.SAMBA_VERSION_VENDOR_PATCH - version = samba_version.load_version(env=conf.env) conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1) -- 2.34.1