From b9d56c4682fae634afd603af477ef5328836f6b0 Mon Sep 17 00:00:00 2001 From: frisco <> Date: Sun, 30 Nov 2008 01:11:08 +0000 Subject: [PATCH] CherryPy now gets patched during Live CD build. Fixes defect #216. --- .../chroot_local-hooks/50cnas-cherrypy-fix.sh | 25 +++++++++++++++++++ .../cryptonas-live/_cpwsgiserver.py.diff | 20 +++++++++++++++ config/chroot_local-packageslists/cryptonas | 3 +++ 3 files changed, 48 insertions(+) create mode 100755 config/chroot_local-hooks/50cnas-cherrypy-fix.sh create mode 100644 config/chroot_local-includes/usr/share/cryptonas-live/_cpwsgiserver.py.diff diff --git a/config/chroot_local-hooks/50cnas-cherrypy-fix.sh b/config/chroot_local-hooks/50cnas-cherrypy-fix.sh new file mode 100755 index 0000000..b43d850 --- /dev/null +++ b/config/chroot_local-hooks/50cnas-cherrypy-fix.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# +# $Id: $ +# +# this script is part of the build process of CryptoNAS +# +# 2008-11-27 James Crofts backported workaround from CherryPy src repository. +# See http://www.cherrypy.org/ticket/686 and +# http://devel.cryptobox.org/ticket/216. +# + +## Stop the build process if any of the following steps fail +set -e + +##Hack to prevent intermittent cherrypy crashes at startup +DIFF="/usr/share/cryptonas-live/_cpwsgiserver.py.diff" +##These two files are identical before the patch and must be identical +##afterward as well: +patch /var/lib/python-support/python2.4/cherrypy/_cpwsgiserver.py < ${DIFF} +patch /usr/share/python-support/python-cherrypy/cherrypy/_cpwsgiserver.py < ${DIFF} +##Remove the now-obsolete "compiled" Python file. +rm -f /var/lib/python-support/python2.4/cherrypy/_cpwsgiserver.pyc diff --git a/config/chroot_local-includes/usr/share/cryptonas-live/_cpwsgiserver.py.diff b/config/chroot_local-includes/usr/share/cryptonas-live/_cpwsgiserver.py.diff new file mode 100644 index 0000000..78d79c4 --- /dev/null +++ b/config/chroot_local-includes/usr/share/cryptonas-live/_cpwsgiserver.py.diff @@ -0,0 +1,20 @@ +--- chroot/usr/share/python-support/python-cherrypy/cherrypy/_cpwsgiserver.py 2006-04-24 18:37:45.000000000 -0700 ++++ chroot/usr/share/cryptonas-live/_cpwsgiserver-copy.py 2008-11-27 22:53:49.000000000 -0700 +@@ -200,10 +200,17 @@ + response = request.wsgi_app(request.environ, + request.start_response) + for line in response: + request.write(line) + except socket.error, e: ++ msg = e.args[1] ++ if msg == "Bad file descriptor": ++ # Our socket was closed ++ return ++ if msg == "Resource temporarily unavailable": ++ # Just try again. See http://www.cherrypy.org/ticket/479. ++ return + errno = e.args[0] + if errno not in socket_errors_to_ignore: + traceback.print_exc() + except (KeyboardInterrupt, SystemExit), exc: + self.server.interrupt = exc diff --git a/config/chroot_local-packageslists/cryptonas b/config/chroot_local-packageslists/cryptonas index 2123daf..22c0d8d 100644 --- a/config/chroot_local-packageslists/cryptonas +++ b/config/chroot_local-packageslists/cryptonas @@ -37,6 +37,9 @@ e2fsprogs xfsprogs hfsutils jfsutils +## required for fix to Defect #216 "Intermittent Python crashes at startup": +patch + ## For better version management and development flexibility, "cryptobox-server" is ## now installed as a local package from "config/chroot_local-packages". #cryptobox-server