Re: [PATCH] Add checks for new and tmp directories to mx_is_maildir()

Greg KH <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <2026020407-dosage-cavalry-8a82@gregkh>
On Wed, Feb 04, 2026 at 01:04:20PM +0800, Kevin J. McCarthy wrote:
> From: Kevin McCarthy <[email protected]>
> 
> This function is used by mx_get_magic() to check if a path is a
> maildir mailbox.  I believe it was only looking for "cur" to save on
> stat calls.
> 
> However, this can cause misbehavior in some cases.  The browser won't
> enter a (non-maildir) directory that contains only a subdirectory
> "cur".  On the other other hand, mutt relies on the "tmp" and "new"
> subdirectories existing or fails operations, such as append to
> mailbox, or postponing mail.
> ---
> Just going through some branches I'd accumulated over the  past few years.
> 
> I'm sure I don't need to ask for feedback, but this is a tradeoff of a
> couple stat calls for correct behavior in some less common situations.
> Thoughts?

Yes!  I've been burned by this in the past when I had a maildir tree
without all 3 directories, where mutt could read the mail just fine, but
other tools couldn't.  It was my fault in creating the maildir tree that
way, but took me forever to figure out what was wrong :)

So the patch looks good to me.

thanks,

greg k-h
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.