diff -Nru talloc-2.3.1/ABI/pytalloc-util-2.3.2.sigs talloc-2.3.3/ABI/pytalloc-util-2.3.2.sigs --- talloc-2.3.1/ABI/pytalloc-util-2.3.2.sigs 1970-01-01 00:00:00.000000000 +0000 +++ talloc-2.3.3/ABI/pytalloc-util-2.3.2.sigs 2020-11-20 10:22:42.000000000 +0000 @@ -0,0 +1,16 @@ +_pytalloc_check_type: int (PyObject *, const char *) +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_name: const char *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_Check: int (PyObject *) +pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -Nru talloc-2.3.1/ABI/pytalloc-util-2.3.3.sigs talloc-2.3.3/ABI/pytalloc-util-2.3.3.sigs --- talloc-2.3.1/ABI/pytalloc-util-2.3.3.sigs 1970-01-01 00:00:00.000000000 +0000 +++ talloc-2.3.3/ABI/pytalloc-util-2.3.3.sigs 2021-07-15 07:04:32.000000000 +0000 @@ -0,0 +1,16 @@ +_pytalloc_check_type: int (PyObject *, const char *) +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_name: const char *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_Check: int (PyObject *) +pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -Nru talloc-2.3.1/ABI/talloc-2.3.2.sigs talloc-2.3.3/ABI/talloc-2.3.2.sigs --- talloc-2.3.1/ABI/talloc-2.3.2.sigs 1970-01-01 00:00:00.000000000 +0000 +++ talloc-2.3.3/ABI/talloc-2.3.2.sigs 2020-11-20 10:22:42.000000000 +0000 @@ -0,0 +1,65 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void) diff -Nru talloc-2.3.1/ABI/talloc-2.3.3.sigs talloc-2.3.3/ABI/talloc-2.3.3.sigs --- talloc-2.3.1/ABI/talloc-2.3.3.sigs 1970-01-01 00:00:00.000000000 +0000 +++ talloc-2.3.3/ABI/talloc-2.3.3.sigs 2021-07-15 07:04:32.000000000 +0000 @@ -0,0 +1,65 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void) diff -Nru talloc-2.3.1/buildtools/bin/waf talloc-2.3.3/buildtools/bin/waf --- talloc-2.3.1/buildtools/bin/waf 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/buildtools/bin/waf 2020-12-18 10:02:37.000000000 +0000 @@ -32,7 +32,7 @@ import os, sys, inspect -VERSION="2.0.18" +VERSION="2.0.21" REVISION="x" GIT="x" INSTALL="x" diff -Nru talloc-2.3.1/buildtools/wafsamba/samba3.py talloc-2.3.3/buildtools/wafsamba/samba3.py --- talloc-2.3.1/buildtools/wafsamba/samba3.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba3.py 2019-12-10 09:17:32.000000000 +0000 @@ -40,7 +40,8 @@ extra_includes += [ '../source4/heimdal/lib/com_err', '../source4/heimdal/lib/krb5', '../source4/heimdal/lib/gssapi', - '../source4/heimdal_build', + '../source4/heimdal/lib/gssapi/gssapi', + '../source4/heimdal_build/include', '../bin/default/source4/heimdal/lib/asn1' ] if bld.CONFIG_SET('USING_SYSTEM_TDB'): diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_autoconf.py talloc-2.3.3/buildtools/wafsamba/samba_autoconf.py --- talloc-2.3.1/buildtools/wafsamba/samba_autoconf.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_autoconf.py 2021-04-28 06:53:27.000000000 +0000 @@ -725,6 +725,9 @@ if Options.options.debug: conf.ADD_CFLAGS('-g', testflags=True) + if Options.options.pidl_developer: + conf.env.PIDL_DEVELOPER_MODE = True + if Options.options.developer: conf.env.DEVELOPER_MODE = True @@ -787,6 +790,7 @@ if not Options.options.disable_warnings_as_errors: conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror -Wno-error=deprecated-declarations', testflags=True) conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=tautological-compare', testflags=True) + conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=cast-align', testflags=True) if Options.options.fatal_errors: conf.ADD_CFLAGS('-Wfatal-errors', testflags=True) @@ -901,9 +905,15 @@ -def CURRENT_CFLAGS(bld, target, cflags, allow_warnings=False, hide_symbols=False): +def CURRENT_CFLAGS(bld, target, cflags, + allow_warnings=False, + use_hostcc=False, + hide_symbols=False): '''work out the current flags. local flags are added first''' - ret = TO_LIST(cflags) + ret = [] + if use_hostcc: + ret += ['-D_SAMBA_HOSTCC_'] + ret += TO_LIST(cflags) if not 'EXTRA_CFLAGS' in bld.env: list = [] else: diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_patterns.py talloc-2.3.3/buildtools/wafsamba/samba_patterns.py --- talloc-2.3.1/buildtools/wafsamba/samba_patterns.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_patterns.py 2020-08-07 07:07:59.000000000 +0000 @@ -23,6 +23,7 @@ # git revision) included in the version. t = bld.SAMBA_GENERATOR('VERSION', rule=write_version_header, + group='setup', source=source, target=target, always=bld.is_install) diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_pidl.py talloc-2.3.3/buildtools/wafsamba/samba_pidl.py --- talloc-2.3.1/buildtools/wafsamba/samba_pidl.py 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_pidl.py 2020-04-17 11:13:25.000000000 +0000 @@ -28,6 +28,7 @@ '--samba3-ndr-server' : 'srv_%s.c srv_%s.h', '--samba3-ndr-client' : 'cli_%s.c cli_%s.h', '--server' : 'ndr_%s_s.c', + '--server-compat' : 'ndr_%s_scompat.c ndr_%s_scompat.h', '--client' : 'ndr_%s_c.c ndr_%s_c.h', '--python' : 'py_%s.c', '--tdr-parser' : 'tdr_%s.c tdr_%s.h', @@ -69,6 +70,10 @@ if cpp == "CPP=xlc_r": cpp = "" + if bld.env['PIDL_DEVELOPER_MODE']: + pidl_dev = 'PIDL_DEVELOPER=1 ' + else: + pidl_dev = '' if bld.CONFIG_SET("CC"): if isinstance(bld.CONFIG_GET("CC"), list): @@ -76,7 +81,7 @@ else: cc = 'CC="%s"' % bld.CONFIG_GET("CC") - t = bld(rule='cd ${PIDL_LAUNCH_DIR} && %s %s ${PERL} ${PIDL} --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- "${IDLSRC}"' % (cpp, cc), + t = bld(rule='cd ${PIDL_LAUNCH_DIR} && %s%s %s ${PERL} ${PIDL} --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- "${IDLSRC}"' % (pidl_dev, cpp, cc), ext_out = '.c', before = 'c', update_outputs = True, @@ -104,14 +109,34 @@ t.more_includes = '#' + bld.path.path_from(bld.srcnode) Build.BuildContext.SAMBA_PIDL = SAMBA_PIDL - def SAMBA_PIDL_LIST(bld, name, source, options='', output_dir='.', - generate_tables=True): + generate_tables=True, + generate_fuzzers=True): '''A wrapper for building a set of IDL files''' for p in TO_LIST(source): bld.SAMBA_PIDL(name, p, options=options, output_dir=output_dir, generate_tables=generate_tables) + + # Some IDL files don't exactly match between name and + # "interface" so we need a way to skip those, while other IDL + # files have the table generation skipped entirely, on which + # the fuzzers rely + if generate_tables and generate_fuzzers: + interface = p[0:-4] # strip off the .idl suffix + bld.SAMBA_NDR_FUZZ(interface, + auto_deps=True, + fuzz_type="TYPE_STRUCT") + + # Only generate the TYPE_STRUCT fuzzer if this isn't + # really DCE/RPC + if '--client' in options: + bld.SAMBA_NDR_FUZZ(interface, + auto_deps=True, + fuzz_type="TYPE_IN") + bld.SAMBA_NDR_FUZZ(interface, + auto_deps=True, + fuzz_type="TYPE_OUT") Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_python.py talloc-2.3.3/buildtools/wafsamba/samba_python.py --- talloc-2.3.1/buildtools/wafsamba/samba_python.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_python.py 2020-10-26 08:56:23.000000000 +0000 @@ -5,10 +5,10 @@ from waflib.Configure import conf @conf -def SAMBA_CHECK_PYTHON(conf, version=(3,5,0)): +def SAMBA_CHECK_PYTHON(conf, version=(3,6,0)): - if conf.env.disable_python: - version=(2,6,0) + if conf.env.enable_fuzzing: + version=(3,5,0) # enable tool to build python extensions if conf.env.HAVE_PYTHON_H: @@ -58,11 +58,8 @@ def _check_python_headers(conf): conf.check_python_headers() - if conf.env['PYTHON_VERSION'] > '3': - abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0] - conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % '' - else: - conf.env['PYTHON_SO_ABI_FLAG'] = '' + abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0] + conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % '' conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = ( conf.env['PYTHON_SO_ABI_FLAG'].replace('_', '-')) @@ -104,6 +101,10 @@ if not bld.PYTHON_BUILD_IS_ENABLED(): enabled = False + # Save time, no need to build python bindings when fuzzing + if bld.env.enable_fuzzing: + enabled = False + # when we support static python modules we'll need to gather # the list from all the SAMBA_PYTHON() targets if init_function_sentinel is not None: diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_third_party.py talloc-2.3.3/buildtools/wafsamba/samba_third_party.py --- talloc-2.3.1/buildtools/wafsamba/samba_third_party.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_third_party.py 2021-03-24 11:48:55.000000000 +0000 @@ -24,17 +24,17 @@ @conf def CHECK_SOCKET_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.2.3') + return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.3.3') Build.BuildContext.CHECK_SOCKET_WRAPPER = CHECK_SOCKET_WRAPPER @conf def CHECK_NSS_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.7') + return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.11') Build.BuildContext.CHECK_NSS_WRAPPER = CHECK_NSS_WRAPPER @conf def CHECK_RESOLV_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('resolv_wrapper', minversion='1.1.4') + return conf.CHECK_BUNDLED_SYSTEM_PKG('resolv_wrapper', minversion='1.1.7') Build.BuildContext.CHECK_RESOLV_WRAPPER = CHECK_RESOLV_WRAPPER @conf @@ -44,5 +44,5 @@ @conf def CHECK_PAM_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.0.7') + return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.1.2') Build.BuildContext.CHECK_PAM_WRAPPER = CHECK_PAM_WRAPPER diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_utils.py talloc-2.3.3/buildtools/wafsamba/samba_utils.py --- talloc-2.3.1/buildtools/wafsamba/samba_utils.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_utils.py 2020-12-18 10:02:37.000000000 +0000 @@ -459,7 +459,14 @@ return visited_dirs.add(key) relpath = os.path.relpath(abspath, ctx.path.abspath()) - if ctxclass in ['tmp', 'OptionsContext', 'ConfigurationContext', 'BuildContext']: + if ctxclass in ['OptionsContext', + 'ConfigurationContext', + 'BuildContext', + 'CleanContext', + 'InstallContext', + 'UninstallContext', + 'ListContext', + 'ClangDbContext']: return ctx.recurse(relpath) if 'waflib.extras.compat15' in sys.modules: return ctx.recurse(relpath) @@ -682,7 +689,7 @@ cache[node] = True self.pre_recurse(node) try: - function_code = node.read('rU', None) + function_code = node.read('r', None) exec(compile(function_code, node.abspath(), 'exec'), self.exec_dict) finally: self.post_recurse(node) @@ -719,6 +726,9 @@ if is_standard_libpath(v, i): v['LIBPATH'].remove(i) +# Samba options are mostly on by default (administrators and packagers +# specify features to remove, not add), which is why default=True + def samba_add_onoff_option(opt, option, help=(), dest=None, default=True, with_name="with", without_name="without"): if default is None: diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_waf18.py talloc-2.3.3/buildtools/wafsamba/samba_waf18.py --- talloc-2.3.1/buildtools/wafsamba/samba_waf18.py 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_waf18.py 2020-12-18 10:02:37.000000000 +0000 @@ -36,10 +36,11 @@ decider = decide_ext, ) - -for y in (Build.BuildContext, Build.CleanContext, Build.InstallContext, Build.UninstallContext, Build.ListContext): - class tmp(y): - variant = 'default' +Build.BuildContext.variant = 'default' +Build.CleanContext.variant = 'default' +Build.InstallContext.variant = 'default' +Build.UninstallContext.variant = 'default' +Build.ListContext.variant = 'default' def abspath(self, env=None): if env and hasattr(self, 'children'): diff -Nru talloc-2.3.1/buildtools/wafsamba/samba_wildcard.py talloc-2.3.3/buildtools/wafsamba/samba_wildcard.py --- talloc-2.3.1/buildtools/wafsamba/samba_wildcard.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/samba_wildcard.py 2021-03-24 11:48:55.000000000 +0000 @@ -136,7 +136,7 @@ try: proj = ConfigSet.ConfigSet(Options.lockfile) except IOError: - raise Errors.WafError("Project not configured (run 'waf configure' first)") + raise Errors.WafError("Project not configured (run './configure' first)") bld.load_envs() diff -Nru talloc-2.3.1/buildtools/wafsamba/tests/test_abi.py talloc-2.3.3/buildtools/wafsamba/tests/test_abi.py --- talloc-2.3.1/buildtools/wafsamba/tests/test_abi.py 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/tests/test_abi.py 2020-09-10 09:37:12.000000000 +0000 @@ -21,36 +21,36 @@ normalise_signature, ) -from samba.compat import StringIO +from io import StringIO class NormaliseSignatureTests(TestCase): def test_function_simple(self): - self.assertEquals("int (const struct GUID *, const struct GUID *)", + self.assertEqual("int (const struct GUID *, const struct GUID *)", normalise_signature("$2 = {int (const struct GUID *, const struct GUID *)} 0xe871 ")) def test_maps_Bool(self): # Some types have different internal names - self.assertEquals("bool (const struct GUID *)", + self.assertEqual("bool (const struct GUID *)", normalise_signature("$1 = {_Bool (const struct GUID *)} 0xe75b ")) def test_function_keep(self): - self.assertEquals( + self.assertEqual( "enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)", normalise_signature("enum ndr_err_code (struct ndr_push *, int, const union winreg_Data *)")) def test_struct_constant(self): - self.assertEquals( + self.assertEqual( 'uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\\000", node = "\\000\\000\\000\\000\\000"}, if_version = 0', normalise_signature('$239 = {uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\\000", node = "\\000\\000\\000\\000\\000"}, if_version = 0}')) def test_incomplete_sequence(self): # Newer versions of gdb insert these incomplete sequence elements - self.assertEquals( + self.assertEqual( 'uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2', normalise_signature('$244 = {uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237", , node = "\\b\\000+\\020H`"}, if_version = 2}')) - self.assertEquals( + self.assertEqual( 'uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2', normalise_signature('$244 = {uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\\237\\350", node = "\\b\\000+\\020H`"}, if_version = 2}')) @@ -62,7 +62,7 @@ abi_write_vscript(f, "MYLIB", "1.0", [], { "old": "1.0", "new": "1.0"}, ["*"]) - self.assertEquals(f.getvalue(), """\ + self.assertEqual(f.getvalue(), """\ 1.0 { \tglobal: \t\t*; @@ -79,7 +79,7 @@ abi_write_vscript(f, "MYLIB", "1.0", ["0.1"], { "old": "0.1", "new": "1.0"}, ["*"]) - self.assertEquals(f.getvalue(), """\ + self.assertEqual(f.getvalue(), """\ MYLIB_0.1 { \tglobal: \t\told; @@ -101,7 +101,7 @@ "exc_old": "0.1", "old": "0.1", "new": "1.0"}, ["!exc_*"]) - self.assertEquals(f.getvalue(), """\ + self.assertEqual(f.getvalue(), """\ 1.0 { \tglobal: \t\t*; @@ -120,7 +120,7 @@ "exc_bar": "1.0", "other": "1.0" }, ["pub_*", "!exc_*"]) - self.assertEquals(f.getvalue(), """\ + self.assertEqual(f.getvalue(), """\ 1.0 { \tglobal: \t\tpub_*; diff -Nru talloc-2.3.1/buildtools/wafsamba/tests/test_bundled.py talloc-2.3.3/buildtools/wafsamba/tests/test_bundled.py --- talloc-2.3.1/buildtools/wafsamba/tests/test_bundled.py 2014-09-16 18:04:31.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/tests/test_bundled.py 2020-02-17 11:20:37.000000000 +0000 @@ -24,4 +24,4 @@ class TuplizeVersionTests(TestCase): def test_simple(self): - self.assertEquals((1, 2, 10), tuplize_version("1.2.10")) + self.assertEqual((1, 2, 10), tuplize_version("1.2.10")) diff -Nru talloc-2.3.1/buildtools/wafsamba/tests/test_utils.py talloc-2.3.3/buildtools/wafsamba/tests/test_utils.py --- talloc-2.3.1/buildtools/wafsamba/tests/test_utils.py 2014-09-16 18:04:31.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/tests/test_utils.py 2020-02-17 11:20:37.000000000 +0000 @@ -26,33 +26,33 @@ class ToListTests(TestCase): def test_none(self): - self.assertEquals([], TO_LIST(None)) + self.assertEqual([], TO_LIST(None)) def test_already_list(self): - self.assertEquals(["foo", "bar", 1], TO_LIST(["foo", "bar", 1])) + self.assertEqual(["foo", "bar", 1], TO_LIST(["foo", "bar", 1])) def test_default_delimiter(self): - self.assertEquals(["foo", "bar"], TO_LIST("foo bar")) - self.assertEquals(["foo", "bar"], TO_LIST(" foo bar ")) - self.assertEquals(["foo ", "bar"], TO_LIST(" \"foo \" bar ")) + self.assertEqual(["foo", "bar"], TO_LIST("foo bar")) + self.assertEqual(["foo", "bar"], TO_LIST(" foo bar ")) + self.assertEqual(["foo ", "bar"], TO_LIST(" \"foo \" bar ")) def test_delimiter(self): - self.assertEquals(["foo", "bar"], TO_LIST("foo,bar", ",")) - self.assertEquals([" foo", "bar "], TO_LIST(" foo,bar ", ",")) - self.assertEquals([" \" foo\"", " bar "], TO_LIST(" \" foo\", bar ", ",")) + self.assertEqual(["foo", "bar"], TO_LIST("foo,bar", ",")) + self.assertEqual([" foo", "bar "], TO_LIST(" foo,bar ", ",")) + self.assertEqual([" \" foo\"", " bar "], TO_LIST(" \" foo\", bar ", ",")) class UniqueListTests(TestCase): def test_unique_list(self): - self.assertEquals(["foo", "bar"], unique_list(["foo", "bar", "foo"])) + self.assertEqual(["foo", "bar"], unique_list(["foo", "bar", "foo"])) class SubstVarsErrorTests(TestCase): def test_valid(self): - self.assertEquals("", subst_vars_error("", {})) - self.assertEquals("FOO bar", subst_vars_error("${F} bar", {"F": "FOO"})) + self.assertEqual("", subst_vars_error("", {})) + self.assertEqual("FOO bar", subst_vars_error("${F} bar", {"F": "FOO"})) def test_invalid(self): self.assertRaises(KeyError, subst_vars_error, "${F}", {}) @@ -63,14 +63,14 @@ def test_empty(self): ret = {} dict_concat(ret, {}) - self.assertEquals({}, ret) + self.assertEqual({}, ret) def test_same(self): ret = {"foo": "bar"} dict_concat(ret, {"foo": "bla"}) - self.assertEquals({"foo": "bar"}, ret) + self.assertEqual({"foo": "bar"}, ret) def test_simple(self): ret = {"foo": "bar"} dict_concat(ret, {"blie": "bla"}) - self.assertEquals({"foo": "bar", "blie": "bla"}, ret) + self.assertEqual({"foo": "bar", "blie": "bla"}, ret) diff -Nru talloc-2.3.1/buildtools/wafsamba/wafsamba.py talloc-2.3.3/buildtools/wafsamba/wafsamba.py --- talloc-2.3.1/buildtools/wafsamba/wafsamba.py 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/wafsamba.py 2021-06-22 09:01:51.000000000 +0000 @@ -38,7 +38,7 @@ os.environ['PYTHONUNBUFFERED'] = '1' -if Context.HEXVERSION not in (0x2001200,): +if Context.HEXVERSION not in (0x2001500,): Logs.error(''' Please use the version of waf that comes with Samba, not a system installed version. See http://wiki.samba.org/index.php/Waf @@ -360,13 +360,32 @@ subdir=None, install=True, install_path=None, - enabled=True): + enabled=True, + fuzzer=False, + for_selftest=False): '''define a Samba binary''' + if for_selftest: + install=False + if not bld.CONFIG_GET('ENABLE_SELFTEST'): + enabled=False + if not enabled: SET_TARGET_TYPE(bld, binname, 'DISABLED') return + # Fuzzing builds do not build normal binaries + # however we must build asn1compile etc + + if not use_hostcc and bld.env.enable_fuzzing != fuzzer: + SET_TARGET_TYPE(bld, binname, 'DISABLED') + return + + if fuzzer: + install = False + if ldflags is None: + ldflags = bld.env['FUZZ_TARGET_LDFLAGS'] + if not SET_TARGET_TYPE(bld, binname, 'BINARY'): return @@ -389,10 +408,10 @@ subsystem_group = group # only specify PIE flags for binaries - pie_cflags = cflags + pie_cflags = TO_LIST(cflags) pie_ldflags = TO_LIST(ldflags) if bld.env['ENABLE_PIE'] is True: - pie_cflags += ' -fPIE' + pie_cflags.extend(TO_LIST('-fPIE')) pie_ldflags.extend(TO_LIST('-pie')) if bld.env['ENABLE_RELRO'] is True: pie_ldflags.extend(TO_LIST('-Wl,-z,relro,-z,now')) @@ -616,6 +635,7 @@ target = modname, samba_cflags = CURRENT_CFLAGS(bld, modname, cflags, allow_warnings=allow_warnings, + use_hostcc=use_hostcc, hide_symbols=hide_symbols), depends_on = depends_on, samba_deps = TO_LIST(deps), @@ -697,13 +717,13 @@ bld.p_ln = bld.srcnode # we do want to see all targets! bld.env['USING_BUILD_GROUPS'] = True bld.add_group('setup') - bld.add_group('build_compiler_source') + bld.add_group('generators') + bld.add_group('hostcc_base_build_source') + bld.add_group('hostcc_base_build_main') + bld.add_group('hostcc_build_source') + bld.add_group('hostcc_build_main') bld.add_group('vscripts') bld.add_group('base_libraries') - bld.add_group('generators') - bld.add_group('compiler_prototypes') - bld.add_group('compiler_libraries') - bld.add_group('build_compilers') bld.add_group('build_source') bld.add_group('prototypes') bld.add_group('headers') diff -Nru talloc-2.3.1/buildtools/wafsamba/wscript talloc-2.3.3/buildtools/wafsamba/wscript --- talloc-2.3.1/buildtools/wafsamba/wscript 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/buildtools/wafsamba/wscript 2020-12-18 10:02:37.000000000 +0000 @@ -102,6 +102,9 @@ gr.add_option('--enable-developer', help=("Turn on developer warnings and debugging"), action="store_true", dest='developer', default=False) + gr.add_option('--pidl-developer', + help=("annotate PIDL-generated code for developers"), + action="store_true", dest='pidl_developer', default=False) gr.add_option('--disable-warnings-as-errors', help=("Do not treat all warnings as errors (disable -Werror)"), action="store_true", dest='disable_warnings_as_errors', default=False) @@ -129,9 +132,22 @@ action="store_true", dest='undefined_sanitizer', default=False) + gr.add_option('--enable-clangdb', + help=("Enable use of clang_compilation_database"), + action="store_true", dest='enable_clangdb', default=False) gr.add_option('--enable-libfuzzer', - help=("Build fuzzing binaries (requires compiler options for libFuzzer or compiler wrapper such as honggfuzz/hfuzz-cc)"), + help=("Build fuzzing binaries (use ADDITIONAL_CFLAGS to specify compiler options for libFuzzer or use CC=honggfuzz/hfuzz-cc)"), action="store_true", dest='enable_libfuzzer', default=False) + gr.add_option('--enable-afl-fuzzer', + help=("Build fuzzing binaries AFL-style (typically use with CC=afl-gcc)"), + action="store_true", dest='enable_afl_fuzzer', default=False) + + # Fuzz targets may need additional LDFLAGS that we can't use on + # internal binaries like asn1_compile + + gr.add_option('--fuzz-target-ldflags', + help=("Linker flags to be used when building fuzz targets"), + action="store", dest='FUZZ_TARGET_LDFLAGS', default='') gr.add_option('--abi-check', help=("Check ABI signatures for libraries"), @@ -378,7 +394,26 @@ strict=True, msg='Checking for library constructor support') - # check HAVE_DESTRUCTOR_ATTRIBUTE + # check HAVE_PRAGMA_INIT alternatively + if not conf.env.HAVE_CONSTRUCTOR_ATTRIBUTE: + conf.CHECK_CODE(''' + #pragma init (test_init) + + void test_init(void) + { + return; + } + + int main(void) { + return 0; + } + ''', + 'HAVE_PRAGMA_INIT', + addmain=False, + strict=True, + msg='Checking for pragma init support') + + # check HAVE_DESTRUCTOR_ATTRIBUTE conf.CHECK_CODE(''' void test_destructor_attribute(void) __attribute__ ((destructor)); @@ -396,6 +431,25 @@ strict=True, msg='Checking for library destructor support') + # check HAVE_PRAGMA_FINI alternatively + if not conf.env.HAVE_DESTRUCTOR_ATTRIBUTE: + conf.CHECK_CODE(''' + #pragma fini (test_fini) + + void test_fini(void) + { + return; + } + + int main(void) { + return 0; + } + ''', + 'HAVE_PRAGMA_FINI', + addmain=False, + strict=True, + msg='Checking for pragma fini support') + conf.CHECK_CODE(''' void test_attribute(void) __attribute__ (()); @@ -413,6 +467,10 @@ strict=True, msg='Checking for __attribute__') + # Solaris by defauls uses draft versions of some functions unless you set _POSIX_PTHREAD_SEMANTICS + if sys.platform.startswith('sunos'): + conf.DEFINE('_POSIX_PTHREAD_SEMANTICS', 1) + if sys.platform.startswith('aix'): conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True) # Might not be needed if ALL_SOURCE is defined @@ -593,16 +651,22 @@ eprintf("bla", "bar") ''', define='HAVE__VA_ARGS__MACRO') - conf.env.enable_libfuzzer = Options.options.enable_libfuzzer - if conf.env.enable_libfuzzer: - conf.DEFINE('ENABLE_LIBFUZZER', 1) - - conf.load('clang_compilation_database') + conf.env.enable_fuzzing = False - # Create a symlink of the compile db for clangd - symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), - os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), - force=True) + conf.env.enable_libfuzzer = Options.options.enable_libfuzzer + conf.env.enable_afl_fuzzer = Options.options.enable_afl_fuzzer + if conf.env.enable_libfuzzer or conf.env.enable_afl_fuzzer: + conf.env.enable_fuzzing = True + conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1) + conf.env.FUZZ_TARGET_LDFLAGS = Options.options.FUZZ_TARGET_LDFLAGS + + conf.env.enable_clangdb = Options.options.enable_clangdb + if conf.env.enable_clangdb: + conf.load('clang_compilation_database') + # Create a symlink of the compile db for clangd + symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), + os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), + force=True) conf.SAMBA_BUILD_ENV() diff -Nru talloc-2.3.1/debian/changelog talloc-2.3.3/debian/changelog --- talloc-2.3.1/debian/changelog 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/changelog 2023-02-23 15:50:40.000000000 +0000 @@ -1,3 +1,10 @@ +talloc (2.3.3-0ubuntu0.20.04.1) focal-security; urgency=medium + + * Updated to upstream 2.3.3 as required by Samba security update. + - debian/*symbols*: updated for new version. + + -- Marc Deslauriers Thu, 23 Feb 2023 10:50:40 -0500 + talloc (2.3.1-0ubuntu0.20.04.1) focal-security; urgency=medium * Updated to upstream 2.3.1 as required by Samba security update. diff -Nru talloc-2.3.1/debian/libtalloc2.symbols talloc-2.3.3/debian/libtalloc2.symbols --- talloc-2.3.1/debian/libtalloc2.symbols 2021-11-01 18:24:37.000000000 +0000 +++ talloc-2.3.3/debian/libtalloc2.symbols 2023-01-11 13:53:18.000000000 +0000 @@ -27,6 +27,8 @@ TALLOC_2.2.0@TALLOC_2.2.0 2.2.0 TALLOC_2.3.0@TALLOC_2.3.0 2.3.0 TALLOC_2.3.1@TALLOC_2.3.1 2.3.1 + TALLOC_2.3.2@TALLOC_2.3.2 2.3.2 + TALLOC_2.3.3@TALLOC_2.3.3 2.3.3 _talloc@TALLOC_2.0.2 2.0.4~git20101213 _talloc_array@TALLOC_2.0.2 2.0.4~git20101213 _talloc_free@TALLOC_2.0.2 2.0.4~git20101213 diff -Nru talloc-2.3.1/debian/python3-talloc.symbols.amd64 talloc-2.3.3/debian/python3-talloc.symbols.amd64 --- talloc-2.3.1/debian/python3-talloc.symbols.amd64 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/python3-talloc.symbols.amd64 2023-01-11 13:54:00.000000000 +0000 @@ -1,3 +1,3 @@ libpytalloc-util.cpython-38-x86-64-linux-gnu.so.2 python3-talloc #MINVER# - PYTALLOC_UTIL.CPYTHON_38_X86_64_LINUX_GNU_2.3.1@PYTALLOC_UTIL.CPYTHON_38_X86_64_LINUX_GNU_2.3.1 2.3.1 + PYTALLOC_UTIL.CPYTHON_38_X86_64_LINUX_GNU_2.3.3@PYTALLOC_UTIL.CPYTHON_38_X86_64_LINUX_GNU_2.3.3 2.3.3 #include "python3-talloc.symbols.common" diff -Nru talloc-2.3.1/debian/python3-talloc.symbols.arm64 talloc-2.3.3/debian/python3-talloc.symbols.arm64 --- talloc-2.3.1/debian/python3-talloc.symbols.arm64 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/python3-talloc.symbols.arm64 2023-01-11 13:54:04.000000000 +0000 @@ -1,3 +1,3 @@ libpytalloc-util.cpython-38-aarch64-linux-gnu.so.2 python3-talloc #MINVER# - PYTALLOC_UTIL.CPYTHON_38_AARCH64_LINUX_GNU_2.3.1@PYTALLOC_UTIL.CPYTHON_38_AARCH64_LINUX_GNU_2.3.1 2.3.1 + PYTALLOC_UTIL.CPYTHON_38_AARCH64_LINUX_GNU_2.3.3@PYTALLOC_UTIL.CPYTHON_38_AARCH64_LINUX_GNU_2.3.3 2.3.3 #include "python3-talloc.symbols.common" diff -Nru talloc-2.3.1/debian/python3-talloc.symbols.armhf talloc-2.3.3/debian/python3-talloc.symbols.armhf --- talloc-2.3.1/debian/python3-talloc.symbols.armhf 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/python3-talloc.symbols.armhf 2023-01-11 13:54:07.000000000 +0000 @@ -1,3 +1,3 @@ libpytalloc-util.cpython-38-arm-linux-gnueabihf.so.2 python3-talloc #MINVER# - PYTALLOC_UTIL.CPYTHON_38_ARM_LINUX_GNUEABIHF_2.3.1@PYTALLOC_UTIL.CPYTHON_38_ARM_LINUX_GNUEABIHF_2.3.1 2.3.1 + PYTALLOC_UTIL.CPYTHON_38_ARM_LINUX_GNUEABIHF_2.3.3@PYTALLOC_UTIL.CPYTHON_38_ARM_LINUX_GNUEABIHF_2.3.3 2.3.3 #include "python3-talloc.symbols.common" diff -Nru talloc-2.3.1/debian/python3-talloc.symbols.common talloc-2.3.3/debian/python3-talloc.symbols.common --- talloc-2.3.1/debian/python3-talloc.symbols.common 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/python3-talloc.symbols.common 2023-01-11 13:53:43.000000000 +0000 @@ -22,6 +22,8 @@ PYTALLOC_UTIL_2.2.0@PYTALLOC_UTIL_2.2.0 2.3.0 PYTALLOC_UTIL_2.3.0@PYTALLOC_UTIL_2.3.0 2.3.0 PYTALLOC_UTIL_2.3.1@PYTALLOC_UTIL_2.3.1 2.3.1 + PYTALLOC_UTIL_2.3.2@PYTALLOC_UTIL_2.3.2 2.3.2 + PYTALLOC_UTIL_2.3.3@PYTALLOC_UTIL_2.3.3 2.3.3 _pytalloc_check_type@PYTALLOC_UTIL_2.1.9 2.1.16 _pytalloc_get_mem_ctx@PYTALLOC_UTIL_2.1.6 2.1.16 _pytalloc_get_name@PYTALLOC_UTIL_2.3.0 2.3.0 diff -Nru talloc-2.3.1/debian/python3-talloc.symbols.i386 talloc-2.3.3/debian/python3-talloc.symbols.i386 --- talloc-2.3.1/debian/python3-talloc.symbols.i386 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/python3-talloc.symbols.i386 2023-01-11 13:54:16.000000000 +0000 @@ -1,3 +1,3 @@ libpytalloc-util.cpython-38-i386-linux-gnu.so.2 python3-talloc #MINVER# - PYTALLOC_UTIL.CPYTHON_38_I386_LINUX_GNU_2.3.1@PYTALLOC_UTIL.CPYTHON_38_I386_LINUX_GNU_2.3.1 2.3.1 + PYTALLOC_UTIL.CPYTHON_38_I386_LINUX_GNU_2.3.3@PYTALLOC_UTIL.CPYTHON_38_I386_LINUX_GNU_2.3.3 2.3.3 #include "python3-talloc.symbols.common" diff -Nru talloc-2.3.1/debian/python3-talloc.symbols.ppc64el talloc-2.3.3/debian/python3-talloc.symbols.ppc64el --- talloc-2.3.1/debian/python3-talloc.symbols.ppc64el 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/python3-talloc.symbols.ppc64el 2023-01-11 13:54:20.000000000 +0000 @@ -1,3 +1,3 @@ libpytalloc-util.cpython-38-powerpc64le-linux-gnu.so.2 python3-talloc #MINVER# - PYTALLOC_UTIL.CPYTHON_38_POWERPC64LE_LINUX_GNU_2.3.1@PYTALLOC_UTIL.CPYTHON_38_POWERPC64LE_LINUX_GNU_2.3.1 2.3.1 + PYTALLOC_UTIL.CPYTHON_38_POWERPC64LE_LINUX_GNU_2.3.3@PYTALLOC_UTIL.CPYTHON_38_POWERPC64LE_LINUX_GNU_2.3.3 2.3.3 #include "python3-talloc.symbols.common" diff -Nru talloc-2.3.1/debian/python3-talloc.symbols.s390x talloc-2.3.3/debian/python3-talloc.symbols.s390x --- talloc-2.3.1/debian/python3-talloc.symbols.s390x 2021-11-01 18:24:58.000000000 +0000 +++ talloc-2.3.3/debian/python3-talloc.symbols.s390x 2023-01-11 13:54:24.000000000 +0000 @@ -1,3 +1,3 @@ libpytalloc-util.cpython-38-s390x-linux-gnu.so.2 python3-talloc #MINVER# - PYTALLOC_UTIL.CPYTHON_38_S390X_LINUX_GNU_2.3.1@PYTALLOC_UTIL.CPYTHON_38_S390X_LINUX_GNU_2.3.1 2.3.1 + PYTALLOC_UTIL.CPYTHON_38_S390X_LINUX_GNU_2.3.3@PYTALLOC_UTIL.CPYTHON_38_S390X_LINUX_GNU_2.3.3 2.3.3 #include "python3-talloc.symbols.common" diff -Nru talloc-2.3.1/lib/replace/closefrom.c talloc-2.3.3/lib/replace/closefrom.c --- talloc-2.3.1/lib/replace/closefrom.c 2016-07-28 07:17:50.000000000 +0000 +++ talloc-2.3.3/lib/replace/closefrom.c 2020-11-20 10:22:42.000000000 +0000 @@ -54,7 +54,7 @@ int ret = ENOMEM; dirp = opendir("/proc/self/fd"); - if (dirp == 0) { + if (dirp == NULL) { return errno; } diff -Nru talloc-2.3.1/lib/replace/replace.c talloc-2.3.3/lib/replace/replace.c --- talloc-2.3.1/lib/replace/replace.c 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/lib/replace/replace.c 2021-07-12 10:24:49.000000000 +0000 @@ -1056,3 +1056,28 @@ #endif /* HAVE_PROGRAM_INVOCATION_SHORT_NAME */ } #endif /* HAVE_GETPROGNAME */ + +#ifndef HAVE_COPY_FILE_RANGE +# ifdef HAVE_SYSCALL_COPY_FILE_RANGE +# include +# endif +ssize_t rep_copy_file_range(int fd_in, + loff_t *off_in, + int fd_out, + loff_t *off_out, + size_t len, + unsigned int flags) +{ +# ifdef HAVE_SYSCALL_COPY_FILE_RANGE + return syscall(__NR_copy_file_range, + fd_in, + off_in, + fd_out, + off_out, + len, + flags); +# endif /* HAVE_SYSCALL_COPY_FILE_RANGE */ + errno = ENOSYS; + return -1; +} +#endif /* HAVE_COPY_FILE_RANGE */ diff -Nru talloc-2.3.1/lib/replace/replace.h talloc-2.3.3/lib/replace/replace.h --- talloc-2.3.1/lib/replace/replace.h 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/lib/replace/replace.h 2021-07-12 10:24:49.000000000 +0000 @@ -447,8 +447,13 @@ /* prototype is in system/network.h */ #endif +/* for old gcc releases that don't have the feature test macro __has_attribute */ +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + #ifndef PRINTF_ATTRIBUTE -#ifdef HAVE___ATTRIBUTE__ +#if __has_attribute(format) || (__GNUC__ >= 3) /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first * argument. Note that some gcc 2.x versions don't handle this @@ -460,7 +465,7 @@ #endif #ifndef _DEPRECATED_ -#ifdef HAVE___ATTRIBUTE__ +#if __has_attribute(deprecated) || (__GNUC__ >= 3) #define _DEPRECATED_ __attribute__ ((deprecated)) #else #define _DEPRECATED_ @@ -844,9 +849,18 @@ /** * Work out how many elements there are in a static array. */ +#ifdef ARRAY_SIZE +#undef ARRAY_SIZE +#endif #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) /** + * Remove an array element by moving the rest one down + */ +#define ARRAY_DEL_ELEMENT(a,i,n) \ +if((i)<((n)-1)){memmove(&((a)[(i)]),&((a)[(i)+1]),(sizeof(*(a))*((n)-(i)-1)));} + +/** * Pointer difference macro */ #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2))) @@ -950,6 +964,16 @@ const char *rep_getprogname(void); #endif +#ifndef HAVE_COPY_FILE_RANGE +#define copy_file_range rep_copy_file_range +ssize_t rep_copy_file_range(int fd_in, + loff_t *off_in, + int fd_out, + loff_t *off_out, + size_t len, + unsigned int flags); +#endif /* HAVE_COPY_FILE_RANGE */ + #ifndef FALL_THROUGH # ifdef HAVE_FALLTHROUGH_ATTRIBUTE # define FALL_THROUGH __attribute__ ((fallthrough)) @@ -963,6 +987,22 @@ bool socket_wrapper_enabled(void); bool uid_wrapper_enabled(void); +static inline bool _hexcharval(char c, uint8_t *val) +{ + if ((c >= '0') && (c <= '9')) { *val = c - '0'; return true; } + if ((c >= 'a') && (c <= 'f')) { *val = c - 'a' + 10; return true; } + if ((c >= 'A') && (c <= 'F')) { *val = c - 'A' + 10; return true; } + return false; +} + +static inline bool hex_byte(const char *in, uint8_t *out) +{ + uint8_t hi=0, lo=0; + bool ok = _hexcharval(in[0], &hi) && _hexcharval(in[1], &lo); + *out = (hi<<4)+lo; + return ok; +} + /* Needed for Solaris atomic_add_XX functions. */ #if defined(HAVE_SYS_ATOMIC_H) #include diff -Nru talloc-2.3.1/lib/replace/system/filesys.h talloc-2.3.3/lib/replace/system/filesys.h --- talloc-2.3.1/lib/replace/system/filesys.h 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/lib/replace/system/filesys.h 2020-12-18 10:02:37.000000000 +0000 @@ -107,19 +107,17 @@ #include #endif -#if defined(HAVE_SYS_ATTRIBUTES_H) +/* mutually exclusive (SuSE 8.2) */ +#if defined(HAVE_SYS_XATTR_H) +#include +#elif defined(HAVE_ATTR_XATTR_H) +#include +#elif defined(HAVE_SYS_ATTRIBUTES_H) #include #elif defined(HAVE_ATTR_ATTRIBUTES_H) #include #endif -/* mutually exclusive (SuSE 8.2) */ -#if defined(HAVE_ATTR_XATTR_H) -#include -#elif defined(HAVE_SYS_XATTR_H) -#include -#endif - #ifdef HAVE_SYS_EA_H #include #endif @@ -201,6 +199,10 @@ #define mkdir(d,m) _mkdir(d) #endif +#ifdef DISABLE_OPATH +#undef O_PATH +#endif + /* this allows us to use a uniform error handling for our xattr wrappers diff -Nru talloc-2.3.1/lib/replace/system/network.h talloc-2.3.3/lib/replace/system/network.h --- talloc-2.3.1/lib/replace/system/network.h 2017-02-27 19:23:11.000000000 +0000 +++ talloc-2.3.3/lib/replace/system/network.h 2020-08-07 07:07:59.000000000 +0000 @@ -332,6 +332,13 @@ */ # define IOV_MAX 512 # endif +# ifdef __GNU__ + /* + * GNU/Hurd does not have such hardcoded limitations. Use a reasonable + * amount. + */ +# define IOV_MAX 512 +# endif # endif #endif diff -Nru talloc-2.3.1/lib/replace/system/nis.h talloc-2.3.3/lib/replace/system/nis.h --- talloc-2.3.1/lib/replace/system/nis.h 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/lib/replace/system/nis.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - nis system include wrappers - - Copyright (C) Andrew Tridgell 2004 - - ** NOTE! The following LGPL license applies to the replace - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _nis_passwd_h -#define _nis_passwd_h - -#if defined(HAVE_RPC_RPC_H) -/* - * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h. - */ -#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT) -#undef AUTH_ERROR -#endif /* HAVE_SYS_SECURITY_H && HAVE_RPC_AUTH_ERROR_CONFLICT */ - -#include -#endif /* HAVE_RPC_RPC_H */ - - -#if defined (HAVE_NETGROUP) - -#if defined(HAVE_RPCSVC_YP_PROT_H) - -#include - -#endif /* HAVE_RPCSVC_YP_PROT_H */ - -#if defined(HAVE_RPCSVC_YPCLNT_H) -#include -#endif /* HAVE_RPCSVC_YPCLNT_H */ - -#endif /* HAVE_NETGROUP */ - -#endif /* _nis_passwd_h */ diff -Nru talloc-2.3.1/lib/replace/system/time.h talloc-2.3.3/lib/replace/system/time.h --- talloc-2.3.1/lib/replace/system/time.h 2017-06-15 21:19:32.000000000 +0000 +++ talloc-2.3.3/lib/replace/system/time.h 2019-12-10 09:17:32.000000000 +0000 @@ -96,4 +96,11 @@ #define CUSTOM_CLOCK_MONOTONIC_IS_REALTIME #endif +#ifndef UTIME_NOW +#define UTIME_NOW ((1l << 30) - 1l) +#endif +#ifndef UTIME_OMIT +#define UTIME_OMIT ((1l << 30) - 2l) +#endif + #endif diff -Nru talloc-2.3.1/lib/replace/tests/os2_delete.c talloc-2.3.3/lib/replace/tests/os2_delete.c --- talloc-2.3.1/lib/replace/tests/os2_delete.c 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/lib/replace/tests/os2_delete.c 2021-04-28 06:53:27.000000000 +0000 @@ -106,6 +106,7 @@ d = opendir(TESTDIR "/test0.txt"); if (d != NULL) FAILED("opendir() on file succeed"); if (errno != ENOTDIR) FAILED("opendir() on file didn't give ENOTDIR"); + closedir(d); d = opendir(TESTDIR); diff -Nru talloc-2.3.1/lib/replace/tests/testsuite.c talloc-2.3.3/lib/replace/tests/testsuite.c --- talloc-2.3.1/lib/replace/tests/testsuite.c 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/lib/replace/tests/testsuite.c 2021-06-22 09:01:51.000000000 +0000 @@ -164,11 +164,16 @@ static int test_strdup(void) { char *x; + int cmp; + printf("test: strdup\n"); x = strdup("bla"); - if (strcmp("bla", x) != 0) { + + cmp = strcmp("bla", x); + if (cmp != 0) { printf("failure: strdup [\nfailed: expected \"bla\", got \"%s\"\n]\n", x); + free(x); return false; } free(x); @@ -259,26 +264,44 @@ static int test_strndup(void) { char *x; + int cmp; + printf("test: strndup\n"); x = strndup("bla", 0); - if (strcmp(x, "") != 0) { + cmp = strcmp(x, ""); + free(x); + if (cmp != 0) { printf("failure: strndup [\ninvalid\n]\n"); return false; } - free(x); + x = strndup("bla", 2); - if (strcmp(x, "bl") != 0) { + cmp = strcmp(x, "bl"); + free(x); + if (cmp != 0) { printf("failure: strndup [\ninvalid\n]\n"); return false; } - free(x); + +#ifdef __GNUC__ +# if __GNUC__ < 11 + /* + * This code will not compile with gcc11 -O3 anymore. + * + * error: ‘strndup’ specified bound 10 exceeds source size 4 [-Werror=stringop-overread] + * x = strndup("bla", 10); + * ^~~~~~~~~~~~~~~~~~ + */ x = strndup("bla", 10); - if (strcmp(x, "bla") != 0) { + cmp = strcmp(x, "bla"); + free(x); + if (cmp != 0) { printf("failure: strndup [\ninvalid\n]\n"); - free(x); return false; } - free(x); +# endif +#endif /* __GNUC__ */ + printf("success: strndup\n"); return true; } @@ -325,24 +348,30 @@ static int test_asprintf(void) { - char *x; + char *x = NULL; + printf("test: asprintf\n"); if (asprintf(&x, "%d", 9) != 1) { printf("failure: asprintf [\ngenerate asprintf\n]\n"); + free(x); return false; } if (strcmp(x, "9") != 0) { printf("failure: asprintf [\ngenerate asprintf\n]\n"); + free(x); return false; } if (asprintf(&x, "dat%s", "a") != 4) { printf("failure: asprintf [\ngenerate asprintf\n]\n"); + free(x); return false; } if (strcmp(x, "data") != 0) { printf("failure: asprintf [\ngenerate asprintf\n]\n"); + free(x); return false; } + free(x); printf("success: asprintf\n"); return true; } @@ -1070,6 +1099,7 @@ fd = dup(0); if (fd == -1) { perror("dup failed"); + closefrom(3); return false; } @@ -1077,6 +1107,7 @@ if (fd >= 1000) { printf("fd=%d\n", fd); + closefrom(3); return false; } } @@ -1095,6 +1126,47 @@ return true; } +static bool test_array_del_element(void) +{ + int a[] = { 1,2,3,4,5 }; + + printf("test: array_del_element\n"); + + ARRAY_DEL_ELEMENT(a, 4, ARRAY_SIZE(a)); + + if ((a[0] != 1) || + (a[1] != 2) || + (a[2] != 3) || + (a[3] != 4) || + (a[4] != 5)) { + return false; + } + + ARRAY_DEL_ELEMENT(a, 0, ARRAY_SIZE(a)); + + if ((a[0] != 2) || + (a[1] != 3) || + (a[2] != 4) || + (a[3] != 5) || + (a[4] != 5)) { + return false; + } + + ARRAY_DEL_ELEMENT(a, 2, ARRAY_SIZE(a)); + + if ((a[0] != 2) || + (a[1] != 3) || + (a[2] != 5) || + (a[3] != 5) || + (a[4] != 5)) { + return false; + } + + printf("success: array_del_element\n"); + + return true; +} + bool torture_local_replace(struct torture_context *ctx) { bool ret = true; @@ -1145,6 +1217,7 @@ ret &= test_utimes(); ret &= test_memmem(); ret &= test_closefrom(); + ret &= test_array_del_element(); return ret; } diff -Nru talloc-2.3.1/lib/replace/wscript talloc-2.3.3/lib/replace/wscript --- talloc-2.3.1/lib/replace/wscript 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/lib/replace/wscript 2021-07-12 10:24:49.000000000 +0000 @@ -31,6 +31,7 @@ conf.env.standalone_replace = conf.IN_LAUNCH_DIR() + conf.DEFINE('BOOL_DEFINED', 1) conf.DEFINE('HAVE_LIBREPLACE', 1) conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) @@ -67,7 +68,7 @@ headers='sys/inotify.h') conf.CHECK_HEADERS('security/pam_appl.h zlib.h asm/unistd.h') - conf.CHECK_HEADERS('aio.h sys/unistd.h alloca.h float.h') + conf.CHECK_HEADERS('sys/unistd.h alloca.h float.h') conf.SET_TARGET_TYPE('tirpc', 'EMPTY') @@ -94,18 +95,6 @@ if not conf.CONFIG_SET('HAVE_RPC_RPC_H'): Logs.warn('No rpc/rpc.h header found, tirpc or libntirpc missing?') - conf.SET_TARGET_TYPE('nsl', 'EMPTY') - conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc') - if not conf.CONFIG_SET('HAVE_RPCSVC_YP_PROT_H'): - if conf.CHECK_CFG(package='libnsl', args='--cflags --libs', - msg='Checking for libnsl', - uselib_store='NSL'): - conf.SET_TARGET_TYPE('nsl', 'SYSLIB') - conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc nsl') - else: - conf.SET_TARGET_TYPE('nsl', 'SYSLIB') - conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h', lib='tirpc nsl') - # This file is decprecated with glibc >= 2.30 so we need to check if it # includes a deprecation warning: # #warning "The header is deprecated and will be removed." @@ -465,6 +454,16 @@ conf.CHECK_FUNCS('getpwent_r getpwnam_r getpwuid_r epoll_create') conf.CHECK_FUNCS('port_create') conf.CHECK_FUNCS('getprogname') + if not conf.CHECK_FUNCS('copy_file_range'): + conf.CHECK_CODE(''' +#include +#include +syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0); + ''', + 'HAVE_SYSCALL_COPY_FILE_RANGE', + msg='Checking whether we have copy_file_range system call') + if conf.CONFIG_SET('HAVE_COPY_FILE_RANGE') or conf.CONFIG_SET('HAVE_SYSCALL_COPY_FILE_RANGE'): + conf.DEFINE('USE_COPY_FILE_RANGE', 1) conf.SET_TARGET_TYPE('attr', 'EMPTY') @@ -661,6 +660,7 @@ conf.CHECK_FUNCS_IN('crypt', 'crypt', checklibc=True) conf.CHECK_FUNCS_IN('crypt_r', 'crypt', checklibc=True) + conf.CHECK_FUNCS_IN('crypt_rn', 'crypt', checklibc=True) conf.CHECK_VARIABLE('rl_event_hook', define='HAVE_DECL_RL_EVENT_HOOK', always=True, headers='readline.h readline/readline.h readline/history.h') @@ -745,8 +745,6 @@ conf.CHECK_CODE('mkdir("foo",0777)', define='HAVE_MKDIR_MODE', headers='sys/stat.h') - conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_mtim.tv_nsec', define='HAVE_STAT_TV_NSEC', - headers='sys/stat.h') # we need the st_rdev test under two names conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_rdev', define='HAVE_STRUCT_STAT_ST_RDEV', @@ -847,7 +845,7 @@ 'strsep', 'strtok_r', 'strtoll', 'strtoull', 'setenv', 'unsetenv', 'utime', 'utimes', 'dup2', 'chown', 'link', 'readlink', 'symlink', 'lchown', 'realpath', 'memmem', 'vdprintf', - 'dprintf', 'get_current_dir_name', + 'dprintf', 'get_current_dir_name', 'copy_file_range', 'strerror_r', 'clock_gettime', 'memset_s'], 'timegm.c': ['timegm'], # Note: C99_VSNPRINTF is not a function, but a special condition @@ -875,12 +873,14 @@ if bld.CONFIG_SET('HAVE_LIBRT'): extra_libs += ' rt' if bld.CONFIG_SET('REPLACE_REQUIRES_LIBSOCKET_LIBNSL'): extra_libs += ' socket nsl' + if not bld.CONFIG_SET('HAVE_CLOSEFROM'): + REPLACE_HOSTCC_SOURCE += ' closefrom.c' + bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC', REPLACE_HOSTCC_SOURCE, use_hostcc=True, use_global_deps=False, - cflags='-D_SAMBA_HOSTCC_', - group='compiler_libraries', + group='hostcc_base_build_main', deps = extra_libs ) diff -Nru talloc-2.3.1/pytalloc.c talloc-2.3.3/pytalloc.c --- talloc-2.3.1/pytalloc.c 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/pytalloc.c 2021-06-22 09:01:51.000000000 +0000 @@ -3,18 +3,22 @@ Python Talloc Module Copyright (C) Jelmer Vernooij 2010-2011 - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . */ #include @@ -37,7 +41,7 @@ } else { talloc_report_full(pytalloc_get_mem_ctx(py_obj), stdout); } - return Py_None; + Py_RETURN_NONE; } /* enable null tracking */ @@ -45,7 +49,7 @@ PyObject *Py_UNUSED(ignored)) { talloc_enable_null_tracking(); - return Py_None; + Py_RETURN_NONE; } /* return the number of talloc blocks */ @@ -70,7 +74,7 @@ "enable tracking of the NULL object"}, { "total_blocks", (PyCFunction)pytalloc_total_blocks, METH_VARARGS, "return talloc block count"}, - { NULL } + {0} }; /** diff -Nru talloc-2.3.1/pytalloc.h talloc-2.3.3/pytalloc.h --- talloc-2.3.1/pytalloc.h 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/pytalloc.h 2021-03-24 11:48:55.000000000 +0000 @@ -3,18 +3,22 @@ Samba utility functions Copyright (C) Jelmer Vernooij 2008 - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . */ #ifndef _PYTALLOC_H_ @@ -30,37 +34,37 @@ } pytalloc_Object; /* Return the PyTypeObject for pytalloc_Object. Returns a borrowed reference. */ -PyTypeObject *pytalloc_GetObjectType(void); +_PUBLIC_ PyTypeObject *pytalloc_GetObjectType(void); /* Return the PyTypeObject for pytalloc_BaseObject. Returns a borrowed reference. */ -PyTypeObject *pytalloc_GetBaseObjectType(void); +_PUBLIC_ PyTypeObject *pytalloc_GetBaseObjectType(void); /* Check whether a specific object is a talloc Object. */ -int pytalloc_Check(PyObject *); +_PUBLIC_ int pytalloc_Check(PyObject *); -int pytalloc_BaseObject_check(PyObject *); +_PUBLIC_ int pytalloc_BaseObject_check(PyObject *); -int _pytalloc_check_type(PyObject *py_obj, const char *type_name); +_PUBLIC_ int _pytalloc_check_type(PyObject *py_obj, const char *type_name); #define pytalloc_check_type(py_obj, type) \ _pytalloc_check_type((PyObject *)(py_obj), #type) /* Retrieve the pointer for a pytalloc_object. Like talloc_get_type() * but for pytalloc_Objects. */ -void *_pytalloc_get_type(PyObject *py_obj, const char *type_name); +_PUBLIC_ void *_pytalloc_get_type(PyObject *py_obj, const char *type_name); #define pytalloc_get_type(py_obj, type) ((type *)_pytalloc_get_type((PyObject *)(py_obj), #type)) -void *_pytalloc_get_ptr(PyObject *py_obj); +_PUBLIC_ void *_pytalloc_get_ptr(PyObject *py_obj); #define pytalloc_get_ptr(py_obj) _pytalloc_get_ptr((PyObject *)(py_obj)) -TALLOC_CTX *_pytalloc_get_mem_ctx(PyObject *py_obj); +_PUBLIC_ TALLOC_CTX *_pytalloc_get_mem_ctx(PyObject *py_obj); #define pytalloc_get_mem_ctx(py_obj) _pytalloc_get_mem_ctx((PyObject *)(py_obj)) -const char *_pytalloc_get_name(PyObject *py_obj); +_PUBLIC_ const char *_pytalloc_get_name(PyObject *py_obj); #define pytalloc_get_name(py_obj) _pytalloc_get_name((PyObject *)(py_obj)) -PyObject *pytalloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); -PyObject *pytalloc_steal(PyTypeObject *py_type, void *ptr); -PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); +_PUBLIC_ PyObject *pytalloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); +_PUBLIC_ PyObject *pytalloc_steal(PyTypeObject *py_type, void *ptr); +_PUBLIC_ PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); #define pytalloc_reference(py_type, talloc_ptr) pytalloc_reference_ex(py_type, talloc_ptr, talloc_ptr) #define pytalloc_new(type, typeobj) pytalloc_steal(typeobj, talloc_zero(NULL, type)) @@ -69,15 +73,15 @@ * Wrap a generic talloc pointer into a talloc.GenericObject, * this is a subclass of talloc.BaseObject. */ -PyObject *pytalloc_GenericObject_steal_ex(TALLOC_CTX *mem_ctx, void *ptr); +_PUBLIC_ PyObject *pytalloc_GenericObject_steal_ex(TALLOC_CTX *mem_ctx, void *ptr); #define pytalloc_GenericObject_steal(talloc_ptr) \ pytalloc_GenericObject_steal_ex(talloc_ptr, talloc_ptr) -PyObject *pytalloc_GenericObject_reference_ex(TALLOC_CTX *mem_ctx, void *ptr); +_PUBLIC_ PyObject *pytalloc_GenericObject_reference_ex(TALLOC_CTX *mem_ctx, void *ptr); #define pytalloc_GenericObject_reference(talloc_ptr) \ pytalloc_GenericObject_reference_ex(talloc_ptr, talloc_ptr) -size_t pytalloc_BaseObject_size(void); +_PUBLIC_ size_t pytalloc_BaseObject_size(void); -int pytalloc_BaseObject_PyType_Ready(PyTypeObject *type); +_PUBLIC_ int pytalloc_BaseObject_PyType_Ready(PyTypeObject *type); #endif /* _PYTALLOC_H_ */ diff -Nru talloc-2.3.1/pytalloc_util.c talloc-2.3.3/pytalloc_util.c --- talloc-2.3.1/pytalloc_util.c 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/pytalloc_util.c 2021-03-24 11:48:55.000000000 +0000 @@ -3,18 +3,22 @@ Python/Talloc glue Copyright (C) Jelmer Vernooij 2008 - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . */ #include diff -Nru talloc-2.3.1/talloc.c talloc-2.3.3/talloc.c --- talloc-2.3.1/talloc.c 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/talloc.c 2020-11-20 10:22:42.000000000 +0000 @@ -54,11 +54,6 @@ #include #endif -/* use this to force every realloc to change the pointer, to stress test - code that might not cope */ -#define ALWAYS_REALLOC 0 - - #define MAX_TALLOC_SIZE 0x10000000 #define TALLOC_FLAG_FREE 0x01 @@ -392,7 +387,13 @@ } #ifdef HAVE_CONSTRUCTOR_ATTRIBUTE -void talloc_lib_init(void) __attribute__((constructor)); +#define CONSTRUCTOR __attribute__((constructor)) +#elif defined(HAVE_PRAGMA_INIT) +#define CONSTRUCTOR +#pragma init (talloc_lib_init) +#endif +#if defined(HAVE_CONSTRUCTOR_ATTRIBUTE) || defined(HAVE_PRAGMA_INIT) +void talloc_lib_init(void) CONSTRUCTOR; void talloc_lib_init(void) { uint32_t random_value; @@ -1438,6 +1439,8 @@ remove a specific parent context from a pointer. This is a more controlled variant of talloc_free() */ + +/* coverity[ -tainted_data_sink : arg-1 ] */ _PUBLIC_ int talloc_unlink(const void *context, void *ptr) { struct talloc_chunk *tc_p, *new_p, *tc_c; @@ -1831,19 +1834,11 @@ return NULL; } - if (tc->limit && (size > tc->size)) { - if (!talloc_memlimit_check(tc->limit, (size - tc->size))) { - errno = ENOMEM; - return NULL; - } - } - /* handle realloc inside a talloc_pool */ if (unlikely(tc->flags & TALLOC_FLAG_POOLMEM)) { pool_hdr = tc->pool; } -#if (ALWAYS_REALLOC == 0) /* don't shrink if we have less than 1k to gain */ if (size < tc->size && tc->limit == NULL) { if (pool_hdr) { @@ -1877,7 +1872,6 @@ */ return ptr; } -#endif /* * by resetting magic we catch users of the old memory @@ -1896,32 +1890,6 @@ */ _talloc_chunk_set_free(tc, NULL); -#if ALWAYS_REALLOC - if (pool_hdr) { - new_ptr = tc_alloc_pool(tc, size + TC_HDR_SIZE, 0); - pool_hdr->object_count--; - - if (new_ptr == NULL) { - new_ptr = malloc(TC_HDR_SIZE+size); - malloced = true; - new_size = size; - } - - if (new_ptr) { - memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); - TC_INVALIDATE_FULL_CHUNK(tc); - } - } else { - /* We're doing malloc then free here, so record the difference. */ - old_size = tc->size; - new_size = size; - new_ptr = malloc(size + TC_HDR_SIZE); - if (new_ptr) { - memcpy(new_ptr, tc, MIN(tc->size, size) + TC_HDR_SIZE); - free(tc); - } - } -#else if (pool_hdr) { struct talloc_chunk *pool_tc; void *next_tc = tc_next_chunk(tc); @@ -2018,6 +1986,25 @@ new_ptr = tc_alloc_pool(tc, size + TC_HDR_SIZE, 0); if (new_ptr == NULL) { + /* + * Couldn't allocate from pool (pool size + * counts as already allocated for memlimit + * purposes). We must check memory limit + * before any real malloc. + */ + if (tc->limit) { + /* + * Note we're doing an extra malloc, + * on top of the pool size, so account + * for size only, not the difference + * between old and new size. + */ + if (!talloc_memlimit_check(tc->limit, size)) { + _talloc_chunk_set_not_free(tc); + errno = ENOMEM; + return NULL; + } + } new_ptr = malloc(TC_HDR_SIZE+size); malloced = true; new_size = size; @@ -2033,10 +2020,22 @@ /* We're doing realloc here, so record the difference. */ old_size = tc->size; new_size = size; + /* + * We must check memory limit + * before any real realloc. + */ + if (tc->limit && (size > old_size)) { + if (!talloc_memlimit_check(tc->limit, + (size - old_size))) { + _talloc_chunk_set_not_free(tc); + errno = ENOMEM; + return NULL; + } + } new_ptr = realloc(tc, size + TC_HDR_SIZE); } got_new_ptr: -#endif + if (unlikely(!new_ptr)) { /* * Ok, this is a strange spot. We have to put back diff -Nru talloc-2.3.1/talloc.h talloc-2.3.3/talloc.h --- talloc-2.3.1/talloc.h 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/talloc.h 2020-11-20 10:22:42.000000000 +0000 @@ -33,6 +33,19 @@ extern "C" { #endif +/* for old gcc releases that don't have the feature test macro __has_attribute */ +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + +#ifndef _PUBLIC_ +#if __has_attribute(visibility) +#define _PUBLIC_ __attribute__((visibility("default"))) +#else +#define _PUBLIC_ +#endif +#endif + /** * @defgroup talloc The talloc API * @@ -45,10 +58,10 @@ #define TALLOC_VERSION_MAJOR 2 #define TALLOC_VERSION_MINOR 3 -int talloc_version_major(void); -int talloc_version_minor(void); +_PUBLIC_ int talloc_version_major(void); +_PUBLIC_ int talloc_version_minor(void); /* This is mostly useful only for testing */ -int talloc_test_get_magic(void); +_PUBLIC_ int talloc_test_get_magic(void); /** * @brief Define a talloc parent type @@ -90,7 +103,7 @@ #endif #ifndef PRINTF_ATTRIBUTE -#if (__GNUC__ >= 3) +#if __has_attribute(format) || (__GNUC__ >= 3) /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first * argument. Note that some gcc 2.x versions don't handle this @@ -102,7 +115,7 @@ #endif #ifndef _DEPRECATED_ -#ifdef HAVE___ATTRIBUTE__ +#if __has_attribute(deprecated) || (__GNUC__ >= 3) #define _DEPRECATED_ __attribute__ ((deprecated)) #else #define _DEPRECATED_ @@ -143,10 +156,10 @@ * @see talloc_steal * @see talloc_free */ -void *talloc(const void *ctx, #type); +_PUBLIC_ void *talloc(const void *ctx, #type); #else #define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) -void *_talloc(const void *context, size_t size); +_PUBLIC_ void *_talloc(const void *context, size_t size); #endif /** @@ -166,7 +179,7 @@ * * @see talloc_named() */ -void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); +_PUBLIC_ void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); #ifdef DOXYGEN /** @@ -231,10 +244,10 @@ * @see talloc_set_destructor() * @see talloc_unlink() */ -int talloc_free(void *ptr); +_PUBLIC_ int talloc_free(void *ptr); #else #define talloc_free(ctx) _talloc_free(ctx, __location__) -int _talloc_free(void *ptr, const char *location); +_PUBLIC_ int _talloc_free(void *ptr, const char *location); #endif /** @@ -248,7 +261,7 @@ * @param[in] ptr The chunk that you want to free the children of * (NULL is allowed too) */ -void talloc_free_children(void *ptr); +_PUBLIC_ void talloc_free_children(void *ptr); #ifdef DOXYGEN /** @@ -304,7 +317,7 @@ * @see talloc() * @see talloc_free() */ -void talloc_set_destructor(const void *ptr, int (*destructor)(void *)); +_PUBLIC_ void talloc_set_destructor(const void *ptr, int (*destructor)(void *)); /** * @brief Change a talloc chunk's parent. @@ -344,7 +357,7 @@ * if you are not careful with talloc_steal(). No guarantees are provided * as to your sanity or the safety of your data if you do this. */ -void *talloc_steal(const void *new_ctx, const void *ptr); +_PUBLIC_ void *talloc_steal(const void *new_ctx, const void *ptr); #else /* DOXYGEN */ /* try to make talloc_set_destructor() and talloc_steal() type safe, if we have a recent gcc */ @@ -364,8 +377,8 @@ #define _TALLOC_TYPEOF(ptr) void * #define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__) #endif /* __GNUC__ >= 3 */ -void _talloc_set_destructor(const void *ptr, int (*_destructor)(void *)); -void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location); +_PUBLIC_ void _talloc_set_destructor(const void *ptr, int (*_destructor)(void *)); +_PUBLIC_ void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location); #endif /* DOXYGEN */ /** @@ -398,7 +411,7 @@ * releasing the name. All of the memory is released when the ptr is freed * using talloc_free(). */ -const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +_PUBLIC_ const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); #ifdef DOXYGEN /** @@ -421,10 +434,10 @@ * It does not have any failure modes. * */ -void *talloc_move(const void *new_ctx, void **pptr); +_PUBLIC_ void *talloc_move(const void *new_ctx, void **pptr); #else #define talloc_move(ctx, pptr) (_TALLOC_TYPEOF(*(pptr)))_talloc_move((ctx),(void *)(pptr)) -void *_talloc_move(const void *new_ctx, const void *pptr); +_PUBLIC_ void *_talloc_move(const void *new_ctx, const void *pptr); #endif /** @@ -443,7 +456,7 @@ * * @param[in] name Format string for the name. */ -void talloc_set_name_const(const void *ptr, const char *name); +_PUBLIC_ void talloc_set_name_const(const void *ptr, const char *name); /** * @brief Create a named talloc chunk. @@ -468,7 +481,7 @@ * * @see talloc_set_name() */ -void *talloc_named(const void *context, size_t size, +_PUBLIC_ void *talloc_named(const void *context, size_t size, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); /** @@ -489,7 +502,7 @@ * * @return The allocated memory chunk, NULL on error. */ -void *talloc_named_const(const void *context, size_t size, const char *name); +_PUBLIC_ void *talloc_named_const(const void *context, size_t size, const char *name); #ifdef DOXYGEN /** @@ -512,7 +525,7 @@ * void *mem = talloc_size(NULL, 100); * @endcode */ -void *talloc_size(const void *ctx, size_t size); +_PUBLIC_ void *talloc_size(const void *ctx, size_t size); #else #define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__) #endif @@ -539,7 +552,7 @@ * unsigned int *a = talloc_ptrtype(NULL, a); * @endcode */ -void *talloc_ptrtype(const void *ctx, #type); +_PUBLIC_ void *talloc_ptrtype(const void *ctx, #type); #else #define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr))) #endif @@ -557,7 +570,7 @@ * * @return A new talloc chunk, NULL on error. */ -void *talloc_new(const void *ctx); +_PUBLIC_ void *talloc_new(const void *ctx); #else #define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__) #endif @@ -591,7 +604,7 @@ * @see talloc_zero_size() * @see talloc_zero_array() */ -void *talloc_zero(const void *ctx, #type); +_PUBLIC_ void *talloc_zero(const void *ctx, #type); /** * @brief Allocate untyped, 0-initialized memory. @@ -602,11 +615,11 @@ * * @return The allocated memory chunk. */ -void *talloc_zero_size(const void *ctx, size_t size); +_PUBLIC_ void *talloc_zero_size(const void *ctx, size_t size); #else #define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) #define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__) -void *_talloc_zero(const void *ctx, size_t size, const char *name); +_PUBLIC_ void *_talloc_zero(const void *ctx, size_t size, const char *name); #endif /** @@ -618,7 +631,7 @@ * * @see talloc_set_name() */ -const char *talloc_get_name(const void *ptr); +_PUBLIC_ const char *talloc_get_name(const void *ptr); /** * @brief Verify that a talloc chunk carries a specified name. @@ -632,7 +645,7 @@ * * @return The pointer if the name matches, NULL if it doesn't. */ -void *talloc_check_name(const void *ptr, const char *name); +_PUBLIC_ void *talloc_check_name(const void *ptr, const char *name); /** * @brief Get the parent chunk of a pointer. @@ -641,7 +654,7 @@ * * @return The talloc parent of ptr, NULL on error. */ -void *talloc_parent(const void *ptr); +_PUBLIC_ void *talloc_parent(const void *ptr); /** * @brief Get a talloc chunk's parent name. @@ -650,7 +663,7 @@ * * @return The name of ptr's parent chunk. */ -const char *talloc_parent_name(const void *ptr); +_PUBLIC_ const char *talloc_parent_name(const void *ptr); /** * @brief Get the total size of a talloc chunk including its children. @@ -666,7 +679,7 @@ * * @return The total size. */ -size_t talloc_total_size(const void *ptr); +_PUBLIC_ size_t talloc_total_size(const void *ptr); /** * @brief Get the number of talloc chunks hanging off a chunk. @@ -683,7 +696,7 @@ * * @return The total size. */ -size_t talloc_total_blocks(const void *ptr); +_PUBLIC_ size_t talloc_total_blocks(const void *ptr); #ifdef DOXYGEN /** @@ -706,10 +719,10 @@ * * @see talloc_size() */ -void *talloc_memdup(const void *t, const void *p, size_t size); +_PUBLIC_ void *talloc_memdup(const void *t, const void *p, size_t size); #else #define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__) -void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name); +_PUBLIC_ void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name); #endif #ifdef DOXYGEN @@ -730,7 +743,7 @@ * * @param[in] type The type to assign. */ -void talloc_set_type(const char *ptr, #type); +_PUBLIC_ void talloc_set_type(const char *ptr, #type); /** * @brief Get a typed pointer out of a talloc pointer. @@ -770,14 +783,14 @@ * * @return The same value as ptr, type-checked and properly cast. */ -void *talloc_get_type_abort(const void *ptr, #type); +_PUBLIC_ void *talloc_get_type_abort(const void *ptr, #type); #else #ifdef TALLOC_GET_TYPE_ABORT_NOOP #define talloc_get_type_abort(ptr, type) (type *)(ptr) #else #define talloc_get_type_abort(ptr, type) (type *)_talloc_get_type_abort(ptr, #type, __location__) #endif -void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location); +_PUBLIC_ void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location); #endif /** @@ -795,7 +808,7 @@ * @return The memory context we are looking for, NULL if not * found. */ -void *talloc_find_parent_byname(const void *ctx, const char *name); +_PUBLIC_ void *talloc_find_parent_byname(const void *ctx, const char *name); #ifdef DOXYGEN /** @@ -815,7 +828,7 @@ * @return The memory context we are looking for, NULL if not * found. */ -void *talloc_find_parent_bytype(const void *ptr, #type); +_PUBLIC_ void *talloc_find_parent_bytype(const void *ptr, #type); #else #define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type) #endif @@ -860,7 +873,7 @@ * * @return The allocated talloc pool, NULL on error. */ -void *talloc_pool(const void *context, size_t size); +_PUBLIC_ void *talloc_pool(const void *context, size_t size); #ifdef DOXYGEN /** @@ -882,7 +895,7 @@ * * @return The allocated talloc object, NULL on error. */ -void *talloc_pooled_object(const void *ctx, #type, +_PUBLIC_ void *talloc_pooled_object(const void *ctx, #type, unsigned num_subobjects, size_t total_subobjects_size); #else @@ -892,7 +905,7 @@ (_type *)_talloc_pooled_object((_ctx), sizeof(_type), #_type, \ (_num_subobjects), \ (_total_subobjects_size)) -void *_talloc_pooled_object(const void *ctx, +_PUBLIC_ void *_talloc_pooled_object(const void *ctx, size_t type_size, const char *type_name, unsigned num_subobjects, @@ -937,7 +950,7 @@ * * @return 0 on success, -1 on error. */ -int talloc_increase_ref_count(const void *ptr); +_PUBLIC_ int talloc_increase_ref_count(const void *ptr); /** * @brief Get the number of references to a talloc chunk. @@ -946,7 +959,7 @@ * * @return The number of references. */ -size_t talloc_reference_count(const void *ptr); +_PUBLIC_ size_t talloc_reference_count(const void *ptr); #ifdef DOXYGEN /** @@ -992,10 +1005,10 @@ * * @see talloc_unlink() */ -void *talloc_reference(const void *ctx, const void *ptr); +_PUBLIC_ void *talloc_reference(const void *ctx, const void *ptr); #else #define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference_loc((ctx),(ptr), __location__) -void *_talloc_reference_loc(const void *context, const void *ptr, const char *location); +_PUBLIC_ void *_talloc_reference_loc(const void *context, const void *ptr, const char *location); #endif /** @@ -1035,7 +1048,7 @@ * talloc_unlink(b, c); * @endcode */ -int talloc_unlink(const void *context, void *ptr); +_PUBLIC_ int talloc_unlink(const void *context, void *ptr); /** * @brief Provide a talloc context that is freed at program exit. @@ -1055,7 +1068,7 @@ * * @return A talloc context, NULL on error. */ -void *talloc_autofree_context(void) _DEPRECATED_; +_PUBLIC_ void *talloc_autofree_context(void) _DEPRECATED_; /** * @brief Get the size of a talloc chunk. @@ -1068,7 +1081,7 @@ * * @return The size of the talloc chunk. */ -size_t talloc_get_size(const void *ctx); +_PUBLIC_ size_t talloc_get_size(const void *ctx); /** * @brief Show the parentage of a context. @@ -1077,7 +1090,7 @@ * * @param[in] file The output to use, a file, stdout or stderr. */ -void talloc_show_parents(const void *context, FILE *file); +_PUBLIC_ void talloc_show_parents(const void *context, FILE *file); /** * @brief Check if a context is parent of a talloc chunk. @@ -1090,7 +1103,7 @@ * * @return Return 1 if this is the case, 0 if not. */ -int talloc_is_parent(const void *context, const void *ptr); +_PUBLIC_ int talloc_is_parent(const void *context, const void *ptr); /** * @brief Change the parent context of a talloc pointer. @@ -1110,7 +1123,7 @@ * @return Return the pointer you passed. It does not have any * failure modes. */ -void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr); +_PUBLIC_ void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr); /* @} ******************************************************************/ @@ -1155,10 +1168,10 @@ * @see talloc() * @see talloc_zero_array() */ -void *talloc_array(const void *ctx, #type, unsigned count); +_PUBLIC_ void *talloc_array(const void *ctx, #type, unsigned count); #else #define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) -void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name); +_PUBLIC_ void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name); #endif #ifdef DOXYGEN @@ -1173,7 +1186,7 @@ * * @return The allocated result, NULL on error. */ -void *talloc_array_size(const void *ctx, size_t size, unsigned count); +_PUBLIC_ void *talloc_array_size(const void *ctx, size_t size, unsigned count); #else #define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__) #endif @@ -1240,7 +1253,7 @@ void *talloc_zero_array(const void *ctx, #type, unsigned count); #else #define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type) -void *_talloc_zero_array(const void *ctx, +_PUBLIC_ void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name); @@ -1277,10 +1290,10 @@ * due to a lack of memory, or because the pointer has more * than one parent (see talloc_reference()). */ -void *talloc_realloc(const void *ctx, void *ptr, #type, size_t count); +_PUBLIC_ void *talloc_realloc(const void *ctx, void *ptr, #type, size_t count); #else #define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type) -void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name); +_PUBLIC_ void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name); #endif #ifdef DOXYGEN @@ -1301,7 +1314,7 @@ void *talloc_realloc_size(const void *ctx, void *ptr, size_t size); #else #define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__) -void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name); +_PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name); #endif /** @@ -1321,7 +1334,7 @@ * * @return The new chunk, NULL on error. */ -void *talloc_realloc_fn(const void *context, void *ptr, size_t size); +_PUBLIC_ void *talloc_realloc_fn(const void *context, void *ptr, size_t size); /* @} ******************************************************************/ @@ -1356,7 +1369,7 @@ * * @return The duplicated string, NULL on error. */ -char *talloc_strdup(const void *t, const char *p); +_PUBLIC_ char *talloc_strdup(const void *t, const char *p); /** * @brief Append a string to given string. @@ -1382,7 +1395,7 @@ * @see talloc_strdup() * @see talloc_strdup_append_buffer() */ -char *talloc_strdup_append(char *s, const char *a); +_PUBLIC_ char *talloc_strdup_append(char *s, const char *a); /** * @brief Append a string to a given buffer. @@ -1418,7 +1431,7 @@ * @see talloc_strdup_append() * @see talloc_array_length() */ -char *talloc_strdup_append_buffer(char *s, const char *a); +_PUBLIC_ char *talloc_strdup_append_buffer(char *s, const char *a); /** * @brief Duplicate a length-limited string into a talloc chunk. @@ -1440,7 +1453,7 @@ * * @return The duplicated string, NULL on error. */ -char *talloc_strndup(const void *t, const char *p, size_t n); +_PUBLIC_ char *talloc_strndup(const void *t, const char *p, size_t n); /** * @brief Append at most n characters of a string to given string. @@ -1469,7 +1482,7 @@ * @see talloc_strndup() * @see talloc_strndup_append_buffer() */ -char *talloc_strndup_append(char *s, const char *a, size_t n); +_PUBLIC_ char *talloc_strndup_append(char *s, const char *a, size_t n); /** * @brief Append at most n characters of a string to given buffer @@ -1508,7 +1521,7 @@ * @see talloc_strndup_append() * @see talloc_array_length() */ -char *talloc_strndup_append_buffer(char *s, const char *a, size_t n); +_PUBLIC_ char *talloc_strndup_append_buffer(char *s, const char *a, size_t n); /** * @brief Format a string given a va_list. @@ -1531,7 +1544,7 @@ * * @return The formatted string, NULL on error. */ -char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); +_PUBLIC_ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); /** * @brief Format a string given a va_list and append it to the given destination @@ -1547,7 +1560,7 @@ * * @see talloc_vasprintf() */ -char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); +_PUBLIC_ char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); /** * @brief Format a string given a va_list and append it to the given destination @@ -1563,7 +1576,7 @@ * * @see talloc_vasprintf() */ -char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); +_PUBLIC_ char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); /** * @brief Format a string. @@ -1585,7 +1598,7 @@ * * @return The formatted string, NULL on error. */ -char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +_PUBLIC_ char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); /** * @brief Append a formatted string to another string. @@ -1611,7 +1624,7 @@ * * @return The formatted string, NULL on error. */ -char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +_PUBLIC_ char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); /** * @brief Append a formatted string to another string. @@ -1648,7 +1661,7 @@ * @see talloc_asprintf() * @see talloc_asprintf_append() */ -char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +_PUBLIC_ char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); /* @} ******************************************************************/ @@ -1688,7 +1701,7 @@ * * @param[in] private_data Private pointer passed to callback. */ -void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, +_PUBLIC_ void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, void (*callback)(const void *ptr, int depth, int max_depth, int is_ref, @@ -1709,7 +1722,7 @@ * * @param[in] f The file handle to print to. */ -void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f); +_PUBLIC_ void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f); /** * @brief Print a summary report of all memory used by ptr. @@ -1739,7 +1752,7 @@ * * @see talloc_report() */ -void talloc_report_full(const void *ptr, FILE *f); +_PUBLIC_ void talloc_report_full(const void *ptr, FILE *f); /** * @brief Print a summary report of all memory used by ptr. @@ -1767,7 +1780,7 @@ * * @see talloc_report_full() */ -void talloc_report(const void *ptr, FILE *f); +_PUBLIC_ void talloc_report(const void *ptr, FILE *f); /** * @brief Enable tracking the use of NULL memory contexts. @@ -1776,7 +1789,7 @@ * reporting on exit. Useful for when you want to do your own leak * reporting call via talloc_report_null_full(); */ -void talloc_enable_null_tracking(void); +_PUBLIC_ void talloc_enable_null_tracking(void); /** * @brief Enable tracking the use of NULL memory contexts. @@ -1785,14 +1798,14 @@ * reporting on exit. Useful for when you want to do your own leak * reporting call via talloc_report_null_full(); */ -void talloc_enable_null_tracking_no_autofree(void); +_PUBLIC_ void talloc_enable_null_tracking_no_autofree(void); /** * @brief Disable tracking of the NULL memory context. * * This disables tracking of the NULL memory context. */ -void talloc_disable_null_tracking(void); +_PUBLIC_ void talloc_disable_null_tracking(void); /** * @brief Enable leak report when a program exits. @@ -1820,7 +1833,7 @@ * iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks * @endcode */ -void talloc_enable_leak_report(void); +_PUBLIC_ void talloc_enable_leak_report(void); /** * @brief Enable full leak report when a program exits. @@ -1848,7 +1861,7 @@ * x1 contains 1 bytes in 1 blocks (ref 0) * @endcode */ -void talloc_enable_leak_report_full(void); +_PUBLIC_ void talloc_enable_leak_report_full(void); /** * @brief Set a custom "abort" function that is called on serious error. @@ -1881,7 +1894,7 @@ * @see talloc_set_log_fn() * @see talloc_get_type() */ -void talloc_set_abort_fn(void (*abort_fn)(const char *reason)); +_PUBLIC_ void talloc_set_abort_fn(void (*abort_fn)(const char *reason)); /** * @brief Set a logging function. @@ -1891,7 +1904,7 @@ * @see talloc_set_log_stderr() * @see talloc_set_abort_fn() */ -void talloc_set_log_fn(void (*log_fn)(const char *message)); +_PUBLIC_ void talloc_set_log_fn(void (*log_fn)(const char *message)); /** * @brief Set stderr as the output for logs. @@ -1899,7 +1912,7 @@ * @see talloc_set_log_fn() * @see talloc_set_abort_fn() */ -void talloc_set_log_stderr(void); +_PUBLIC_ void talloc_set_log_stderr(void); /** * @brief Set a max memory limit for the current context hierarchy @@ -1921,7 +1934,7 @@ * @param[in] ctx The talloc context to set the limit on * @param[in] max_size The (new) max_size */ -int talloc_set_memlimit(const void *ctx, size_t max_size) _DEPRECATED_; +_PUBLIC_ int talloc_set_memlimit(const void *ctx, size_t max_size) _DEPRECATED_; /* @} ******************************************************************/ diff -Nru talloc-2.3.1/test_pytalloc.c talloc-2.3.3/test_pytalloc.c --- talloc-2.3.1/test_pytalloc.c 2019-12-10 11:01:31.000000000 +0000 +++ talloc-2.3.3/test_pytalloc.c 2020-07-02 08:55:34.000000000 +0000 @@ -95,7 +95,7 @@ "call pytalloc_reference_ex"}, { "base_reference", (PyCFunction)testpytalloc_base_reference, METH_VARARGS, "call pytalloc_reference_ex"}, - { NULL } + {0} }; static PyTypeObject DObject_Type; diff -Nru talloc-2.3.1/testsuite.c talloc-2.3.3/testsuite.c --- talloc-2.3.1/testsuite.c 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/testsuite.c 2020-11-20 10:22:42.000000000 +0000 @@ -1307,7 +1307,6 @@ p4 = talloc_size(p3, 1000); memset(p4, 0x11, talloc_get_size(p4)); -#if 1 /* this relies on ALWAYS_REALLOC == 0 in talloc.c */ p2_2 = talloc_realloc_size(pool, p2, 20+1); torture_assert("pool realloc 20+1", p2_2 == p2, "failed: pointer changed"); memset(p2, 0x11, talloc_get_size(p2)); @@ -1372,8 +1371,6 @@ torture_assert("pool alloc 800", p3 == p1, "failed: pointer changed"); memset(p3, 0x11, talloc_get_size(p3)); -#endif /* this relies on ALWAYS_REALLOC == 0 in talloc.c */ - talloc_free(pool); return true; @@ -1408,7 +1405,6 @@ p1_2 = p1; -#if 1 /* this relies on ALWAYS_REALLOC == 0 in talloc.c */ p1_2 = talloc_realloc_size(root, p1, 5 * 16); torture_assert("pool realloc 5 * 16", p1_2 > p2, "failed: pointer not changed"); memset(p1_2, 0x11, talloc_get_size(p1_2)); @@ -1420,13 +1416,11 @@ p2_2 = talloc_realloc_size(root, p2, 3 * 16); torture_assert("pool realloc 5 * 16", p2_2 == p2, "failed: pointer changed"); memset(p2_2, 0x11, talloc_get_size(p2_2)); -#endif /* this relies on ALWAYS_REALLOC == 0 in talloc.c */ talloc_free(p1_2); p2_2 = p2; -#if 1 /* this relies on ALWAYS_REALLOC == 0 in talloc.c */ /* now we should reclaim the full pool */ p2_2 = talloc_realloc_size(root, p2, 8 * 16); torture_assert("pool realloc 8 * 16", p2_2 == p1, "failed: pointer not expected"); @@ -1438,8 +1432,6 @@ torture_assert("pool realloc 2 * 1024", p2_2 != p1, "failed: pointer not expected"); memset(p2_2, 0x11, talloc_get_size(p2_2)); -#endif /* this relies on ALWAYS_REALLOC == 0 in talloc.c */ - talloc_free(p2_2); talloc_free(root); @@ -1767,28 +1759,145 @@ talloc_free(root); /* Test memlimits with pools. */ + printf("==== talloc_pool(NULL, 10*1024)\n"); pool = talloc_pool(NULL, 10*1024); torture_assert("memlimit", pool != NULL, "failed: alloc should not fail due to memory limit\n"); + + printf("==== talloc_set_memlimit(pool, 10*1024)\n"); talloc_set_memlimit(pool, 10*1024); for (i = 0; i < 9; i++) { + printf("==== talloc_size(pool, 1024) %i/10\n", i + 1); l1 = talloc_size(pool, 1024); torture_assert("memlimit", l1 != NULL, "failed: alloc should not fail due to memory limit\n"); + talloc_report_full(pool, stdout); } /* The next alloc should fail. */ + printf("==== talloc_size(pool, 1024) 10/10\n"); l2 = talloc_size(pool, 1024); torture_assert("memlimit", l2 == NULL, "failed: alloc should fail due to memory limit\n"); + talloc_report_full(pool, stdout); + /* Moving one of the children shouldn't change the limit, as it's still inside the pool. */ + + printf("==== talloc_new(NULL)\n"); root = talloc_new(NULL); + + printf("==== talloc_steal(root, l1)\n"); talloc_steal(root, l1); + + printf("==== talloc_size(pool, 1024)\n"); l2 = talloc_size(pool, 1024); torture_assert("memlimit", l2 == NULL, "failed: alloc should fail due to memory limit\n"); + printf("==== talloc_free_children(pool)\n"); + talloc_free(l1); + talloc_free_children(pool); + + printf("==== talloc_size(pool, 1024)\n"); + l1 = talloc_size(pool, 1024); + + /* try reallocs of increasing size */ + for (i = 1; i < 9; i++) { + printf("==== talloc_realloc_size(NULL, l1, %i*1024) %i/10\n", i, i + 1); + l1 = talloc_realloc_size(NULL, l1, i*1024); + torture_assert("memlimit", l1 != NULL, + "failed: realloc should not fail due to memory limit\n"); + talloc_report_full(pool, stdout); + } + /* The next alloc should fail. */ + printf("==== talloc_realloc_size(NULL, l1, 10*1024) 10/10\n"); + l2 = talloc_realloc_size(NULL, l1, 10*1024); + torture_assert("memlimit", l2 == NULL, + "failed: realloc should fail due to memory limit\n"); + + /* Increase the memlimit */ + printf("==== talloc_set_memlimit(pool, 11*1024)\n"); + talloc_set_memlimit(pool, 11*1024); + + /* The final realloc should still fail + as the entire realloced chunk needs to be moved out of the pool */ + printf("==== talloc_realloc_size(NULL, l1, 10*1024) 10/10\n"); + l2 = talloc_realloc_size(NULL, l1, 10*1024); + torture_assert("memlimit", l2 == NULL, + "failed: realloc should fail due to memory limit\n"); + + talloc_report_full(pool, stdout); + + printf("==== talloc_set_memlimit(pool, 21*1024)\n"); + talloc_set_memlimit(pool, 21*1024); + + /* There's now sufficient space to move the chunk out of the pool */ + printf("==== talloc_realloc_size(NULL, l1, 10*1024) 10/10\n"); + l2 = talloc_realloc_size(NULL, l1, 10*1024); + torture_assert("memlimit", l2 != NULL, + "failed: realloc should not fail due to memory limit\n"); + + talloc_report_full(pool, stdout); + + /* ...which should mean smaller allocations can now occur within the pool */ + printf("==== talloc_size(pool, 9*1024)\n"); + l1 = talloc_size(pool, 9*1024); + torture_assert("memlimit", l1 != NULL, + "failed: new allocations should be allowed in the pool\n"); + + talloc_report_full(pool, stdout); + + /* But reallocs bigger than the pool will still fail */ + printf("==== talloc_realloc_size(NULL, l1, 10*1024)\n"); + l2 = talloc_realloc_size(NULL, l1, 10*1024); + torture_assert("memlimit", l2 == NULL, + "failed: realloc should fail due to memory limit\n"); + + talloc_report_full(pool, stdout); + + /* ..as well as allocs */ + printf("==== talloc_size(pool, 1024)\n"); + l1 = talloc_size(pool, 1024); + torture_assert("memlimit", l1 == NULL, + "failed: alloc should fail due to memory limit\n"); + + talloc_report_full(pool, stdout); + + printf("==== talloc_free_children(pool)\n"); + talloc_free_children(pool); + + printf("==== talloc_set_memlimit(pool, 1024)\n"); + talloc_set_memlimit(pool, 1024); + + /* We should still be able to allocate up to the pool limit + because the memlimit only applies to new heap allocations */ + printf("==== talloc_size(pool, 9*1024)\n"); + l1 = talloc_size(pool, 9*1024); + torture_assert("memlimit", l1 != NULL, + "failed: alloc should not fail due to memory limit\n"); + + talloc_report_full(pool, stdout); + + l1 = talloc_size(pool, 1024); + torture_assert("memlimit", l1 == NULL, + "failed: alloc should fail due to memory limit\n"); + + talloc_report_full(pool, stdout); + + printf("==== talloc_free_children(pool)\n"); + talloc_free_children(pool); + + printf("==== talloc_set_memlimit(pool, 10*1024)\n"); + talloc_set_memlimit(pool, 10*1024); + + printf("==== talloc_size(pool, 1024)\n"); + l1 = talloc_size(pool, 1024); + torture_assert("memlimit", l1 != NULL, + "failed: alloc should not fail due to memory limit\n"); + + talloc_report_full(pool, stdout); + talloc_free(pool); talloc_free(root); printf("success: memlimit\n"); diff -Nru talloc-2.3.1/third_party/waf/waflib/Build.py talloc-2.3.3/third_party/waf/waflib/Build.py --- talloc-2.3.1/third_party/waf/waflib/Build.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Build.py 2020-12-18 10:02:37.000000000 +0000 @@ -753,10 +753,12 @@ else: ln = self.launch_node() if ln.is_child_of(self.bldnode): - Logs.warn('Building from the build directory, forcing --targets=*') + if Logs.verbose > 1: + Logs.warn('Building from the build directory, forcing --targets=*') ln = self.srcnode elif not ln.is_child_of(self.srcnode): - Logs.warn('CWD %s is not under %s, forcing --targets=* (run distclean?)', ln.abspath(), self.srcnode.abspath()) + if Logs.verbose > 1: + Logs.warn('CWD %s is not under %s, forcing --targets=* (run distclean?)', ln.abspath(), self.srcnode.abspath()) ln = self.srcnode def is_post(tg, ln): diff -Nru talloc-2.3.1/third_party/waf/waflib/Configure.py talloc-2.3.3/third_party/waf/waflib/Configure.py --- talloc-2.3.1/third_party/waf/waflib/Configure.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Configure.py 2020-09-10 09:37:12.000000000 +0000 @@ -508,23 +508,27 @@ @conf def run_build(self, *k, **kw): """ - Create a temporary build context to execute a build. A reference to that build - context is kept on self.test_bld for debugging purposes, and you should not rely - on it too much (read the note on the cache below). - The parameters given in the arguments to this function are passed as arguments for - a single task generator created in the build. Only three parameters are obligatory: + Create a temporary build context to execute a build. A temporary reference to that build + context is kept on self.test_bld for debugging purposes. + The arguments to this function are passed to a single task generator for that build. + Only three parameters are mandatory: :param features: features to pass to a task generator created in the build :type features: list of string :param compile_filename: file to create for the compilation (default: *test.c*) :type compile_filename: string - :param code: code to write in the filename to compile + :param code: input file contents :type code: string - Though this function returns *0* by default, the build may set an attribute named *retval* on the + Though this function returns *0* by default, the build may bind attribute named *retval* on the build context object to return a particular value. See :py:func:`waflib.Tools.c_config.test_exec_fun` for example. - This function also features a cache which can be enabled by the following option:: + The temporary builds creates a temporary folder; the name of that folder is calculated + by hashing input arguments to this function, with the exception of :py:class:`waflib.ConfigSet.ConfigSet` + objects which are used for both reading and writing values. + + This function also features a cache which is disabled by default; that cache relies + on the hash value calculated as indicated above:: def options(opt): opt.add_option('--confcache', dest='confcache', default=0, @@ -538,7 +542,10 @@ buf = [] for key in sorted(kw.keys()): v = kw[key] - if hasattr(v, '__call__'): + if isinstance(v, ConfigSet.ConfigSet): + # values are being written to, so they are excluded from contributing to the hash + continue + elif hasattr(v, '__call__'): buf.append(Utils.h_fun(v)) else: buf.append(str(v)) diff -Nru talloc-2.3.1/third_party/waf/waflib/Context.py talloc-2.3.3/third_party/waf/waflib/Context.py --- talloc-2.3.1/third_party/waf/waflib/Context.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Context.py 2020-12-18 10:02:37.000000000 +0000 @@ -6,20 +6,30 @@ Classes and functions enabling the command system """ -import os, re, imp, sys +import os, re, sys from waflib import Utils, Errors, Logs import waflib.Node +if sys.hexversion > 0x3040000: + import types + class imp(object): + new_module = lambda x: types.ModuleType(x) +else: + import imp + # the following 3 constants are updated on each new release (do not touch) -HEXVERSION=0x2001200 +HEXVERSION=0x2001500 """Constant updated on new releases""" -WAFVERSION="2.0.18" +WAFVERSION="2.0.21" """Constant updated on new releases""" -WAFREVISION="314689b8994259a84f0de0aaef74d7ce91f541ad" +WAFREVISION="edde20a6425a5c3eb6b47d5f3f5c4fbc93fed5f4" """Git revision when the waf version is updated""" +WAFNAME="waf" +"""Application name displayed on --help""" + ABI = 20 """Version of the build data cache file format (used in :py:const:`waflib.Context.DBFILE`)""" @@ -520,7 +530,7 @@ """ Prints a configuration message of the form ``msg: result``. The second part of the message will be in colors. The output - can be disabled easly by setting ``in_msg`` to a positive value:: + can be disabled easily by setting ``in_msg`` to a positive value:: def configure(conf): self.in_msg = 1 diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/boost.py talloc-2.3.3/third_party/waf/waflib/extras/boost.py --- talloc-2.3.1/third_party/waf/waflib/extras/boost.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/boost.py 2020-12-18 10:02:37.000000000 +0000 @@ -270,10 +270,12 @@ return file return None + # extensions from Tools.ccroot.lib_patterns + wo_ext = re.compile(r"\.(a|so|lib|dll|dylib)(\.[0-9\.]+)?$") def format_lib_name(name): if name.startswith('lib') and self.env.CC_NAME != 'msvc': name = name[3:] - return name[:name.rfind('.')] + return wo_ext.sub("", name) def match_libs(lib_names, is_static): libs = [] @@ -522,4 +524,3 @@ except: continue install_boost.done = False - diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/c_dumbpreproc.py talloc-2.3.3/third_party/waf/waflib/extras/c_dumbpreproc.py --- talloc-2.3.1/third_party/waf/waflib/extras/c_dumbpreproc.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/c_dumbpreproc.py 2020-12-18 10:02:37.000000000 +0000 @@ -66,7 +66,7 @@ if x == c_preproc.POPFILE: self.currentnode_stack.pop() continue - self.tryfind(y) + self.tryfind(y, env=env) c_preproc.c_parser = dumb_parser diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/clang_compilation_database.py talloc-2.3.3/third_party/waf/waflib/extras/clang_compilation_database.py --- talloc-2.3.1/third_party/waf/waflib/extras/clang_compilation_database.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/clang_compilation_database.py 2020-09-10 09:37:12.000000000 +0000 @@ -1,6 +1,7 @@ #!/usr/bin/env python # encoding: utf-8 # Christoph Koke, 2013 +# Alibek Omarov, 2019 """ Writes the c and cpp compile commands into build/compile_commands.json @@ -8,14 +9,23 @@ Usage: - def configure(conf): - conf.load('compiler_cxx') - ... - conf.load('clang_compilation_database') + Load this tool in `options` to be able to generate database + by request in command-line and before build: + + $ waf clangdb + + def options(opt): + opt.load('clang_compilation_database') + + Otherwise, load only in `configure` to generate it always before build. + + def configure(conf): + conf.load('compiler_cxx') + ... + conf.load('clang_compilation_database') """ -import sys, os, json, shlex, pipes -from waflib import Logs, TaskGen, Task +from waflib import Logs, TaskGen, Task, Build, Scripting Task.Task.keep_last_cmd = True @@ -23,63 +33,103 @@ @TaskGen.after_method('process_use') def collect_compilation_db_tasks(self): "Add a compilation database entry for compiled tasks" - try: - clang_db = self.bld.clang_compilation_database_tasks - except AttributeError: - clang_db = self.bld.clang_compilation_database_tasks = [] - self.bld.add_post_fun(write_compilation_database) + if not isinstance(self.bld, ClangDbContext): + return tup = tuple(y for y in [Task.classes.get(x) for x in ('c', 'cxx')] if y) for task in getattr(self, 'compiled_tasks', []): if isinstance(task, tup): - clang_db.append(task) + self.bld.clang_compilation_database_tasks.append(task) -def write_compilation_database(ctx): - "Write the clang compilation database as JSON" - database_file = ctx.bldnode.make_node('compile_commands.json') - Logs.info('Build commands will be stored in %s', database_file.path_from(ctx.path)) - try: - root = json.load(database_file) - except IOError: - root = [] - clang_db = dict((x['file'], x) for x in root) - for task in getattr(ctx, 'clang_compilation_database_tasks', []): +class ClangDbContext(Build.BuildContext): + '''generates compile_commands.json by request''' + cmd = 'clangdb' + clang_compilation_database_tasks = [] + + def write_compilation_database(self): + """ + Write the clang compilation database as JSON + """ + database_file = self.bldnode.make_node('compile_commands.json') + Logs.info('Build commands will be stored in %s', database_file.path_from(self.path)) try: - cmd = task.last_cmd - except AttributeError: - continue - directory = getattr(task, 'cwd', ctx.variant_dir) - f_node = task.inputs[0] - filename = os.path.relpath(f_node.abspath(), directory) - entry = { - "directory": directory, - "arguments": cmd, - "file": filename, - } - clang_db[filename] = entry - root = list(clang_db.values()) - database_file.write(json.dumps(root, indent=2)) - -# Override the runnable_status function to do a dummy/dry run when the file doesn't need to be compiled. -# This will make sure compile_commands.json is always fully up to date. -# Previously you could end up with a partial compile_commands.json if the build failed. -for x in ('c', 'cxx'): - if x not in Task.classes: - continue - - t = Task.classes[x] - - def runnable_status(self): - def exec_command(cmd, **kw): - pass - - run_status = self.old_runnable_status() - if run_status == Task.SKIP_ME: - setattr(self, 'old_exec_command', getattr(self, 'exec_command', None)) - setattr(self, 'exec_command', exec_command) - self.run() - setattr(self, 'exec_command', getattr(self, 'old_exec_command', None)) - return run_status + root = database_file.read_json() + except IOError: + root = [] + clang_db = dict((x['file'], x) for x in root) + for task in self.clang_compilation_database_tasks: + try: + cmd = task.last_cmd + except AttributeError: + continue + f_node = task.inputs[0] + filename = f_node.path_from(task.get_cwd()) + entry = { + "directory": task.get_cwd().abspath(), + "arguments": cmd, + "file": filename, + } + clang_db[filename] = entry + root = list(clang_db.values()) + database_file.write_json(root) + + def execute(self): + """ + Build dry run + """ + self.restore() + + if not self.all_envs: + self.load_envs() + + self.recurse([self.run_dir]) + self.pre_build() + + # we need only to generate last_cmd, so override + # exec_command temporarily + def exec_command(self, *k, **kw): + return 0 + + for g in self.groups: + for tg in g: + try: + f = tg.post + except AttributeError: + pass + else: + f() + + if isinstance(tg, Task.Task): + lst = [tg] + else: lst = tg.tasks + for tsk in lst: + tup = tuple(y for y in [Task.classes.get(x) for x in ('c', 'cxx')] if y) + if isinstance(tsk, tup): + old_exec = tsk.exec_command + tsk.exec_command = exec_command + tsk.run() + tsk.exec_command = old_exec + + self.write_compilation_database() + +EXECUTE_PATCHED = False +def patch_execute(): + global EXECUTE_PATCHED + + if EXECUTE_PATCHED: + return + + def new_execute_build(self): + """ + Invoke clangdb command before build + """ + if self.cmd.startswith('build'): + Scripting.run_command('clangdb') + + old_execute_build(self) + + old_execute_build = getattr(Build.BuildContext, 'execute_build', None) + setattr(Build.BuildContext, 'execute_build', new_execute_build) + EXECUTE_PATCHED = True - setattr(t, 'old_runnable_status', getattr(t, 'runnable_status', None)) - setattr(t, 'runnable_status', runnable_status) +patch_execute() diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/doxygen.py talloc-2.3.3/third_party/waf/waflib/extras/doxygen.py --- talloc-2.3.1/third_party/waf/waflib/extras/doxygen.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/doxygen.py 2020-12-18 10:02:37.000000000 +0000 @@ -69,6 +69,7 @@ class doxygen(Task.Task): vars = ['DOXYGEN', 'DOXYFLAGS'] color = 'BLUE' + ext_in = [ '.py', '.c', '.h', '.java', '.pb.cc' ] def runnable_status(self): ''' @@ -207,10 +208,10 @@ self.bld.fatal('doxygen file %s not found' % self.doxyfile) # the task instance - dsk = self.create_task('doxygen', node) + dsk = self.create_task('doxygen', node, always_run=getattr(self, 'always', False)) if getattr(self, 'doxy_tar', None): - tsk = self.create_task('tar') + tsk = self.create_task('tar', always_run=getattr(self, 'always', False)) tsk.input_tasks = [dsk] tsk.set_outputs(self.path.find_or_declare(self.doxy_tar)) if self.doxy_tar.endswith('bz2'): diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/file_to_object.py talloc-2.3.3/third_party/waf/waflib/extras/file_to_object.py --- talloc-2.3.1/third_party/waf/waflib/extras/file_to_object.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/file_to_object.py 2020-12-18 10:02:37.000000000 +0000 @@ -31,7 +31,7 @@ """ -import os +import os, sys from waflib import Task, TaskGen, Errors def filename_c_escape(x): @@ -95,12 +95,17 @@ name = "_binary_" + "".join(name) + def char_to_num(ch): + if sys.version_info[0] < 3: + return ord(ch) + return ch + data = self.inputs[0].read('rb') lines, line = [], [] for idx_byte, byte in enumerate(data): line.append(byte) if len(line) > 15 or idx_byte == size-1: - lines.append(", ".join(("0x%02x" % ord(x)) for x in line)) + lines.append(", ".join(("0x%02x" % char_to_num(x)) for x in line)) line = [] data = ",\n ".join(lines) diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/gccdeps.py talloc-2.3.3/third_party/waf/waflib/extras/gccdeps.py --- talloc-2.3.1/third_party/waf/waflib/extras/gccdeps.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/gccdeps.py 2020-12-18 10:02:37.000000000 +0000 @@ -27,7 +27,7 @@ gccdeps_flags = ['-MMD'] # Third-party tools are allowed to add extra names in here with append() -supported_compilers = ['gcc', 'icc', 'clang'] +supported_compilers = ['gas', 'gcc', 'icc', 'clang'] def scan(self): if not self.__class__.__name__ in self.env.ENABLE_GCCDEPS: @@ -163,10 +163,25 @@ def sig_implicit_deps(self): if not self.__class__.__name__ in self.env.ENABLE_GCCDEPS: return super(self.derived_gccdeps, self).sig_implicit_deps() + bld = self.generator.bld + try: - return Task.Task.sig_implicit_deps(self) - except Errors.WafError: - return Utils.SIG_NIL + return self.compute_sig_implicit_deps() + except Errors.TaskNotReady: + raise ValueError("Please specify the build order precisely with gccdeps (asm/c/c++ tasks)") + except EnvironmentError: + # If a file is renamed, assume the dependencies are stale and must be recalculated + for x in bld.node_deps.get(self.uid(), []): + if not x.is_bld() and not x.exists(): + try: + del x.parent.children[x.name] + except KeyError: + pass + + key = self.uid() + bld.node_deps[key] = [] + bld.raw_deps[key] = [] + return Utils.SIG_NIL def wrap_compiled_task(classname): derived_class = type(classname, (Task.classes[classname],), {}) @@ -175,14 +190,14 @@ derived_class.scan = scan derived_class.sig_implicit_deps = sig_implicit_deps -for k in ('c', 'cxx'): +for k in ('asm', 'c', 'cxx'): if k in Task.classes: wrap_compiled_task(k) @before_method('process_source') @feature('force_gccdeps') def force_gccdeps(self): - self.env.ENABLE_GCCDEPS = ['c', 'cxx'] + self.env.ENABLE_GCCDEPS = ['asm', 'c', 'cxx'] def configure(conf): # in case someone provides a --enable-gccdeps command-line option @@ -191,6 +206,15 @@ global gccdeps_flags flags = conf.env.GCCDEPS_FLAGS or gccdeps_flags + if conf.env.ASM_NAME in supported_compilers: + try: + conf.check(fragment='', features='asm force_gccdeps', asflags=flags, compile_filename='test.S', msg='Checking for asm flags %r' % ''.join(flags)) + except Errors.ConfigurationError: + pass + else: + conf.env.append_value('ASFLAGS', flags) + conf.env.append_unique('ENABLE_GCCDEPS', 'asm') + if conf.env.CC_NAME in supported_compilers: try: conf.check(fragment='int main() { return 0; }', features='c force_gccdeps', cflags=flags, msg='Checking for c flags %r' % ''.join(flags)) diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/javatest.py talloc-2.3.3/third_party/waf/waflib/extras/javatest.py --- talloc-2.3.1/third_party/waf/waflib/extras/javatest.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/javatest.py 2020-09-10 09:37:12.000000000 +0000 @@ -1,6 +1,6 @@ #! /usr/bin/env python # encoding: utf-8 -# Federico Pellegrin, 2017 (fedepell) +# Federico Pellegrin, 2019 (fedepell) """ Provides Java Unit test support using :py:class:`waflib.Tools.waf_unit_test.utest` @@ -11,6 +11,10 @@ but should be easily expandable to other frameworks given the flexibility of ut_str provided by the standard waf unit test environment. +The extra takes care also of managing non-java dependencies (ie. C/C++ libraries +using JNI or Python modules via JEP) and setting up the environment needed to run +them. + Example usage: def options(opt): @@ -20,15 +24,15 @@ conf.load('java javatest') def build(bld): - + [ ... mainprog is built here ... ] bld(features = 'javac javatest', - srcdir = 'test/', - outdir = 'test', + srcdir = 'test/', + outdir = 'test', sourcepath = ['test'], - classpath = [ 'src' ], - basedir = 'test', + classpath = [ 'src' ], + basedir = 'test', use = ['JAVATEST', 'mainprog'], # mainprog is the program being tested in src/ ut_str = 'java -cp ${CLASSPATH} ${JTRUNNER} ${SRC}', jtest_source = bld.path.ant_glob('test/*.xml'), @@ -53,10 +57,107 @@ """ import os -from waflib import Task, TaskGen, Options +from waflib import Task, TaskGen, Options, Errors, Utils, Logs +from waflib.Tools import ccroot + +JAR_RE = '**/*' + +def _process_use_rec(self, name): + """ + Recursively process ``use`` for task generator with name ``name``.. + Used by javatest_process_use. + """ + if name in self.javatest_use_not or name in self.javatest_use_seen: + return + try: + tg = self.bld.get_tgen_by_name(name) + except Errors.WafError: + self.javatest_use_not.add(name) + return + + self.javatest_use_seen.append(name) + tg.post() + + for n in self.to_list(getattr(tg, 'use', [])): + _process_use_rec(self, n) @TaskGen.feature('javatest') -@TaskGen.after_method('apply_java', 'use_javac_files', 'set_classpath') +@TaskGen.after_method('process_source', 'apply_link', 'use_javac_files') +def javatest_process_use(self): + """ + Process the ``use`` attribute which contains a list of task generator names and store + paths that later is used to populate the unit test runtime environment. + """ + self.javatest_use_not = set() + self.javatest_use_seen = [] + self.javatest_libpaths = [] # strings or Nodes + self.javatest_pypaths = [] # strings or Nodes + self.javatest_dep_nodes = [] + + names = self.to_list(getattr(self, 'use', [])) + for name in names: + _process_use_rec(self, name) + + def extend_unique(lst, varlst): + ext = [] + for x in varlst: + if x not in lst: + ext.append(x) + lst.extend(ext) + + # Collect type specific info needed to construct a valid runtime environment + # for the test. + for name in self.javatest_use_seen: + tg = self.bld.get_tgen_by_name(name) + + # Python-Java embedding crosstools such as JEP + if 'py' in tg.features: + # Python dependencies are added to PYTHONPATH + pypath = getattr(tg, 'install_from', tg.path) + + if 'buildcopy' in tg.features: + # Since buildcopy is used we assume that PYTHONPATH in build should be used, + # not source + extend_unique(self.javatest_pypaths, [pypath.get_bld().abspath()]) + + # Add buildcopy output nodes to dependencies + extend_unique(self.javatest_dep_nodes, [o for task in getattr(tg, 'tasks', []) for o in getattr(task, 'outputs', [])]) + else: + # If buildcopy is not used, depend on sources instead + extend_unique(self.javatest_dep_nodes, tg.source) + extend_unique(self.javatest_pypaths, [pypath.abspath()]) + + + if getattr(tg, 'link_task', None): + # For tasks with a link_task (C, C++, D et.c.) include their library paths: + if not isinstance(tg.link_task, ccroot.stlink_task): + extend_unique(self.javatest_dep_nodes, tg.link_task.outputs) + extend_unique(self.javatest_libpaths, tg.link_task.env.LIBPATH) + + if 'pyext' in tg.features: + # If the taskgen is extending Python we also want to add the interpreter libpath. + extend_unique(self.javatest_libpaths, tg.link_task.env.LIBPATH_PYEXT) + else: + # Only add to libpath if the link task is not a Python extension + extend_unique(self.javatest_libpaths, [tg.link_task.outputs[0].parent.abspath()]) + + if 'javac' in tg.features or 'jar' in tg.features: + if hasattr(tg, 'jar_task'): + # For Java JAR tasks depend on generated JAR + extend_unique(self.javatest_dep_nodes, tg.jar_task.outputs) + else: + # For Java non-JAR ones we need to glob generated files (Java output files are not predictable) + if hasattr(tg, 'outdir'): + base_node = tg.outdir + else: + base_node = tg.path.get_bld() + + self.javatest_dep_nodes.extend([dx for dx in base_node.ant_glob(JAR_RE, remove=False, quiet=True)]) + + + +@TaskGen.feature('javatest') +@TaskGen.after_method('apply_java', 'use_javac_files', 'set_classpath', 'javatest_process_use') def make_javatest(self): """ Creates a ``utest`` task with a populated environment for Java Unit test execution @@ -65,6 +166,9 @@ tsk = self.create_task('utest') tsk.set_run_after(self.javac_task) + # Dependencies from recursive use analysis + tsk.dep_nodes.extend(self.javatest_dep_nodes) + # Put test input files as waf_unit_test relies on that for some prints and log generation # If jtest_source is there, this is specially useful for passing XML for TestNG # that contain test specification, use that as inputs, otherwise test sources @@ -97,6 +201,21 @@ if not hasattr(self, 'ut_env'): self.ut_env = dict(os.environ) + def add_paths(var, lst): + # Add list of paths to a variable, lst can contain strings or nodes + lst = [ str(n) for n in lst ] + Logs.debug("ut: %s: Adding paths %s=%s", self, var, lst) + self.ut_env[var] = os.pathsep.join(lst) + os.pathsep + self.ut_env.get(var, '') + + add_paths('PYTHONPATH', self.javatest_pypaths) + + if Utils.is_win32: + add_paths('PATH', self.javatest_libpaths) + elif Utils.unversioned_sys_platform() == 'darwin': + add_paths('DYLD_LIBRARY_PATH', self.javatest_libpaths) + add_paths('LD_LIBRARY_PATH', self.javatest_libpaths) + else: + add_paths('LD_LIBRARY_PATH', self.javatest_libpaths) def configure(ctx): cp = ctx.env.CLASSPATH or '.' diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/msvcdeps.py talloc-2.3.3/third_party/waf/waflib/extras/msvcdeps.py --- talloc-2.3.1/third_party/waf/waflib/extras/msvcdeps.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/msvcdeps.py 2020-12-18 10:02:37.000000000 +0000 @@ -150,11 +150,25 @@ def sig_implicit_deps(self): if self.env.CC_NAME not in supported_compilers: return super(self.derived_msvcdeps, self).sig_implicit_deps() + bld = self.generator.bld try: - return Task.Task.sig_implicit_deps(self) - except Errors.WafError: - return Utils.SIG_NIL + return self.compute_sig_implicit_deps() + except Errors.TaskNotReady: + raise ValueError("Please specify the build order precisely with msvcdeps (c/c++ tasks)") + except EnvironmentError: + # If a file is renamed, assume the dependencies are stale and must be recalculated + for x in bld.node_deps.get(self.uid(), []): + if not x.is_bld() and not x.exists(): + try: + del x.parent.children[x.name] + except KeyError: + pass + + key = self.uid() + bld.node_deps[key] = [] + bld.raw_deps[key] = [] + return Utils.SIG_NIL def exec_command(self, cmd, **kw): if self.env.CC_NAME not in supported_compilers: @@ -211,11 +225,14 @@ # get one from the exception object ret = getattr(e, 'returncode', 1) + Logs.debug('msvcdeps: Running for: %s' % self.inputs[0]) for line in raw_out.splitlines(): if line.startswith(INCLUDE_PATTERN): - inc_path = line[len(INCLUDE_PATTERN):].strip() + # Only strip whitespace after log to preserve + # dependency structure in debug output + inc_path = line[len(INCLUDE_PATTERN):] Logs.debug('msvcdeps: Regex matched %s', inc_path) - self.msvcdeps_paths.append(inc_path) + self.msvcdeps_paths.append(inc_path.strip()) else: out.append(line) diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/msvc_pdb.py talloc-2.3.3/third_party/waf/waflib/extras/msvc_pdb.py --- talloc-2.3.1/third_party/waf/waflib/extras/msvc_pdb.py 1970-01-01 00:00:00.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/msvc_pdb.py 2020-09-10 09:37:12.000000000 +0000 @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# encoding: utf-8 +# Rafaël Kooi 2019 + +from waflib import TaskGen + +@TaskGen.feature('c', 'cxx', 'fc') +@TaskGen.after_method('propagate_uselib_vars') +def add_pdb_per_object(self): + """For msvc/fortran, specify a unique compile pdb per object, to work + around LNK4099. Flags are updated with a unique /Fd flag based on the + task output name. This is separate from the link pdb. + """ + if not hasattr(self, 'compiled_tasks'): + return + + link_task = getattr(self, 'link_task', None) + + for task in self.compiled_tasks: + if task.inputs and task.inputs[0].name.lower().endswith('.rc'): + continue + + add_pdb = False + for flagname in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'): + # several languages may be used at once + for flag in task.env[flagname]: + if flag[1:].lower() == 'zi': + add_pdb = True + break + + if add_pdb: + node = task.outputs[0].change_ext('.pdb') + pdb_flag = '/Fd:' + node.abspath() + + for flagname in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'): + buf = [pdb_flag] + for flag in task.env[flagname]: + if flag[1:3] == 'Fd' or flag[1:].lower() == 'fs' or flag[1:].lower() == 'mp': + continue + buf.append(flag) + task.env[flagname] = buf + + if link_task and not node in link_task.dep_nodes: + link_task.dep_nodes.append(node) + if not node in task.outputs: + task.outputs.append(node) diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/pch.py talloc-2.3.3/third_party/waf/waflib/extras/pch.py --- talloc-2.3.1/third_party/waf/waflib/extras/pch.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/pch.py 2020-12-18 10:02:37.000000000 +0000 @@ -90,7 +90,7 @@ if getattr(self, 'name', None): try: - task = self.bld.pch_tasks["%s.%s" % (self.name, self.idx)] + task = self.bld.pch_tasks[self.name] self.bld.fatal("Duplicated 'pch' task with name %r" % "%s.%s" % (self.name, self.idx)) except KeyError: pass @@ -104,7 +104,7 @@ self.pch_task = task if getattr(self, 'name', None): - self.bld.pch_tasks["%s.%s" % (self.name, self.idx)] = task + self.bld.pch_tasks[self.name] = task @TaskGen.feature('cxx') @TaskGen.after_method('process_source', 'propagate_uselib_vars') diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/pytest.py talloc-2.3.3/third_party/waf/waflib/extras/pytest.py --- talloc-2.3.1/third_party/waf/waflib/extras/pytest.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/pytest.py 2020-09-10 09:37:12.000000000 +0000 @@ -40,6 +40,8 @@ - `pytest_libpath` attribute is used to manually specify additional linker paths. +3. Java class search path (CLASSPATH) of any Java/Javalike dependency + Note: `pytest` cannot automatically determine the correct `PYTHONPATH` for `pyext` taskgens because the extension might be part of a Python package or used standalone: @@ -119,6 +121,7 @@ self.pytest_use_seen = [] self.pytest_paths = [] # strings or Nodes self.pytest_libpaths = [] # strings or Nodes + self.pytest_javapaths = [] # strings or Nodes self.pytest_dep_nodes = [] names = self.to_list(getattr(self, 'use', [])) @@ -157,6 +160,17 @@ extend_unique(self.pytest_dep_nodes, tg.source) extend_unique(self.pytest_paths, [pypath.abspath()]) + if 'javac' in tg.features: + # If a JAR is generated point to that, otherwise to directory + if getattr(tg, 'jar_task', None): + extend_unique(self.pytest_javapaths, [tg.jar_task.outputs[0].abspath()]) + else: + extend_unique(self.pytest_javapaths, [tg.path.get_bld()]) + + # And add respective dependencies if present + if tg.use_lst: + extend_unique(self.pytest_javapaths, tg.use_lst) + if getattr(tg, 'link_task', None): # For tasks with a link_task (C, C++, D et.c.) include their library paths: if not isinstance(tg.link_task, ccroot.stlink_task): @@ -212,8 +226,9 @@ Logs.debug("ut: %s: Adding paths %s=%s", self, var, lst) self.ut_env[var] = os.pathsep.join(lst) + os.pathsep + self.ut_env.get(var, '') - # Prepend dependency paths to PYTHONPATH and LD_LIBRARY_PATH + # Prepend dependency paths to PYTHONPATH, CLASSPATH and LD_LIBRARY_PATH add_paths('PYTHONPATH', self.pytest_paths) + add_paths('CLASSPATH', self.pytest_javapaths) if Utils.is_win32: add_paths('PATH', self.pytest_libpaths) diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/sphinx.py talloc-2.3.3/third_party/waf/waflib/extras/sphinx.py --- talloc-2.3.1/third_party/waf/waflib/extras/sphinx.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/sphinx.py 2020-12-18 10:02:37.000000000 +0000 @@ -20,7 +20,7 @@ from waflib.Node import Node from waflib import Utils -from waflib.Task import Task +from waflib import Task from waflib.TaskGen import feature, after_method @@ -55,13 +55,9 @@ sphinx_build_task.set_outputs(self.path.get_bld()) # the sphinx-build results are in directory - sphinx_output_directory = self.path.get_bld().make_node(self.env.SPHINX_OUTPUT_FORMAT) - sphinx_output_directory.mkdir() + self.sphinx_output_directory = self.path.get_bld().make_node(self.env.SPHINX_OUTPUT_FORMAT) + self.sphinx_output_directory.mkdir() Utils.def_attrs(self, install_path=get_install_path(self)) - self.add_install_files(install_to=self.install_path, - install_from=sphinx_output_directory.ant_glob('**/*'), - cwd=sphinx_output_directory, - relative_trick=True) def get_install_path(tg): @@ -73,9 +69,37 @@ return tg.env.DOCDIR -class SphinxBuildingTask(Task): +class SphinxBuildingTask(Task.Task): color = 'BOLD' run_str = '${SPHINX_BUILD} -M ${SPHINX_OUTPUT_FORMAT} ${SRC} ${TGT} ${SPHINX_OPTIONS}' def keyword(self): return 'Compiling (%s)' % self.env.SPHINX_OUTPUT_FORMAT + + def runnable_status(self): + + for x in self.run_after: + if not x.hasrun: + return Task.ASK_LATER + + self.signature() + ret = Task.Task.runnable_status(self) + if ret == Task.SKIP_ME: + # in case the files were removed + self.add_install() + return ret + + + def post_run(self): + self.add_install() + return Task.Task.post_run(self) + + + def add_install(self): + nodes = self.generator.sphinx_output_directory.ant_glob('**/*', quiet=True) + self.outputs += nodes + self.generator.add_install_files(install_to=self.generator.install_path, + install_from=nodes, + postpone=False, + cwd=self.generator.sphinx_output_directory, + relative_trick=True) diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/wafcache.py talloc-2.3.3/third_party/waf/waflib/extras/wafcache.py --- talloc-2.3.1/third_party/waf/waflib/extras/wafcache.py 1970-01-01 00:00:00.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/wafcache.py 2020-12-18 10:02:37.000000000 +0000 @@ -0,0 +1,550 @@ +#! /usr/bin/env python +# encoding: utf-8 +# Thomas Nagy, 2019 (ita) + +""" +Filesystem-based cache system to share and re-use build artifacts + +Cache access operations (copy to and from) are delegated to +independent pre-forked worker subprocesses. + +The following environment variables may be set: +* WAFCACHE: several possibilities: + - File cache: + absolute path of the waf cache (~/.cache/wafcache_user, + where `user` represents the currently logged-in user) + - URL to a cache server, for example: + export WAFCACHE=http://localhost:8080/files/ + in that case, GET/POST requests are made to urls of the form + http://localhost:8080/files/000000000/0 (cache management is delegated to the server) + - GCS, S3 or MINIO bucket + gs://my-bucket/ (uses gsutil command line tool or WAFCACHE_CMD) + s3://my-bucket/ (uses aws command line tool or WAFCACHE_CMD) + minio://my-bucket/ (uses mc command line tool or WAFCACHE_CMD) +* WAFCACHE_CMD: bucket upload/download command, for example: + WAFCACHE_CMD="gsutil cp %{SRC} %{TGT}" + Note that the WAFCACHE bucket value is used for the source or destination + depending on the operation (upload or download). For example, with: + WAFCACHE="gs://mybucket/" + the following commands may be run: + gsutil cp build/myprogram gs://mybucket/aa/aaaaa/1 + gsutil cp gs://mybucket/bb/bbbbb/2 build/somefile +* WAFCACHE_NO_PUSH: if set, disables pushing to the cache +* WAFCACHE_VERBOSITY: if set, displays more detailed cache operations + +File cache specific options: + Files are copied using hard links by default; if the cache is located + onto another partition, the system switches to file copies instead. +* WAFCACHE_TRIM_MAX_FOLDER: maximum amount of tasks to cache (1M) +* WAFCACHE_EVICT_MAX_BYTES: maximum amount of cache size in bytes (10GB) +* WAFCACHE_EVICT_INTERVAL_MINUTES: minimum time interval to try + and trim the cache (3 minutess) + +Usage:: + + def build(bld): + bld.load('wafcache') + ... + +To troubleshoot:: + + waf clean build --zones=wafcache +""" + +import atexit, base64, errno, fcntl, getpass, os, re, shutil, sys, time, traceback, urllib3, shlex +try: + import subprocess32 as subprocess +except ImportError: + import subprocess + +base_cache = os.path.expanduser('~/.cache/') +if not os.path.isdir(base_cache): + base_cache = '/tmp/' +default_wafcache_dir = os.path.join(base_cache, 'wafcache_' + getpass.getuser()) + +CACHE_DIR = os.environ.get('WAFCACHE', default_wafcache_dir) +WAFCACHE_CMD = os.environ.get('WAFCACHE_CMD') +TRIM_MAX_FOLDERS = int(os.environ.get('WAFCACHE_TRIM_MAX_FOLDER', 1000000)) +EVICT_INTERVAL_MINUTES = int(os.environ.get('WAFCACHE_EVICT_INTERVAL_MINUTES', 3)) +EVICT_MAX_BYTES = int(os.environ.get('WAFCACHE_EVICT_MAX_BYTES', 10**10)) +WAFCACHE_NO_PUSH = 1 if os.environ.get('WAFCACHE_NO_PUSH') else 0 +WAFCACHE_VERBOSITY = 1 if os.environ.get('WAFCACHE_VERBOSITY') else 0 +OK = "ok" + +re_waf_cmd = re.compile('(?P%{SRC})|(?P%{TGT})') + +try: + import cPickle +except ImportError: + import pickle as cPickle + +if __name__ != '__main__': + from waflib import Task, Logs, Utils, Build + +def can_retrieve_cache(self): + """ + New method for waf Task classes + """ + if not self.outputs: + return False + + self.cached = False + + sig = self.signature() + ssig = Utils.to_hex(self.uid() + sig) + + files_to = [node.abspath() for node in self.outputs] + err = cache_command(ssig, [], files_to) + if err.startswith(OK): + if WAFCACHE_VERBOSITY: + Logs.pprint('CYAN', ' Fetched %r from cache' % files_to) + else: + Logs.debug('wafcache: fetched %r from cache', files_to) + else: + if WAFCACHE_VERBOSITY: + Logs.pprint('YELLOW', ' No cache entry %s' % files_to) + else: + Logs.debug('wafcache: No cache entry %s: %s', files_to, err) + return False + + self.cached = True + return True + +def put_files_cache(self): + """ + New method for waf Task classes + """ + if WAFCACHE_NO_PUSH or getattr(self, 'cached', None) or not self.outputs: + return + + bld = self.generator.bld + sig = self.signature() + ssig = Utils.to_hex(self.uid() + sig) + + files_from = [node.abspath() for node in self.outputs] + err = cache_command(ssig, files_from, []) + + if err.startswith(OK): + if WAFCACHE_VERBOSITY: + Logs.pprint('CYAN', ' Successfully uploaded %s to cache' % files_from) + else: + Logs.debug('wafcache: Successfully uploaded %r to cache', files_from) + else: + if WAFCACHE_VERBOSITY: + Logs.pprint('RED', ' Error caching step results %s: %s' % (files_from, err)) + else: + Logs.debug('wafcache: Error caching results %s: %s', files_from, err) + + bld.task_sigs[self.uid()] = self.cache_sig + +def hash_env_vars(self, env, vars_lst): + """ + Reimplement BuildContext.hash_env_vars so that the resulting hash does not depend on local paths + """ + if not env.table: + env = env.parent + if not env: + return Utils.SIG_NIL + + idx = str(id(env)) + str(vars_lst) + try: + cache = self.cache_env + except AttributeError: + cache = self.cache_env = {} + else: + try: + return self.cache_env[idx] + except KeyError: + pass + + v = str([env[a] for a in vars_lst]) + v = v.replace(self.srcnode.abspath().__repr__()[:-1], '') + m = Utils.md5() + m.update(v.encode()) + ret = m.digest() + + Logs.debug('envhash: %r %r', ret, v) + + cache[idx] = ret + + return ret + +def uid(self): + """ + Reimplement Task.uid() so that the signature does not depend on local paths + """ + try: + return self.uid_ + except AttributeError: + m = Utils.md5() + src = self.generator.bld.srcnode + up = m.update + up(self.__class__.__name__.encode()) + for x in self.inputs + self.outputs: + up(x.path_from(src).encode()) + self.uid_ = m.digest() + return self.uid_ + + +def make_cached(cls): + """ + Enable the waf cache for a given task class + """ + if getattr(cls, 'nocache', None) or getattr(cls, 'has_cache', False): + return + + m1 = getattr(cls, 'run', None) + def run(self): + if getattr(self, 'nocache', False): + return m1(self) + if self.can_retrieve_cache(): + return 0 + return m1(self) + cls.run = run + + m2 = getattr(cls, 'post_run', None) + def post_run(self): + if getattr(self, 'nocache', False): + return m2(self) + ret = m2(self) + self.put_files_cache() + if hasattr(self, 'chmod'): + for node in self.outputs: + os.chmod(node.abspath(), self.chmod) + return ret + cls.post_run = post_run + cls.has_cache = True + +process_pool = [] +def get_process(): + """ + Returns a worker process that can process waf cache commands + The worker process is assumed to be returned to the process pool when unused + """ + try: + return process_pool.pop() + except IndexError: + filepath = os.path.dirname(os.path.abspath(__file__)) + os.sep + 'wafcache.py' + cmd = [sys.executable, '-c', Utils.readf(filepath)] + return subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, bufsize=0) + +def atexit_pool(): + for k in process_pool: + try: + os.kill(k.pid, 9) + except OSError: + pass + else: + k.wait() +atexit.register(atexit_pool) + +def build(bld): + """ + Called during the build process to enable file caching + """ + if process_pool: + # already called once + return + + # pre-allocation + processes = [get_process() for x in range(bld.jobs)] + process_pool.extend(processes) + + Task.Task.can_retrieve_cache = can_retrieve_cache + Task.Task.put_files_cache = put_files_cache + Task.Task.uid = uid + Build.BuildContext.hash_env_vars = hash_env_vars + for x in reversed(list(Task.classes.values())): + make_cached(x) + +def cache_command(sig, files_from, files_to): + """ + Create a command for cache worker processes, returns a pickled + base64-encoded tuple containing the task signature, a list of files to + cache and a list of files files to get from cache (one of the lists + is assumed to be empty) + """ + proc = get_process() + + obj = base64.b64encode(cPickle.dumps([sig, files_from, files_to])) + proc.stdin.write(obj) + proc.stdin.write('\n'.encode()) + proc.stdin.flush() + obj = proc.stdout.readline() + if not obj: + raise OSError('Preforked sub-process %r died' % proc.pid) + process_pool.append(proc) + return cPickle.loads(base64.b64decode(obj)) + +try: + copyfun = os.link +except NameError: + copyfun = shutil.copy2 + +def atomic_copy(orig, dest): + """ + Copy files to the cache, the operation is atomic for a given file + """ + global copyfun + tmp = dest + '.tmp' + up = os.path.dirname(dest) + try: + os.makedirs(up) + except OSError: + pass + + try: + copyfun(orig, tmp) + except OSError as e: + if e.errno == errno.EXDEV: + copyfun = shutil.copy2 + copyfun(orig, tmp) + else: + raise + os.rename(tmp, dest) + +def lru_trim(): + """ + the cache folders take the form: + `CACHE_DIR/0b/0b180f82246d726ece37c8ccd0fb1cde2650d7bfcf122ec1f169079a3bfc0ab9` + they are listed in order of last access, and then removed + until the amount of folders is within TRIM_MAX_FOLDERS and the total space + taken by files is less than EVICT_MAX_BYTES + """ + lst = [] + for up in os.listdir(CACHE_DIR): + if len(up) == 2: + sub = os.path.join(CACHE_DIR, up) + for hval in os.listdir(sub): + path = os.path.join(sub, hval) + + size = 0 + for fname in os.listdir(path): + size += os.lstat(os.path.join(path, fname)).st_size + lst.append((os.stat(path).st_mtime, size, path)) + + lst.sort(key=lambda x: x[0]) + lst.reverse() + + tot = sum(x[1] for x in lst) + while tot > EVICT_MAX_BYTES or len(lst) > TRIM_MAX_FOLDERS: + _, tmp_size, path = lst.pop() + tot -= tmp_size + + tmp = path + '.tmp' + try: + shutil.rmtree(tmp) + except OSError: + pass + try: + os.rename(path, tmp) + except OSError: + sys.stderr.write('Could not rename %r to %r' % (path, tmp)) + else: + try: + shutil.rmtree(tmp) + except OSError: + sys.stderr.write('Could not remove %r' % tmp) + sys.stderr.write("Cache trimmed: %r bytes in %r folders left\n" % (tot, len(lst))) + + +def lru_evict(): + """ + Reduce the cache size + """ + lockfile = os.path.join(CACHE_DIR, 'all.lock') + try: + st = os.stat(lockfile) + except EnvironmentError as e: + if e.errno == errno.ENOENT: + with open(lockfile, 'w') as f: + f.write('') + return + else: + raise + + if st.st_mtime < time.time() - EVICT_INTERVAL_MINUTES * 60: + # check every EVICT_INTERVAL_MINUTES minutes if the cache is too big + # OCLOEXEC is unnecessary because no processes are spawned + fd = os.open(lockfile, os.O_RDWR | os.O_CREAT, 0o755) + try: + try: + fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) + except EnvironmentError: + sys.stderr.write('another process is running!\n') + pass + else: + # now dow the actual cleanup + lru_trim() + os.utime(lockfile, None) + finally: + os.close(fd) + +class netcache(object): + def __init__(self): + self.http = urllib3.PoolManager() + + def url_of(self, sig, i): + return "%s/%s/%s" % (CACHE_DIR, sig, i) + + def upload(self, file_path, sig, i): + url = self.url_of(sig, i) + with open(file_path, 'rb') as f: + file_data = f.read() + r = self.http.request('POST', url, timeout=60, + fields={ 'file': ('%s/%s' % (sig, i), file_data), }) + if r.status >= 400: + raise OSError("Invalid status %r %r" % (url, r.status)) + + def download(self, file_path, sig, i): + url = self.url_of(sig, i) + with self.http.request('GET', url, preload_content=False, timeout=60) as inf: + if inf.status >= 400: + raise OSError("Invalid status %r %r" % (url, inf.status)) + with open(file_path, 'wb') as out: + shutil.copyfileobj(inf, out) + + def copy_to_cache(self, sig, files_from, files_to): + try: + for i, x in enumerate(files_from): + if not os.path.islink(x): + self.upload(x, sig, i) + except Exception: + return traceback.format_exc() + return OK + + def copy_from_cache(self, sig, files_from, files_to): + try: + for i, x in enumerate(files_to): + self.download(x, sig, i) + except Exception: + return traceback.format_exc() + return OK + +class fcache(object): + def __init__(self): + if not os.path.exists(CACHE_DIR): + os.makedirs(CACHE_DIR) + if not os.path.exists(CACHE_DIR): + raise ValueError('Could not initialize the cache directory') + + def copy_to_cache(self, sig, files_from, files_to): + """ + Copy files to the cache, existing files are overwritten, + and the copy is atomic only for a given file, not for all files + that belong to a given task object + """ + try: + for i, x in enumerate(files_from): + dest = os.path.join(CACHE_DIR, sig[:2], sig, str(i)) + atomic_copy(x, dest) + except Exception: + return traceback.format_exc() + else: + # attempt trimming if caching was successful: + # we may have things to trim! + lru_evict() + return OK + + def copy_from_cache(self, sig, files_from, files_to): + """ + Copy files from the cache + """ + try: + for i, x in enumerate(files_to): + orig = os.path.join(CACHE_DIR, sig[:2], sig, str(i)) + atomic_copy(orig, x) + + # success! update the cache time + os.utime(os.path.join(CACHE_DIR, sig[:2], sig), None) + except Exception: + return traceback.format_exc() + return OK + +class bucket_cache(object): + def bucket_copy(self, source, target): + if WAFCACHE_CMD: + def replacer(match): + if match.group('src'): + return source + elif match.group('tgt'): + return target + cmd = [re_waf_cmd.sub(replacer, x) for x in shlex.split(WAFCACHE_CMD)] + elif CACHE_DIR.startswith('s3://'): + cmd = ['aws', 's3', 'cp', source, target] + elif CACHE_DIR.startswith('gs://'): + cmd = ['gsutil', 'cp', source, target] + else: + cmd = ['mc', 'cp', source, target] + + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = proc.communicate() + if proc.returncode: + raise OSError('Error copy %r to %r using: %r (exit %r):\n out:%s\n err:%s' % ( + source, target, cmd, proc.returncode, out.decode(), err.decode())) + + def copy_to_cache(self, sig, files_from, files_to): + try: + for i, x in enumerate(files_from): + dest = os.path.join(CACHE_DIR, sig[:2], sig, str(i)) + self.bucket_copy(x, dest) + except Exception: + return traceback.format_exc() + return OK + + def copy_from_cache(self, sig, files_from, files_to): + try: + for i, x in enumerate(files_to): + orig = os.path.join(CACHE_DIR, sig[:2], sig, str(i)) + self.bucket_copy(orig, x) + except EnvironmentError: + return traceback.format_exc() + return OK + +def loop(service): + """ + This function is run when this file is run as a standalone python script, + it assumes a parent process that will communicate the commands to it + as pickled-encoded tuples (one line per command) + + The commands are to copy files to the cache or copy files from the + cache to a target destination + """ + # one operation is performed at a single time by a single process + # therefore stdin never has more than one line + txt = sys.stdin.readline().strip() + if not txt: + # parent process probably ended + sys.exit(1) + ret = OK + + [sig, files_from, files_to] = cPickle.loads(base64.b64decode(txt)) + if files_from: + # TODO return early when pushing files upstream + ret = service.copy_to_cache(sig, files_from, files_to) + elif files_to: + # the build process waits for workers to (possibly) obtain files from the cache + ret = service.copy_from_cache(sig, files_from, files_to) + else: + ret = "Invalid command" + + obj = base64.b64encode(cPickle.dumps(ret)) + sys.stdout.write(obj.decode()) + sys.stdout.write('\n') + sys.stdout.flush() + +if __name__ == '__main__': + if CACHE_DIR.startswith('s3://') or CACHE_DIR.startswith('gs://') or CACHE_DIR.startswith('minio://'): + if CACHE_DIR.startswith('minio://'): + CACHE_DIR = CACHE_DIR[8:] # minio doesn't need the protocol part, uses config aliases + service = bucket_cache() + elif CACHE_DIR.startswith('http'): + service = netcache() + else: + service = fcache() + while 1: + try: + loop(service) + except KeyboardInterrupt: + break + diff -Nru talloc-2.3.1/third_party/waf/waflib/extras/xcode6.py talloc-2.3.3/third_party/waf/waflib/extras/xcode6.py --- talloc-2.3.1/third_party/waf/waflib/extras/xcode6.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/extras/xcode6.py 2020-12-18 10:02:37.000000000 +0000 @@ -99,7 +99,7 @@ ... } 'Release': { - 'ARCHS' x86_64' + 'ARCHS': x86_64' ... } } @@ -163,12 +163,12 @@ result = result + "\t\t}" return result elif isinstance(value, str): - return "\"%s\"" % value + return '"%s"' % value.replace('"', '\\\\\\"') elif isinstance(value, list): result = "(\n" for i in value: - result = result + "\t\t\t%s,\n" % self.tostring(i) - result = result + "\t\t)" + result = result + "\t\t\t\t%s,\n" % self.tostring(i) + result = result + "\t\t\t)" return result elif isinstance(value, XCodeNode): return value._id @@ -565,13 +565,13 @@ # Override target specific build settings bldsettings = { 'HEADER_SEARCH_PATHS': ['$(inherited)'] + self.env['INCPATHS'], - 'LIBRARY_SEARCH_PATHS': ['$(inherited)'] + Utils.to_list(self.env.LIBPATH) + Utils.to_list(self.env.STLIBPATH) + Utils.to_list(self.env.LIBDIR) , + 'LIBRARY_SEARCH_PATHS': ['$(inherited)'] + Utils.to_list(self.env.LIBPATH) + Utils.to_list(self.env.STLIBPATH) + Utils.to_list(self.env.LIBDIR), 'FRAMEWORK_SEARCH_PATHS': ['$(inherited)'] + Utils.to_list(self.env.FRAMEWORKPATH), - 'OTHER_LDFLAGS': libs + ' ' + frameworks, - 'OTHER_LIBTOOLFLAGS': bld.env['LINKFLAGS'], + 'OTHER_LDFLAGS': libs + ' ' + frameworks + ' ' + ' '.join(bld.env['LINKFLAGS']), 'OTHER_CPLUSPLUSFLAGS': Utils.to_list(self.env['CXXFLAGS']), 'OTHER_CFLAGS': Utils.to_list(self.env['CFLAGS']), - 'INSTALL_PATH': [] + 'INSTALL_PATH': [], + 'GCC_PREPROCESSOR_DEFINITIONS': self.env['DEFINES'] } # Install path @@ -591,7 +591,7 @@ # The keys represents different build configuration, e.g. Debug, Release and so on.. # Insert our generated build settings to all configuration names - keys = set(settings.keys() + bld.env.PROJ_CONFIGURATION.keys()) + keys = set(settings.keys()) | set(bld.env.PROJ_CONFIGURATION.keys()) for k in keys: if k in settings: settings[k].update(bldsettings) diff -Nru talloc-2.3.1/third_party/waf/waflib/Options.py talloc-2.3.3/third_party/waf/waflib/Options.py --- talloc-2.3.1/third_party/waf/waflib/Options.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Options.py 2020-09-10 09:37:12.000000000 +0000 @@ -44,7 +44,7 @@ """ def __init__(self, ctx, allow_unknown=False): optparse.OptionParser.__init__(self, conflict_handler='resolve', add_help_option=False, - version='waf %s (%s)' % (Context.WAFVERSION, Context.WAFREVISION)) + version='%s %s (%s)' % (Context.WAFNAME, Context.WAFVERSION, Context.WAFREVISION)) self.formatter.width = Logs.get_term_cols() self.ctx = ctx self.allow_unknown = allow_unknown @@ -62,6 +62,21 @@ else: self.error(str(e)) + def _process_long_opt(self, rargs, values): + # --custom-option=-ftxyz is interpreted as -f -t... see #2280 + if self.allow_unknown: + back = [] + rargs + try: + optparse.OptionParser._process_long_opt(self, rargs, values) + except optparse.BadOptionError: + while rargs: + rargs.pop() + rargs.extend(back) + rargs.pop(0) + raise + else: + optparse.OptionParser._process_long_opt(self, rargs, values) + def print_usage(self, file=None): return self.print_help(file) @@ -96,11 +111,11 @@ lst.sort() ret = '\n'.join(lst) - return '''waf [commands] [options] + return '''%s [commands] [options] -Main commands (example: ./waf build -j4) +Main commands (example: ./%s build -j4) %s -''' % ret +''' % (Context.WAFNAME, Context.WAFNAME, ret) class OptionsContext(Context.Context): @@ -141,9 +156,9 @@ gr.add_option('-o', '--out', action='store', default='', help='build dir for the project', dest='out') gr.add_option('-t', '--top', action='store', default='', help='src dir for the project', dest='top') - gr.add_option('--no-lock-in-run', action='store_true', default='', help=optparse.SUPPRESS_HELP, dest='no_lock_in_run') - gr.add_option('--no-lock-in-out', action='store_true', default='', help=optparse.SUPPRESS_HELP, dest='no_lock_in_out') - gr.add_option('--no-lock-in-top', action='store_true', default='', help=optparse.SUPPRESS_HELP, dest='no_lock_in_top') + gr.add_option('--no-lock-in-run', action='store_true', default=os.environ.get('NO_LOCK_IN_RUN', ''), help=optparse.SUPPRESS_HELP, dest='no_lock_in_run') + gr.add_option('--no-lock-in-out', action='store_true', default=os.environ.get('NO_LOCK_IN_OUT', ''), help=optparse.SUPPRESS_HELP, dest='no_lock_in_out') + gr.add_option('--no-lock-in-top', action='store_true', default=os.environ.get('NO_LOCK_IN_TOP', ''), help=optparse.SUPPRESS_HELP, dest='no_lock_in_top') default_prefix = getattr(Context.g_module, 'default_prefix', os.environ.get('PREFIX')) if not default_prefix: @@ -282,6 +297,8 @@ elif arg != 'options': commands.append(arg) + if options.jobs < 1: + options.jobs = 1 for name in 'top out destdir prefix bindir libdir'.split(): # those paths are usually expanded from Context.launch_dir if getattr(options, name, None): diff -Nru talloc-2.3.1/third_party/waf/waflib/Scripting.py talloc-2.3.3/third_party/waf/waflib/Scripting.py --- talloc-2.3.1/third_party/waf/waflib/Scripting.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Scripting.py 2020-09-10 09:37:12.000000000 +0000 @@ -306,7 +306,7 @@ # remove a build folder, if any cur = '.' - if ctx.options.no_lock_in_top: + if os.environ.get('NO_LOCK_IN_TOP') or ctx.options.no_lock_in_top: cur = ctx.options.out try: @@ -333,9 +333,9 @@ remove_and_log(env.out_dir, shutil.rmtree) env_dirs = [env.out_dir] - if not ctx.options.no_lock_in_top: + if not (os.environ.get('NO_LOCK_IN_TOP') or ctx.options.no_lock_in_top): env_dirs.append(env.top_dir) - if not ctx.options.no_lock_in_run: + if not (os.environ.get('NO_LOCK_IN_RUN') or ctx.options.no_lock_in_run): env_dirs.append(env.run_dir) for k in env_dirs: p = os.path.join(k, Options.lockfile) diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/asm.py talloc-2.3.3/third_party/waf/waflib/Tools/asm.py --- talloc-2.3.1/third_party/waf/waflib/Tools/asm.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/asm.py 2020-12-18 10:02:37.000000000 +0000 @@ -56,13 +56,11 @@ Compiles asm files by gas/nasm/yasm/... """ color = 'BLUE' - run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}' + run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${ASMDEFINES_ST:DEFINES} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}' def scan(self): if self.env.ASM_NAME == 'gas': return c_preproc.scan(self) - Logs.warn('There is no dependency scanner for Nasm!') - return [[], []] elif self.env.ASM_NAME == 'nasm': Logs.warn('The Nasm dependency scanner is incomplete!') @@ -106,3 +104,4 @@ def configure(conf): conf.env.ASMPATH_ST = '-I%s' + conf.env.ASMDEFINES_ST = '-D%s' diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/c_aliases.py talloc-2.3.3/third_party/waf/waflib/Tools/c_aliases.py --- talloc-2.3.1/third_party/waf/waflib/Tools/c_aliases.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/c_aliases.py 2020-09-10 09:37:12.000000000 +0000 @@ -38,7 +38,7 @@ :return: the list of features for a task generator processing the source files :rtype: list of string """ - exts = get_extensions(kw['source']) + exts = get_extensions(kw.get('source', [])) typ = kw['typ'] feats = [] @@ -72,7 +72,7 @@ feats.append(x + typ) will_link = True if not will_link and not kw.get('features', []): - raise Errors.WafError('Cannot link from %r, try passing eg: features="c cprogram"?' % kw) + raise Errors.WafError('Unable to determine how to link %r, try adding eg: features="c cshlib"?' % kw) return feats def set_features(kw, typ): diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/c_config.py talloc-2.3.3/third_party/waf/waflib/Tools/c_config.py --- talloc-2.3.1/third_party/waf/waflib/Tools/c_config.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/c_config.py 2020-12-18 10:02:37.000000000 +0000 @@ -68,6 +68,7 @@ '__s390__' : 's390', '__sh__' : 'sh', '__xtensa__' : 'xtensa', +'__e2k__' : 'e2k', } @conf @@ -86,6 +87,10 @@ :type uselib_store: string :param env: config set or conf.env by default :type env: :py:class:`waflib.ConfigSet.ConfigSet` + :param force_static: force usage of static libraries + :type force_static: bool default False + :param posix: usage of POSIX mode for shlex lexical analiysis library + :type posix: bool default True """ assert(isinstance(line, str)) @@ -103,6 +108,8 @@ lex.commenters = '' lst = list(lex) + so_re = re.compile(r"\.so(?:\.[0-9]+)*$") + # append_unique is not always possible # for example, apple flags may require both -arch i386 and -arch ppc uselib = uselib_store @@ -144,7 +151,7 @@ elif x.startswith('-std='): prefix = 'CXXFLAGS' if '++' in x else 'CFLAGS' app(prefix, x) - elif x.startswith('+') or x in ('-pthread', '-fPIC', '-fpic', '-fPIE', '-fpie'): + elif x.startswith('+') or x in ('-pthread', '-fPIC', '-fpic', '-fPIE', '-fpie', '-flto', '-fno-lto'): app('CFLAGS', x) app('CXXFLAGS', x) app('LINKFLAGS', x) @@ -180,7 +187,7 @@ app('CFLAGS', tmp) app('CXXFLAGS', tmp) app('LINKFLAGS', tmp) - elif x.endswith(('.a', '.so', '.dylib', '.lib')): + elif x.endswith(('.a', '.dylib', '.lib')) or so_re.search(x): appu('LINKFLAGS', x) # not cool, #762 else: self.to_log('Unhandled flag %r' % x) @@ -246,6 +253,8 @@ * if modversion is given, then return the module version * else, execute the *-config* program with the *args* and *variables* given, and set the flags on the *conf.env.FLAGS_name* variable + :param path: the **-config program to use** + :type path: list of string :param atleast_pkgconfig_version: minimum pkg-config version to use (disable other tests) :type atleast_pkgconfig_version: string :param package: package name, for example *gtk+-2.0* @@ -260,6 +269,12 @@ :type variables: list of string :param define_variable: additional variables to define (also in conf.env.PKG_CONFIG_DEFINES) :type define_variable: dict(string: string) + :param pkg_config_path: paths where pkg-config should search for .pc config files (overrides env.PKG_CONFIG_PATH if exists) + :type pkg_config_path: string, list of directories separated by colon + :param force_static: force usage of static libraries + :type force_static: bool default False + :param posix: usage of POSIX mode for shlex lexical analiysis library + :type posix: bool default True """ path = Utils.to_list(kw['path']) @@ -334,6 +349,7 @@ """ Checks for configuration flags using a **-config**-like program (pkg-config, sdl-config, etc). This wraps internal calls to :py:func:`waflib.Tools.c_config.validate_cfg` and :py:func:`waflib.Tools.c_config.exec_cfg` + so check exec_cfg parameters descriptions for more details on kw passed A few examples:: @@ -1267,10 +1283,11 @@ tasks = [] id_to_task = {} - for dct in k: + for counter, dct in enumerate(k): x = Task.classes['cfgtask'](bld=bld, env=None) tasks.append(x) x.args = dct + x.args['multicheck_counter'] = counter x.bld = bld x.conf = self x.args = dct diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/compiler_c.py talloc-2.3.3/third_party/waf/waflib/Tools/compiler_c.py --- talloc-2.3.1/third_party/waf/waflib/Tools/compiler_c.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/compiler_c.py 2020-09-10 09:37:12.000000000 +0000 @@ -37,7 +37,7 @@ c_compiler = { 'win32': ['msvc', 'gcc', 'clang'], -'cygwin': ['gcc'], +'cygwin': ['gcc', 'clang'], 'darwin': ['clang', 'gcc'], 'aix': ['xlc', 'gcc', 'clang'], 'linux': ['gcc', 'clang', 'icc'], diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/compiler_cxx.py talloc-2.3.3/third_party/waf/waflib/Tools/compiler_cxx.py --- talloc-2.3.1/third_party/waf/waflib/Tools/compiler_cxx.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/compiler_cxx.py 2020-09-10 09:37:12.000000000 +0000 @@ -38,7 +38,7 @@ cxx_compiler = { 'win32': ['msvc', 'g++', 'clang++'], -'cygwin': ['g++'], +'cygwin': ['g++', 'clang++'], 'darwin': ['clang++', 'g++'], 'aix': ['xlc++', 'g++', 'clang++'], 'linux': ['g++', 'clang++', 'icpc'], diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/c_tests.py talloc-2.3.3/third_party/waf/waflib/Tools/c_tests.py --- talloc-2.3.1/third_party/waf/waflib/Tools/c_tests.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/c_tests.py 2020-09-10 09:37:12.000000000 +0000 @@ -180,9 +180,15 @@ ######################################################################################## ENDIAN_FRAGMENT = ''' +#ifdef _MSC_VER +#define testshlib_EXPORT __declspec(dllexport) +#else +#define testshlib_EXPORT +#endif + short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -int use_ascii (int i) { +int testshlib_EXPORT use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; @@ -208,12 +214,12 @@ return -1 @feature('grep_for_endianness') -@after_method('process_source') +@after_method('apply_link') def grep_for_endianness_fun(self): """ Used by the endianness configuration test """ - self.create_task('grep_for_endianness', self.compiled_tasks[0].outputs[0]) + self.create_task('grep_for_endianness', self.link_task.outputs[0]) @conf def check_endianness(self): @@ -223,7 +229,8 @@ tmp = [] def check_msg(self): return tmp[0] - self.check(fragment=ENDIAN_FRAGMENT, features='c grep_for_endianness', + + self.check(fragment=ENDIAN_FRAGMENT, features='c cshlib grep_for_endianness', msg='Checking for endianness', define='ENDIANNESS', tmp=tmp, okmsg=check_msg, confcache=None) return tmp[0] diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/fc.py talloc-2.3.3/third_party/waf/waflib/Tools/fc.py --- talloc-2.3.1/third_party/waf/waflib/Tools/fc.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/fc.py 2020-09-10 09:37:12.000000000 +0000 @@ -13,8 +13,8 @@ from waflib.Configure import conf ccroot.USELIB_VARS['fc'] = set(['FCFLAGS', 'DEFINES', 'INCLUDES', 'FCPPFLAGS']) -ccroot.USELIB_VARS['fcprogram_test'] = ccroot.USELIB_VARS['fcprogram'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS']) -ccroot.USELIB_VARS['fcshlib'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS']) +ccroot.USELIB_VARS['fcprogram_test'] = ccroot.USELIB_VARS['fcprogram'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS', 'LDFLAGS']) +ccroot.USELIB_VARS['fcshlib'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS', 'LDFLAGS']) ccroot.USELIB_VARS['fcstlib'] = set(['ARFLAGS', 'LINKDEPS']) @extension('.f','.F','.f90','.F90','.for','.FOR','.f95','.F95','.f03','.F03','.f08','.F08') diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/irixcc.py talloc-2.3.3/third_party/waf/waflib/Tools/irixcc.py --- talloc-2.3.1/third_party/waf/waflib/Tools/irixcc.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/irixcc.py 2020-09-10 09:37:12.000000000 +0000 @@ -13,22 +13,11 @@ @conf def find_irixcc(conf): v = conf.env - cc = None - if v.CC: - cc = v.CC - elif 'CC' in conf.environ: - cc = conf.environ['CC'] - if not cc: - cc = conf.find_program('cc', var='CC') - if not cc: - conf.fatal('irixcc was not found') - + cc = conf.find_program('cc', var='CC') try: conf.cmd_and_log(cc + ['-version']) except Errors.WafError: conf.fatal('%r -version could not be executed' % cc) - - v.CC = cc v.CC_NAME = 'irix' @conf @@ -57,7 +46,6 @@ def configure(conf): conf.find_irixcc() - conf.find_cpp() conf.find_ar() conf.irixcc_common_flags() conf.cc_load_tools() diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/javaw.py talloc-2.3.3/third_party/waf/waflib/Tools/javaw.py --- talloc-2.3.1/third_party/waf/waflib/Tools/javaw.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/javaw.py 2020-09-10 09:37:12.000000000 +0000 @@ -251,7 +251,7 @@ base_node = tg.path.get_bld() self.use_lst.append(base_node.abspath()) - self.javac_task.dep_nodes.extend([x for x in base_node.ant_glob(JAR_RE, remove=False, quiet=True)]) + self.javac_task.dep_nodes.extend([dx for dx in base_node.ant_glob(JAR_RE, remove=False, quiet=True)]) for tsk in tg.tasks: self.javac_task.set_run_after(tsk) diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/msvc.py talloc-2.3.3/third_party/waf/waflib/Tools/msvc.py --- talloc-2.3.1/third_party/waf/waflib/Tools/msvc.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/msvc.py 2020-12-18 10:02:37.000000000 +0000 @@ -99,7 +99,13 @@ """List of icl platforms""" def options(opt): - opt.add_option('--msvc_version', type='string', help = 'msvc version, eg: "msvc 10.0,msvc 9.0"', default='') + default_ver = '' + vsver = os.getenv('VSCMD_VER') + if vsver: + m = re.match(r'(^\d+\.\d+).*', vsver) + if m: + default_ver = 'msvc %s' % m.group(1) + opt.add_option('--msvc_version', type='string', help = 'msvc version, eg: "msvc 10.0,msvc 9.0"', default=default_ver) opt.add_option('--msvc_targets', type='string', help = 'msvc targets, eg: "x64,arm"', default='') opt.add_option('--no-msvc-lazy', action='store_false', help = 'lazily check msvc target environments', default=True, dest='msvc_lazy') diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/python.py talloc-2.3.3/third_party/waf/waflib/Tools/python.py --- talloc-2.3.1/third_party/waf/waflib/Tools/python.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/python.py 2020-09-10 09:37:12.000000000 +0000 @@ -620,7 +620,7 @@ v.PYO = getattr(Options.options, 'pyo', 1) try: - v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import imp;print(imp.get_tag())"]).strip() + v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import sys\ntry:\n print(sys.implementation.cache_tag)\nexcept AttributeError:\n import imp\n print(imp.get_tag())\n"]).strip() except Errors.WafError: pass diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/qt5.py talloc-2.3.3/third_party/waf/waflib/Tools/qt5.py --- talloc-2.3.1/third_party/waf/waflib/Tools/qt5.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/qt5.py 2020-12-18 10:02:37.000000000 +0000 @@ -57,7 +57,23 @@ (QT5_{ROOT,DIR,MOC,UIC,XCOMPILE}) allow finer tuning of the tool, tool path selection, etc; please read the source for more info. -The detection uses pkg-config on Linux by default. To force static library detection use: +The detection uses pkg-config on Linux by default. The list of +libraries to be requested to pkg-config is formulated by scanning +in the QTLIBS directory (that can be passed via --qtlibs or by +setting the environment variable QT5_LIBDIR otherwise is derived +by querying qmake for QT_INSTALL_LIBS directory) for shared/static +libraries present. +Alternatively the list of libraries to be requested via pkg-config +can be set using the qt5_vars attribute, ie: + + conf.qt5_vars = ['Qt5Core', 'Qt5Gui', 'Qt5Widgets', 'Qt5Test']; + +This can speed up configuration phase if needed libraries are +known beforehand, can improve detection on systems with a +sparse QT5 libraries installation (ie. NIX) and can improve +detection of some header-only Qt modules (ie. Qt5UiPlugin). + +To force static library detection use: QT5_XCOMPILE=1 QT5_FORCE_STATIC=1 waf configure """ @@ -466,6 +482,9 @@ The detection uses the program ``pkg-config`` through :py:func:`waflib.Tools.config_c.check_cfg` """ + if 'COMPILER_CXX' not in self.env: + self.fatal('No CXX compiler defined: did you forget to configure compiler_cxx first?') + self.find_qt5_binaries() self.set_qt5_libs_dir() self.set_qt5_libs_to_check() @@ -478,12 +497,9 @@ if not has_xml: Logs.error('No xml.sax support was found, rcc dependencies will be incomplete!') - if 'COMPILER_CXX' not in self.env: - self.fatal('No CXX compiler defined: did you forget to configure compiler_cxx first?') - # Qt5 may be compiled with '-reduce-relocations' which requires dependent programs to have -fPIE or -fPIC? - frag = '#include \nint main(int argc, char **argv) {return 0;}\n' - uses = 'QT5CORE QT5WIDGETS QT5GUI' + frag = '#include \nint main(int argc, char **argv) {QMap m;return m.keys().size();}\n' + uses = 'QT5CORE' for flag in [[], '-fPIE', '-fPIC', '-std=c++11' , ['-std=c++11', '-fPIE'], ['-std=c++11', '-fPIC']]: msg = 'See if Qt files compile ' if flag: @@ -499,7 +515,7 @@ # FreeBSD does not add /usr/local/lib and the pkg-config files do not provide it either :-/ if Utils.unversioned_sys_platform() == 'freebsd': - frag = '#include \nint main(int argc, char **argv) { QApplication app(argc, argv); return NULL != (void*) (&app);}\n' + frag = '#include \nint main(int argc, char **argv) {QMap m;return m.keys().size();}\n' try: self.check(features='qt5 cxx cxxprogram', use=uses, fragment=frag, msg='Can we link Qt programs on FreeBSD directly?') except self.errors.ConfigurationError: @@ -637,7 +653,7 @@ except Errors.WafError: qtdir = self.cmd_and_log(env.QMAKE + ['-query', 'QT_INSTALL_PREFIX']).strip() qtlibs = os.path.join(qtdir, 'lib') - self.msg('Found the Qt5 libraries in', qtlibs) + self.msg('Found the Qt5 library path', qtlibs) env.QTLIBS = qtlibs @conf diff -Nru talloc-2.3.1/third_party/waf/waflib/Tools/waf_unit_test.py talloc-2.3.3/third_party/waf/waflib/Tools/waf_unit_test.py --- talloc-2.3.1/third_party/waf/waflib/Tools/waf_unit_test.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Tools/waf_unit_test.py 2020-12-18 10:02:37.000000000 +0000 @@ -97,6 +97,7 @@ if isinstance(v, str): v = v.split(os.pathsep) self.ut_env[k] = os.pathsep.join(p + v) + self.env.append_value('UT_DEPS', ['%r%r' % (key, self.ut_env[key]) for key in self.ut_env]) @feature('test') @after_method('apply_link', 'process_use') @@ -108,7 +109,8 @@ tsk = self.create_task('utest', self.link_task.outputs) if getattr(self, 'ut_str', None): self.ut_run, lst = Task.compile_fun(self.ut_str, shell=getattr(self, 'ut_shell', False)) - tsk.vars = lst + tsk.vars + tsk.vars = tsk.vars + lst + self.env.append_value('UT_DEPS', self.ut_str) self.handle_ut_cwd('ut_cwd') @@ -139,6 +141,10 @@ if not hasattr(self, 'ut_cmd'): self.ut_cmd = getattr(Options.options, 'testcmd', False) + self.env.append_value('UT_DEPS', str(self.ut_cmd)) + self.env.append_value('UT_DEPS', self.ut_paths) + self.env.append_value('UT_DEPS', ['%r%r' % (key, self.ut_env[key]) for key in self.ut_env]) + @taskgen_method def add_test_results(self, tup): """Override and return tup[1] to interrupt the build immediately if a test does not run""" @@ -159,7 +165,7 @@ """ color = 'PINK' after = ['vnum', 'inst'] - vars = [] + vars = ['UT_DEPS'] def runnable_status(self): """ diff -Nru talloc-2.3.1/third_party/waf/waflib/Utils.py talloc-2.3.3/third_party/waf/waflib/Utils.py --- talloc-2.3.1/third_party/waf/waflib/Utils.py 2019-12-10 11:01:32.000000000 +0000 +++ talloc-2.3.3/third_party/waf/waflib/Utils.py 2020-09-10 09:37:12.000000000 +0000 @@ -891,7 +891,7 @@ """ Delegates process execution to a pre-forked process instance. """ - if not 'env' in kwargs: + if not kwargs.get('env'): kwargs['env'] = dict(os.environ) try: obj = base64.b64encode(cPickle.dumps([cmd, kwargs, cargs])) diff -Nru talloc-2.3.1/wscript talloc-2.3.3/wscript --- talloc-2.3.1/wscript 2019-12-16 09:14:22.000000000 +0000 +++ talloc-2.3.3/wscript 2021-07-15 07:04:32.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.3.1' +VERSION = '2.3.3' import os import sys