Re: [PATCH] Add checks for new and tmp directories to mx_is_maildir()
Steffen Nurpmeso <[email protected]>
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <20260206234833.Oz_ILMSJ@steffen%sdaoden.eu> |
Gero Treuner wrote in <[email protected]>: |On Fri, Feb 06, 2026 at 02:37:36PM +0100, Alejandro Colomar via Mutt-dev \ |wrote: ... |> Except that maybe with fstatat(2) (as Crystal said) it could be readable |> --we'd have to see the code, though--. |> |> readability >>> optimizations | |Thank you and others for the feedback. | |A quick research shows that fstatat(2) isn't a good option: | |1) Even on Linux it was introduced no earlier than with glibc 2.4, so | this makes a case for portability fiddling with automake etc. | |2) The directory needs to be opened with a file descriptor, which adds | resource handling. | I don't see consistency of the directory in the event that by | mounting etc. the file system changes as a benefit here. IMO it is | fine to fail for a test of a mail folder when something looks fishy. | (Otherwise the test could succeed for a place which isn't available | any more.) Btw i changed to Courier mail server style names in 2017, which i think also dovecot uses (or surely used to use in 2017 when i looked around). "I" am *not* entirely compatible with the behavior that they document for what i thought was the quasi standard of Maildir, their document, as attached, because they require renaming time.MusecPpid.host / time.MusecPpid_unique.host to time.MusecPpidVdevIino.host,S=cnt / time.MusecPpidVdevIino_unique.host,S=cnt when moving from tmp/ to new/, and more a bit "strange things" (i have never looked when the document was created; must be after 1996 though, in BSD O_EXCL was implemented around July 1983, so some TOCTOU in the document must likely be NFS related, but then the create+link+stat+test-link-count dance was also known quite a bit before Maildir was invented, i would think). Anyhow, "dev" and "ino" are part of their filename style. |But the same gain of readability could probably be achieved by other |means. (Let's see when I'll come back to puzzling ...) ... --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)
maildir.txt.zst
(application/zstd, 4.7 KB) - not displayed