Subject: bug in unix mailbox driver?

From: Stefan Vacek <[email-masked]>
Date: Tue, 1 Aug 2000 17:05:32 -0700 (PDT)

Hi folks,

I tried the beta-release of the c-client lib from 07/03/2000 within pine 4.21
When I mark some messages deleted and expunge them, pine aborts with the
message "inconsistent file size".  Is this a bug in the c-client lib?

TIA
Stefan

		Stefan Vacek **** [email-masked]

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Tue, 1 Aug 2000 18:57:21 -0700 (PDT)

> message "inconsistent file size".  Is this a bug in the c-client lib?

Please forward to me a mailbox that demonstrates the problem along with
precise instructions on how to reproduce it.

It is preferable to send bug reports to me directly instead of the mailing
list.

---

From: Hollis Blanchard <[email-masked]>
Date: Wed, 02 Aug 2000 13:17:05 +0900

> message "inconsistent file size".  Is this a bug in the c-client lib?

For the record, I got the exact same thing, but only with local mailboxes.
Again, my call flow is:

mail_open
mail_search_full
mail_close(EXPUNGE)

mm_searched:
  mail_setflags(DELETED)

Subsequently examining the mailbox reveals a slightly screwed up file (the
mail seemed to be deleted, but then most of it was pasted again at the
bottom of the file). Maybe a memory glitch (missing a null terminator? who
knows...)

I reverted to imap-4.7c (I'm not sure I *need* imap-2000) and the problem
went away.

-Hollis

(I send this to the mailing list so that people experiencing similar
problems will know they're not alone.)

---

From: Mark Crispin <[email-masked]>
Date: Tue, 1 Aug 2000 23:57:59 -0700 (PDT)

>   mail_setflags(DELETED)

If this means that you are calling mail_setflags() from within your
mm_searched() function, you have violated a fundamental rule of c-client.

c-client routines can not be called recursively from a callback.  Please
reference the information in internal.txt, on the page labelled "Main Program
Callbacks".

More specifically, you MUST NOT call any mail_???() functions from any
mm_???() functions.

I understand that what you want to do is delete the messages that match the
search.  However, that is *NOT* the way to do it.

The easiest correct way is simply to have a dummy routine for mm_searched().
Then after the mail_search_full() completes, build a sequence text for all
messages which have elt->searched set, and then call mail_setflag() on the
generated sequence text.

> Maybe a memory glitch (missing a null terminator? who
> knows...)

What happened is that you corrupted c-client's memory structures with a
forbidden calling sequence.  This is a bug in your application, not c-client.

I'm really surprised about your claim that it works in imap-4.7c.  That's just
good luck.  Bad things are probably happening, you just don't realize it yet.

> problems will know they're not alone.)

Statements such as that make my life as the developer of c-client more
difficult.

It can be harmful to tell other people to run an older version.  In this case,
it is.  The problem that Stefan encountered has no relation to your problem,
and is *more* likely in imap-4.7c than imap-2000.

imap-2000 fixed all the cases of the problem Stefan encountered that I know
of.  If Stefan has discovered a problem that is unfixed in imap-2000, it is
one that I do not know about.  I am very eager to locate it and kill it.

I want to produce an excellent software product, and I need your help.  If you
encounter something that appears to be a bug in c-client, please contact me
directly with a bug report.  Detail the problem, and if possible provide me
with a procedure and/or sample data (e.g. message or mailbox) to demonstrate
the problem.  If the problem happens in your application, see if the problem
happens in one of the standard c-client applications (mtest, imapd, etc.).

There is certainly a place for anecdotes and folklore, particularly with
techniques and tricks to get c-client to do things that even I hadn't
anticipated.  But please(!!) let's not do this with bugs or perceived bugs.

There will be a new imap-2000 release candidate in about a week or so.  I'm
going through all the messages that came in while I was on vacation, and every
bug report and suggestion will be considered before the new release candidate
is packaged.  This is an excellent time to get bugs fixed prior to a major
release.

Thank you for listening.