The branch, master has been updated via 454edac python: call fault_setup() if samba.getopt is used via 3ddd852 python: export fault_setup() to python bindings from b9a323a python/drs_utils: fix repeated typo
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 454edac226bc87b9e68bc60add4c16f4bab9c275 Author: Stefan Metzmacher <me...@samba.org> Date: Fri May 25 07:52:40 2018 +0200 python: call fault_setup() if samba.getopt is used This means we have a samba command line tool written in python, e.g. samba-tool We should get the samba typicall backtraces instead of just "Segmentation fault (core dumped)". BUG: https://bugzilla.samba.org/show_bug.cgi?id=13469 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org> Autobuild-Date(master): Tue Jun 12 11:04:55 CEST 2018 on sn-devel-144 commit 3ddd8527104f7364c07816fd9d3f1039a396a2f9 Author: Stefan Metzmacher <me...@samba.org> Date: Fri May 25 07:52:02 2018 +0200 python: export fault_setup() to python bindings BUG: https://bugzilla.samba.org/show_bug.cgi?id=13469 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: python/pyglue.c | 12 ++++++++++++ python/samba/__init__.py | 1 + python/samba/getopt.py | 2 ++ 3 files changed, 15 insertions(+) Changeset truncated at 500 lines: diff --git a/python/pyglue.c b/python/pyglue.c index 68b14a0..1b11186 100644 --- a/python/pyglue.c +++ b/python/pyglue.c @@ -170,6 +170,16 @@ static PyObject *py_get_debug_level(PyObject *self) return PyInt_FromLong(DEBUGLEVEL); } +static PyObject *py_fault_setup(PyObject *self) +{ + static bool done; + if (!done) { + fault_setup(); + done = true; + } + Py_RETURN_NONE; +} + static PyObject *py_is_ntvfs_fileserver_built(PyObject *self) { #ifdef WITH_NTVFS_FILESERVER @@ -339,6 +349,8 @@ static PyMethodDef py_misc_methods[] = { "set debug level" }, { "get_debug_level", (PyCFunction)py_get_debug_level, METH_NOARGS, "get debug level" }, + { "fault_setup", (PyCFunction)py_fault_setup, METH_NOARGS, + "setup the default samba panic handler" }, { "interface_ips", (PyCFunction)py_interface_ips, METH_VARARGS, "interface_ips(lp_ctx[, all_interfaces) -> list_of_ifaces\n" "\n" diff --git a/python/samba/__init__.py b/python/samba/__init__.py index 7b3c653..1a3b24b 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -381,6 +381,7 @@ def arcfour_encrypt(key, data): version = _glue.version interface_ips = _glue.interface_ips +fault_setup = _glue.fault_setup set_debug_level = _glue.set_debug_level get_debug_level = _glue.get_debug_level unix2nttime = _glue.unix2nttime diff --git a/python/samba/getopt.py b/python/samba/getopt.py index b33a5c0..3c819ae 100644 --- a/python/samba/getopt.py +++ b/python/samba/getopt.py @@ -34,6 +34,8 @@ class SambaOptions(optparse.OptionGroup): """General Samba-related command line options.""" def __init__(self, parser): + from samba import fault_setup + fault_setup() from samba.param import LoadParm optparse.OptionGroup.__init__(self, parser, "Samba Common Options") self.add_option("-s", "--configfile", action="callback", -- Samba Shared Repository