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

Alejandro Colomar via Mutt-dev <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <aYNLrmWOBq_RwSI7@devuan>
Hi Crystal,

On 2026-02-04T10:30:52+0000, Crystal Kolipe via Mutt-dev wrote:
> On Wed, Feb 04, 2026 at 01:04:20PM +0800, Kevin J. McCarthy wrote:
> > 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?
> 
> This could plausibly break things for anyone who has written one or more old
> maildir directories to a read-only medium, and to save space has removed the
> empty 'new' and 'tmp' directories.
> 
> On the other hand, implementing this change would discourange users from doing
> the same thing going forward, so overall I think it's the correct approach.
> 
> Would it make sense to drop the check for 'new' and 'tmp' IFF 'cur' can only
> be opened read-only?

I'd keep it simple.  Complexity is dangerous, and users that do this
should be aware of what they're doing, and fix their maildir.


Have a lovely day!
Alex

> 
> Admittedly, anybody who removes 'tmp' and 'new' has already created a
> non-standard directory structure that other programs would not be guaranteed
> to recognise.  But that doesn't mean that somebody out there hasn't done it.
> 
> Maybe have the 'missing new and tmp, but on a read-only medium' case throw a
> warning, and see if anybody ever mentions seeing the warning.  If not, remove
> the workaround after a couple of years.

-- 
<https://www.alejandro-colomar.es>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmmDTAkACgkQ64mZXMKQ
wqkzzhAAqbWXMbAT9fPjpaI/yq1Tkpt/jTO0E9/PTiVUBN1Q/lYP+eVzK7X7tpFZ
18VV+f2xYSvuu6cIxyiVJ0+HYn924qBymh85RH+jr7+FtJfrVXcUCLDkXBHm1vwx
At80uSrgK/wAnxubjkj/Uw5tPecACEEvp/klGwthf9JOWm9w8lvahXTyYt9k0UO2
P7+rag6ohHFKB/esp65gyT9Flar3A1saFgcjAInIZuoe4QyiSFg8XlqdMotx9S4H
RFH0RV+mMyhWBpKyTE/L8AfIaKLt8WaFtN4SonbmQ/ZSLE0FRRDlur3vGrH9aeNs
/BJH/lj0u4mpXZSexx6IDVwkQJYyfJrbPj3pPYMj9cAd04uQUYK/e9lKXD8AknkX
fxtIaJ3MR4Ipnli422k3mY0sqldKfXwBAapkEbSgDqwEWzY547L3ScbwDzX2ltQ5
7aTbq1+Iuq1YXRGfnwoJbrGqv5hWQXKaLDhEydr3XlQg4SNpXxKz4waTXrc4lSQg
iRHjrukkDqJLfm45FwmQMilDAriAcgbihxti8lJHfVQZ4Hs3ecRM4Qcyc/nBRvSu
MtybxI2FV1rYEQnlLsWLT+yxhuDp0SsxVHSl1C3N8IoJNzlh2Zh+d2LXoy4aP6bm
pvPcc67vntVwxZCY95QIn7uowJ+Pe/dYHSlkSr8RRM5N+pfKrNc=
=x5RN
-----END PGP SIGNATURE-----
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.