From 92e2046b81e9d0d93526baa7b8c61b9ba25fbb94 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 27 Apr 2009 10:39:22 -0500 Subject: [PATCH 1/3] Added additional check for pidfile writability to supybot-botchk. --- scripts/supybot-botchk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index bd9730fdf..d8a8801c7 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -111,6 +111,13 @@ if __name__ == '__main__': debug('Pid %s is not the bot.' % pid) if not foundBot: + # First, we check if the pidfile is writable. If not, supybot will just exit, + # so we go ahead and refuse to start it. + try: + file(options.pidfile, 'r+') + except EnvironmentError, e: + fatal('pidfile (%s) is not writable: %s', options.pidfile, e) + sys.exit(-1) debug('Bot not found, starting.') home = os.environ['HOME'] inst = popen2.Popen4('sh') From f51928d93b10095d8df001227750fbefc6e6db4a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 27 Apr 2009 11:09:37 -0500 Subject: [PATCH 2/3] 'debug' wasn't an imported log function, like I thought it was, assuming 'fatal' was also available. --- scripts/supybot-botchk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index d8a8801c7..3af4f3039 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -116,7 +116,7 @@ if __name__ == '__main__': try: file(options.pidfile, 'r+') except EnvironmentError, e: - fatal('pidfile (%s) is not writable: %s', options.pidfile, e) + debug('pidfile (%s) is not writable: %s', options.pidfile, e) sys.exit(-1) debug('Bot not found, starting.') home = os.environ['HOME'] From f159cb742a40c311e896fa120fb696316a5dfe01 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 27 Apr 2009 11:10:56 -0500 Subject: [PATCH 3/3] Seriously, I'll get this right one of these days... --- scripts/supybot-botchk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index 3af4f3039..f2924f49a 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -116,7 +116,7 @@ if __name__ == '__main__': try: file(options.pidfile, 'r+') except EnvironmentError, e: - debug('pidfile (%s) is not writable: %s', options.pidfile, e) + debug('pidfile (%s) is not writable: %s' % (options.pidfile, e)) sys.exit(-1) debug('Bot not found, starting.') home = os.environ['HOME']