The branch, master has been updated via 8090046 pyntdb: Fix init function for ntdb python module. via fa332b7 s4-python: Override SIGINT handler in scripts only. from c034ff7 s3: Slightly simplify is_stat_open
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 809004689a5ec60066d1ae26e9599ec09895c46c Author: Pierre Lejeune <superhe...@gmail.com> Date: Tue Sep 25 20:56:37 2012 +0200 pyntdb: Fix init function for ntdb python module. Signed-Off-By: Jelmer Vernooij <jel...@samba.org> Autobuild-User(master): Jelmer Vernooij <jel...@samba.org> Autobuild-Date(master): Tue Sep 25 22:40:39 CEST 2012 on sn-devel-104 commit fa332b71dc71d23f1475ed6c25a6376934ab652a Author: Jelmer Vernooij <jel...@samba.org> Date: Tue Sep 25 20:49:22 2012 +0200 s4-python: Override SIGINT handler in scripts only. Override the SIGINT handler in a few select cases only, rather than doing so in one of the samba Python modules. I've done this where it matters most; we can add this code to other scripts too if necessary. This means that importing the 'samba' module from a third party application does not have side-effects on the state of the signal handlers. Bug: https://bugzilla.samba.org/show_bug.cgi?id=9068 ----------------------------------------------------------------------- Summary of changes: lib/ntdb/pyntdb.c | 4 ++-- source4/scripting/bin/samba-tool | 7 +++++++ source4/scripting/bin/samba_upgradeprovision | 6 ++++++ source4/scripting/bin/smbstatus | 8 +++++++- source4/scripting/bin/subunitrun | 6 ++++++ source4/scripting/python/pyglue.c | 7 ------- 6 files changed, 28 insertions(+), 10 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/ntdb/pyntdb.c b/lib/ntdb/pyntdb.c index 1037f3c..e4965fb 100644 --- a/lib/ntdb/pyntdb.c +++ b/lib/ntdb/pyntdb.c @@ -550,8 +550,8 @@ static PyMethodDef ntdb_methods[] = { { NULL } }; -void inittdb(void); -void inittdb(void) +void initntdb(void); +void initntdb(void) { PyObject *m; diff --git a/source4/scripting/bin/samba-tool b/source4/scripting/bin/samba-tool index 8ec6514..bb96626 100755 --- a/source4/scripting/bin/samba-tool +++ b/source4/scripting/bin/samba-tool @@ -1,6 +1,7 @@ #!/usr/bin/env python # Unix SMB/CIFS implementation. +# Copyright (C) Jelmer Vernooij <jel...@samba.org> 2008-2012 # Copyright (C) Amitay Isaacs <ami...@gmail.com> 2011 # Copyright (C) Giampaolo Lauria <laur...@yahoo.com> 2011 # @@ -23,6 +24,12 @@ import sys # Find right direction when running from source tree sys.path.insert(0, "bin/python") +# make sure the script dies immediately when hitting control-C, +# rather than raising KeyboardInterrupt. As we do all database +# operations using transactions, this is safe. +import signal +signal.signal(signal.SIGINT, signal.SIG_DFL) + from samba.netcmd.main import cmd_sambatool cmd = cmd_sambatool() subcommand = None diff --git a/source4/scripting/bin/samba_upgradeprovision b/source4/scripting/bin/samba_upgradeprovision index 344d7f5..54ffbea 100755 --- a/source4/scripting/bin/samba_upgradeprovision +++ b/source4/scripting/bin/samba_upgradeprovision @@ -66,6 +66,12 @@ from samba.upgradehelpers import (dn_sort, get_paths, newprovision, print_provision_ranges) from samba.xattr import copytree_with_xattrs +# make sure the script dies immediately when hitting control-C, +# rather than raising KeyboardInterrupt. As we do all database +# operations using transactions, this is safe. +import signal +signal.signal(signal.SIGINT, signal.SIG_DFL) + replace=2**FLAG_MOD_REPLACE add=2**FLAG_MOD_ADD delete=2**FLAG_MOD_DELETE diff --git a/source4/scripting/bin/smbstatus b/source4/scripting/bin/smbstatus index 055753b..7ff98df 100755 --- a/source4/scripting/bin/smbstatus +++ b/source4/scripting/bin/smbstatus @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # provide information on connected users and open files -# Copyright ǒ Jelmer Vernooij 2008 +# Copyright (c) Jelmer Vernooij 2008 # # Based on the original in EJS: # Copyright Andrew Tridgell 2005 @@ -11,6 +11,12 @@ import os, sys +# make sure the script dies immediately when hitting control-C, +# rather than raising KeyboardInterrupt. As we do all database +# operations using transactions, this is safe. +import signal +signal.signal(signal.SIGINT, signal.SIG_DFL) + sys.path.insert(0, "bin/python") import optparse diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun index df46b08..15a78bf 100755 --- a/source4/scripting/bin/subunitrun +++ b/source4/scripting/bin/subunitrun @@ -28,6 +28,12 @@ import sys +# make sure the script dies immediately when hitting control-C, +# rather than raising KeyboardInterrupt. As we do all database +# operations using transactions, this is safe. +import signal +signal.signal(signal.SIGINT, signal.SIG_DFL) + # Find right directory when running from source tree sys.path.insert(0, "bin/python") diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index cc312ba..c21de46 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -244,12 +244,5 @@ void init_glue(void) PyModule_AddObject(m, "version", PyString_FromString(SAMBA_VERSION_STRING)); - - /* one of the most annoying things about python scripts is - that they don't die when you hit control-C. This fixes that - sillyness. As we do all database operations using - transactions, this is also safe. - */ - signal(SIGINT, SIG_DFL); } -- Samba Shared Repository