Subject: Re: bug#5291: 23.1.91; "bzr status" FAILED

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Jan 2010 10:05:44 +0200

> Date: Sun, 3 Jan 2010 12:10:06 -0800 (PST)
> From: Dan Nicolaescu <[email-masked]>
> Cc: [email-masked]
> 
> It seems that this is actually a combination of bzr "features": putting
> a temporary file in a versioned directory plus the fact that "bzr status" blocks 
> when a commit is in progress (i.e. a read lock blocks when a write lock
> is on).
> 
>   > It would be nice if I could tell Bazaar to put those bzr_log.FOO files
>   > under $TMPDIR, but there doesn't seem to be a way of doing that.
>   > Anyone?
>   > 
>   > Any ideas for how best to resolve this?
> 
> Not sure we want to do something in emacs about this, it looks like bzr
> needs fixing.

First, it turns out this happens on GNU/Linux as well, at least if one
invokes "bzr status" while "bzr ci" is waiting for emacsclient.

The solution, suggested by John Arbash Meinel on the Bazaar mailing
list, is to patch msgeditor.py, a bzr module, as shown in the patch
below.  This will cause Bazaar to create the bzr_log.* files in the
system temporary directory, so Emacs will not try to run "bzr status"
on it.

If you are on Windows, and installed Bazaar with a standalone
installer, then you will need to download from the Bazaar site the
sources of Bazaar that correspond to your installed version.  Then
locate library.zip, remove from it bzrlib/mzgeditor.pyo, and add the
patched bzrlib/mzgeditor.py.

If you are on Unix or GNU system, you will need to talk to your
sysadmin about replacing msgeditor with a patched version.

--- bzrlib/msgeditor.py~	2010-01-08 23:36:47.257578300 +0200
+++ bzrlib/msgeditor.py	2010-01-09 09:51:45.472750000 +0200
@@ -215,8 +215,9 @@
     """
     import tempfile
     tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.',
+#                                              dir='.',
                                                text=True)
-    msgfilename = osutils.basename(msgfilename)
+#   msgfilename = osutils.basename(msgfilename)
     msgfile = os.fdopen(tmp_fileno, 'w')
     try:
         if start_message is not None: