From: Evil Boris <evilborisnet@netscape.net>
Subject: Re: RMAIL file locking problem?
Date: Sat, 30 Apr 2005 16:05:38 -0400 [thread overview]
Message-ID: <uacngf2st.fsf@boris.laptop> (raw)
In-Reply-To: E1DRJ8V-0004ZX-2L@fencepost.gnu.org
Richard Stallman <rms@gnu.org> writes:
> As far as I can tell, it is the following code:
>
> (if file-name
> (rmail-insert-inbox-text files nil)
> (setq delete-files (rmail-insert-inbox-text files t)))
>
> Ok, it seems natural that this would lock the current buffer.
> It is trying to insert something.
>
> On my machine the locking trouble seems to happen when there is no new
> mail. My understanding is that RMAIL reads in the contents of the
> (empty!) mailbox (by the way, would it make sense to check for 0
> length and just skip the rest of jumping through hoops in this
> case---no locking, no inserting of zero bytes, no testing for having
> inserted zero bytes?)
>
> It seems strange that insert-file-contents would leave the buffer
> locked if it does not really change the buffer. That could be a bug
> in insert-file-contents: that it handles the zero-size case wrong.
I may have found the problem. I leave the rest of my blabberings (the
note I was editing before I discovered this) at the end, just in case
it gives any further clues...
As Richard has suggested, the problem may be in insert-file-contents.
I was very reluctant to believe it, but now I am almost certain it is
true, as I have repeatedly observed insert-file-contents called from
rmail-insert-inbox-text, returning 0 as the number of bytes read, with
the effect of leaving the underlying buffer (visiting ~/RMAIL in this
case) locked.
Can anyone confirm this, or give me some hints of how to indentify the
circumstances when it happens?
Thanks in advance,
--Boris
=========================
I am not very good at C-level debugging Emacs (nor Lisp-level, for
that matter). I have been able somewhat reliably (but no very
predictably, as in "I cannot tell how we get there") get Emacs into a
state where there is no new mail, ~/RMAIL is unlocked, I type "g", and
after checking the mail ~/RMAIL is locked. No message is "unseen".
(I can force a removal of the lock by making ~/RMAIL explicitly
modified by "t" "t" and the "s"aving. After that, the lock
disappears. It reappears in the next "g".)
Any hints at what to look for? I tried stepping through most of
rmail-get-new-mail, but it does an excruciating number of
file-name-rewriting and other odd operations.
Or could one check the C code for "insert-file-contents"? Does it
mark the buffer modified if 0 bytes were read. (BTW I looked at the
C code there and it seems to say that it is not safe to ask the file
descriptor for file size [eg if /proc file system] so my earlier
suggestion of checking the file size of the mailbox before trying to
insert its contents might not make as much sense I thought...)
In short, I seem to be able to get Emacs somewhat predictable into a
strange state. What data do I need to collect to try and figure out
what's going on?
--Boris
PS. BTW, I did notice that on non-empty mboxes for some reason (before
saving modified ~/RMAIL after the mailbox has been read in), the
mailbox is locked twice. I first thought it very odd. Then I realize
the first lock was in rmail-insert-inbox-text (when new stuff is
inserted) and the second was in save-buffer, after Babyl-ifying the
new data. The first seems to happen for empty mailbox too. Or does it?
next prev parent reply other threads:[~2005-04-30 20:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-19 16:16 RMAIL file locking problem? Evil Boris
2005-04-20 14:56 ` Richard Stallman
2005-04-28 4:03 ` Evil Boris
2005-04-29 0:13 ` Richard Stallman
2005-04-30 20:05 ` Evil Boris [this message]
2005-05-01 23:37 ` Richard Stallman
2005-05-10 3:03 ` Evil Boris
2005-05-11 16:28 ` Richard Stallman
2005-05-12 0:32 ` Evil Boris
2005-05-12 14:54 ` Richard Stallman
2005-05-14 3:46 ` Evil Boris
2005-05-14 15:13 ` Richard Stallman
2005-05-14 4:17 ` Evil Boris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=uacngf2st.fsf@boris.laptop \
--to=evilborisnet@netscape.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).