classification
Title: mailbox.Maildir should ignore files named with a leading dot
Type: behavior Stage: patch review
Components: email, Library (Lib) Versions: Python 3.8, Python 3.7, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Vincentdavis, ZackerySpytz, barry, liw, mdengler, r.david.murray
Priority: normal Keywords: patch

Created on 2014-04-26 22:06 by liw, last changed 2019-02-12 23:20 by ZackerySpytz.

Pull Requests
URL Status Linked Edit
PR 11833 open ZackerySpytz, 2019-02-12 23:16
Messages (3)
msg217221 - (view) Author: Lars Wirzenius (liw) Date: 2014-04-26 22:06
The maildir format specification
(see http://cr.yp.to/proto/maildir.html) is clear that files named with leading dots should be ignore:

  Unless you're writing messages to a maildir, the format of a unique 
  name is none of your business. A unique name can be anything that 
  doesn't contain a colon (or slash) and doesn't start with a dot. Do not
  try to extract information from unique names.

Test case:

liw@havelock$ find Maildir -ls
8921206    4 drwxrwxr-x   5 liw      liw          4096 Apr 26 23:03 Maildir
8921207    4 drwxrwxr-x   2 liw      liw          4096 Apr 26 23:03 Maildir/cur
8921209    4 drwxrwxr-x   2 liw      liw          4096 Apr 26 23:03 Maildir/tmp
8921208    4 drwxrwxr-x   2 liw      liw          4096 Apr 26 23:03 Maildir/new
8913523    0 -rw-rw-r--   1 liw      liw             0 Apr 26 23:03 Maildir/new/.foo
liw@havelock$ python -c 'import mailbox
maildir = mailbox.Maildir("Maildir")
print maildir.keys()
'
['.foo']
liw@havelock$ 

The correct output would be the empty list.

"mutt -f Maildir" correctly shows now messages in that folder.
msg218557 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-05-14 17:59
I wonder if changing this would break any working programs.  I'd like to think not, but it is certainly possible for someone to be actually depending this bug.
msg335375 - (view) Author: Zackery Spytz (ZackerySpytz) * Date: 2019-02-12 23:20
I've created a PR for this issue.
History
Date User Action Args
2019-02-12 23:20:09ZackerySpytzsetnosy: + ZackerySpytz

messages: + msg335375
versions: + Python 3.7, Python 3.8
2019-02-12 23:16:06ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request11864
2015-02-12 06:06:55mdenglersetnosy: + mdengler
2015-01-03 04:37:50Vincentdavissetnosy: + Vincentdavis
2014-12-31 16:25:32akuchlingsetnosy: - akuchling
2014-05-14 17:59:55r.david.murraysetnosy: + barry, akuchling, r.david.murray
messages: + msg218557
components: + email
2014-04-26 22:06:43liwcreate