Subject: c-client library error - question?

From: Matthew Clark <[email-masked]>
Date: Thu, 7 Feb 2002 10:13:33 +0000 (GMT)

Dear list,

I am using c-client for an automated email database but I keep
running into a c-client fatal error and I am unsure how to
handle it, I am also worried that c-client does not handle the
error gracefully-

uname -a
SunOS norton 5.7 Generic sun4m sparc SUNW,SPARCstation-10
c-client built with os-type gso.
mail system Exim, inbox on NFS mounted disk

There error I run into originates in imap/src/osdep/flocksim.c
in master() and is the "default" event in the switch statement

 ....
 default:  /* random lossage */
 s = "Unknown event from execution process: ";
 sprintf (t = (char *) fs_get (strlen (s) + strlen (tmp) +1),"%s:%s",
                  s,tmp);
         fatal (s);
       }

This calls mm_fatal and leads to an undignified end to my
program.

There seems to be a problem with the error message reporting
because the string mm_fatal gets looks like this "Unknown event
from execution process: :Testing c-client for reading mail"--

The second string "Testing.." is incorrect and appears only in a
printf statement in the main() of my program- leading me to
believe that the error results from tmp pointing to the
incorrect location.

The circumstances of the error are also difficult- my program
work continually through development but start throwing this
error when I used cron to run the program- It appears once the
error starts it persists for "a while" through several different
instances of my program before suddenly disappearing-

The bit of my code that provokes the error looks like this

pmessage("Now I am going to copy a message to %s\n",message_store);
sprintf(tmp,"%d",i);
err=mail_copy(in,tmp,message_store);

Any hints / clues or suggestions? c-client causes a core dump at
this point and the intermittant nature of the fault and
complicated nature of c-client is making debugging rather
difficult.

 Thanks for any help

 matt

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

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

---

From: Manjula Dinesh <[email-masked]>
Date: Thu, 07 Feb 2002 17:39:21 +0600

Hello,

Will somebody tell me more details about the licensing module of c-client
library. I am planing to write a IMAP client using the library and would
like to know the issues when redistributing.

Thanks

-Manjula

---

From: Mark Crispin <[email-masked]>
Date: Thu, 7 Feb 2002 09:15:45 -0800 (PST)

"Unknown event from execution process" means that you did a printf() in a
restricted callback (an mm_???() function) which is not allowed to do
printf()s.

Callbacks must not do I/O to stdio.  Treat them like signals.

---

From: Mark Crispin <[email-masked]>
Date: Thu, 7 Feb 2002 09:19:25 -0800 (PST)

I have forwarded your message to [email-masked].

Be sure to read the terms of the free-fork license.  If your use complies with
those terms, then you do *NOT* need any other license.

---

From: "Jaldhar H. Vyas" <[email-masked]>
Date: Thu, 7 Feb 2002 12:41:24 -0500 (EST)

> like to know the issues when redistributing.

If the terms of license are unclear to you, you really ought to consult a
lawyer in your jurisdiction.  It will save some possible nasty surprises
later on.

c-client meets the Debian Free Software Guidelines.  It basically gives
you all the essential freedoms--to redistribute, fork, or modify the
software as you see fit.  Like the GPL, you are required to make any
modifications public plus you have to change the version number and
documentation in such a way as to make clear it is not the original
distribution from UW.

-- 
Jaldhar H. Vyas <[email-masked]>
It's a girl! See the pictures - http://www.braincells.com/shailaja/

---

From: Matthew Clark <[email-masked]>
Date: Thu, 7 Feb 2002 18:49:36 +0000 (GMT)

Mark, list,

I have tried (1) using the exact same callbacks as mtest and (2)
using do nothing at all callbacks (no IO whatsoever) and I get
the exact same problem- I had before (random crashes).  I bunged
a printf into the start of master to see what master() is
parsing (see previous mail) like so

"flocksim.c" line 306 of 788 --38%--
    while (fgets (tmp,MAILTMPLEN,pi)) {
        printf("FGETS got:\"%s\"\n",tmp);

and this produces
FGETS got:"Testing c-client for reading mail
"

which is a printf message in my main()

This <mainly> occurs when I run my program from a cron job- If i
run it from a from the command line it seems (mostly) fine- the
intermittant nature of this is rather difficult.

matt

Mark Crispin wrote:
> "Unknown event from execution process" means that you did a
> printf() in a restricted callback (an mm_???() function)
> which is not allowed to do printf()s.
>

---

From: Mark Crispin <[email-masked]>
Date: Thu, 7 Feb 2002 10:55:38 -0800 (PST)

Did you do an fflush(stdout) before calling c-client?