<<< Date Index >>>     <<< Thread Index >>>

Re: [BETTER PATCH] Re: Bug#237426: Mutt segfaults on unreadable directories



On Sat, May 15, 2004 at 02:59:42AM +0200, Adeodato Simone wrote:

> Subject: [BETTER PATCH] Re: Bug#237426: Mutt segfaults on unreadable 
> directories
> To: TAKAHASHI Tamotsu <ttakah@xxxxxxxxxxxxxxxxx>, 237426@xxxxxxxxxxxxxxx
> In-Reply-To: <20040514223902.GA46911%ttakah@xxxxxxxxxxxxxxxxx>
> X-No-CC: Please respect my Mail-Followup-To header

I found no Mail-Followup-To in your message header.


> * TAKAHASHI Tamotsu [Sat, 15 May 2004 07:39:02 +0900]:
> 
> > Then, I might have done something wrong.
> > Sorry for the wrong information. I was foolish.
> 
>   we all make mistakes. no need to feel sorry about it. ;-)

Thank you.


> > On Fri, May 14, 2004 at 10:26:18AM +0200, Adeodato Simone wrote:
> > >   (1) and, as the last directory is remembered, you can't ever return to
> > >       browser mode again.
> 
>   i've improved a little the one-line patch. i've tested it and seems
>   to work properly (now mutt always stays in browser mode, and only
>   remembers the last directory if it was successfully read).
> 
>   can you test it yourself to see if it behaves and then, perhaps (if
>   works), forward it to mutt-dev@xxxxxxxx? (i'm not subscribed)

Your patch causes segfault with:
c       #change mailbox
?       #browser mode
c       #change directory
/root\n #unreadable
q       #back to index mode
c       #change mailbox
?       #browser mode
c       #change directory
/\n     #normal directory

I gave up. Maybe we have to "goto bail;" when
hitting an unreadable dir.

Try this patch. This is probably an original
idea of the author. And no segfaults so far.
(Mutt suddenly quits when hitting an unreadable
directory, though.)

-- 
tamo
--- browser.c.old       Wed Nov  5 18:41:31 2003
+++ browser.c   Sat May 15 12:17:14 2004
@@ -944,10 +944,10 @@
          {
            if (S_ISDIR (st.st_mode))
            {
-             strfcpy (LastDir, buf, sizeof (LastDir));
              destroy_state (&state);
-             if (examine_directory (menu, &state, LastDir, prefix) == 0)
+             if (examine_directory (menu, &state, buf, prefix) == 0)
              {
+               strfcpy (LastDir, buf, sizeof (LastDir));
                menu->current = 0; 
                menu->top = 0; 
                init_menu (&state, menu, title, sizeof (title), buffy);
@@ -955,7 +955,6 @@
              else
              {
                mutt_error _("Error scanning directory.");
-               destroy_state (&state);
                mutt_menuDestroy (&menu);
                goto bail;
              }