[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: Krashmail (was: re: kmail weirdness)
From:       Ingo =?iso-8859-1?q?Kl=F6cker?= <ingo.kloecker () epost ! de>
Date:       2001-06-29 23:59:49
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First of all, I can't reproduce the crash by restarting KMail with only 
the buggy message in the inbox. KMail simply views the message after 
startup. And on the console I see

gpg: Warning: using insecure memory!
gpg: CRC error; 9110ac - dc3911
gpg: quoted printable character in armor - probably a buggy MTA has 
been used

On Friday, 29. June 2001 19:35, Marc Mutz wrote:
> On Friday 29 June 2001 15:55, Don Sanders wrote:
> > I guess gpg is abnormally terminating.

I doubt that. I guess it's terminating normally with an error message.

> > I suspect gpg is being passed extraneous data, that is
> > causing it to terminate. But it is confusing that you can
> > only reproduce the problem sometimes and that I can't
> > reproduce the problem at all.
>
> GnuPG people: Is the below picture correct? Does GnuPG behave like
> this?
>
> Timing problem? GPG exits as soon as it encounters the garbage
> character? KMail doesn't recognize this and happily keeps on writing
> to the pipe? Sometimes KMail gets this extra slice of CPU time that
> allows it to write the last line before gpg gets to read the line
> before?
[snip]
> ******** vvv Below we write broken line vvvvv ****
> write(20, "/uls/xpaRkDpK+a+q8ICRqU=3D\n", 27) = 27
> poll([{fd=21, events=POLLIN}], 1, 0)    = 0
> poll([{fd=20, events=POLLOUT, revents=POLLOUT}], 1, 5) = 1
> write(20, "=3DkRCs\n", 8)               = 8
> poll([{fd=21, events=POLLIN}], 1, 0)    = 0
> poll([{fd=20, events=POLLOUT, revents=POLLOUT|POLLERR}], 1, 5) = 1
> --- SIGCHLD (Child exited) ---
> write(20, "-----END PGP SIGNATURE-----\n", 28) = -1 EPIPE (Broken
> pipe) --- SIGPIPE (Broken pipe) ---
> +++ killed by SIGPIPE +++

I think I found the problem. In the last poll before the crash 
revents==POLLOUT|POLLERR which means that the pipe broke (POLLERR). 
Unfortunately I checked first for POLLOUT and assumed that if the 
POLLOUT bit is set there wouldn't be a problem.

The attached patch should fix this bug.

Regards,
Ingo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7PRZ7GnR+RTDgudgRAsxgAJ9kC5x6pkWb/Y4pMhJbSSBPxCOP4QCeMJo6
dnkZ19suffRJzI0e3endTQ4=
=7K2q
-----END PGP SIGNATURE-----

["fix_broken_pipe_crash-2001-06-30.diff" (text/x-c++)]

Index: kpgpbase.cpp
===================================================================
RCS file: /home/kde/kdenetwork/libkdenetwork/kpgpbase.cpp,v
retrieving revision 1.10
diff -u -3 -p -r1.10 kpgpbase.cpp
--- kpgpbase.cpp	2001/06/17 20:14:41	1.10
+++ kpgpbase.cpp	2001/06/29 23:47:41
@@ -284,7 +284,11 @@ KpgpBase::runGpg(const char *cmd, const 
       if (pollstatus == 1) {
         //kdDebug(5100) << "Status for polling pin[1]: "
         //              << pollin.revents << endl;
-        if (pollin.revents & POLLOUT) {
+        if (pollin.revents & POLLERR) {
+          kdDebug(5100) << "GnuPG seems to have hung up" << endl;
+          break;
+        }
+        else if (pollin.revents & POLLOUT) {
           // search end of next line
           if ((len2 = input.find('\n', i)) == -1)
             len2 = input.length()-i;
@@ -297,10 +301,6 @@ KpgpBase::runGpg(const char *cmd, const 
           //kdDebug(5100) << "Wrote " << len2 << " bytes to pin[1] ..."
           //              << endl;
         }
-        else if (pollin.revents & POLLERR) {
-          kdDebug(5100) << "GnuPG seems to have hung up" << endl;
-          break;
-        }
       }
       else if (!pollstatus) {
         kdDebug(5100) << "Timeout while polling pin[1]: "

_______________________________________________
Kmail Developers mailing list
Kmail@master.kde.org
http://master.kde.org/mailman/listinfo/kmail


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic