From: Love, J. <Jay...@us...> - 2002-02-07 18:21:46
|
I just added this as a fix for a race condition. It uses the standard python tempfile utility, which I guess never considered that case. We'll get your patch or something appropriate applied. Jay > -----Original Message----- > From: Fionn Behrens [mailto:Fio...@un...] > Sent: Thursday, February 07, 2002 1:13 PM > To: web...@li... > Subject: [Webware-devel] Bug in CVS PSP engine (patch included) > > > > > Hello folks, > > > today I decided to update my 0.6something to CVS. The first > thing I found was > a bug ;-) > > The PSP Servlet engine writes a temp file in /tmp and later > os.rename()s it to > the actual servlet file. > > If /tmp and Webware are not on the same file system, this will fail. > Of course I have no idea how long the bug is already there. > > The single line fix below provides a quick solution. Finding > a perhaps more > appropriate temp dir may be up to Chuck or Geoff or whoever > maintains PSP. > The diff is also attached. > > Thanks, > Fionn > > > --------8<----------------8<---------------8<---------------8<------- > > *** ServletWriter.py.orig Thu Feb 7 18:46:53 2002 > --- ServletWriter.py Thu Feb 7 19:00:25 2002 > *************** > *** 33,52 **** > --- 33,53 ---- > > ''' This file creates the servlet source code. Well, > it writes it out > to a file at least.''' > > TAB = '\t' > SPACES = ' ' # 4 spaces > EMPTY_STRING='' > > def __init__(self,ctxt): > > self._pyfilename = ctxt.getPythonFileName() > + tempfile.tempdir = os.path.dirname(self._pyfilename) > self._temp = tempfile.mktemp('tmp') > self._filehandle = open(self._temp,'w+') > self._tabcnt = 0 > self._blockcount = 0 # a hack to handle > nested blocks of > python code > self._indentSpaces = self.SPACES > self._useTabs=1 > self._useBraces=0 > self._indent='\t' > self._userIndent = self.EMPTY_STRING > > ---------------------------------------------------------------------------- This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation. ---------------------------------------------------------------------------- |