~sircmpwn/aerc2#323: 
maildir: index out of range when opening a non-empty folder

Just compiled aerc 0.3.0, however when moving to a non-empty folder I get an index out of range:

panic: runtime error: index out of range [1] with length 1
goroutine 14 [running]:
github.com/emersion/go-maildir.Dir.Flags(0xc00031d8c0, 0x23, 0xc000708300, 0x21, 0xc000384060, 0x0, 0x0, 0x0, 0xfc60031dec0)
/home/michele/go/pkg/mod/github.com/emersion/go-maildir@v0.0.0-20190727102040-941194b0ac70/maildir.go:224 +0x31b
git.sr.ht/~sircmpwn/aerc/worker/maildir.Message.Flags(...)
/home/michele/dev/tools/aerc/worker/maildir/message.go:39
git.sr.ht/~sircmpwn/aerc/worker/maildir.(*Worker).getDirectoryInfo(0xc0000ae550, 0x23)
/home/michele/dev/tools/aerc/worker/maildir/worker.go:141 +0x219
git.sr.ht/~sircmpwn/aerc/worker/maildir.(*Worker).handleOpenDirectory(0xc0000ae550, 0xc0002b0780, 0xc000094600, 0xc00018df78)
/home/michele/dev/tools/aerc/worker/maildir/worker.go:267 +0x339
git.sr.ht/~sircmpwn/aerc/worker/maildir.(*Worker).handleMessage(0xc0000ae550, 0xaaa840, 0xc0002b0780, 0xaaa840, 0xc0002b0780)
/home/michele/dev/tools/aerc/worker/maildir/worker.go:170 +0xdc
git.sr.ht/~sircmpwn/aerc/worker/maildir.(*Worker).handleAction(0xc0000ae550, 0xaaa840, 0xc0002b0780)
/home/michele/dev/tools/aerc/worker/maildir/worker.go:58 +0x73
git.sr.ht/~sircmpwn/aerc/worker/maildir.(*Worker).Run(0xc0000ae550)
/home/michele/dev/tools/aerc/worker/maildir/worker.go:49 +0x13d
created by git.sr.ht/~sircmpwn/aerc/widgets.NewAccountView
/home/michele/dev/tools/aerc/widgets/account.go:74 +0x49b
Status
RESOLVED FIXED
Submitter
~mmf
Assigned to
No-one
Submitted
10 months ago
Updated
9 months ago
Labels
bug maildir

~benburwell 10 months ago

What software is creating your maildir? It looks like the mail files aren't being created with the expected names.

~mmf 10 months ago

mbsync

~benburwell 10 months ago

I have not personally used mbsync but according to http://isync.sourceforge.net/mbsync.html there might be a file named .uidvalidity or .isyncuidmap.db in your maildir. Aerc expects all the files in your maildir to be messages. Could you:

  1. Check whether those files are present, and
  2. If so, try temporarily moving them out of your maildir (you may want to stop mbsync while you do this) and try aerc again.

Just want to make sure this is the problem you're having before fixing it.

~mmf 10 months ago

So I have an Archive folder, inside of which there were two mbsync's dotfiles which I moved out of the way. new and tmp are empty and curcontains only email files. Tried to navigate to Archive and aerc crashed with the same stacktrace.

~benburwell 10 months ago

Could you share your whole maildir structure? Something like the (abbreviated) output from tree? Also, share a few samples of mail file names?

~mmf 10 months ago

This is a 2 level tree:

.
├── Archive
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
├── Drafts
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
├── INBOX
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
├── Memo
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
├── Sent
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
├── Spam
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
├── to-file
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
├── to-reply
│   ├── cur
│   ├── .mbsyncstate
│   ├── new
│   ├── tmp
│   └── .uidvalidity
└── Trash
    ├── cur
    ├── .mbsyncstate
    ├── new
    ├── tmp
    └── .uidvalidity

52 directories, 26 files

Inside cur most files are named like these:

1542276656.822_64.x1c6,U=260:2,S
1553764995.90e7c4c77f225825.x1c6,U=504:2,S
1572779328.x1c6.1616574100007587665bc6b15a7c1c99,U=9484:2,S

~xenrox 10 months ago

On first glance I would guess that you have a mail file in your Archive folder, which does not contain a ":" seperator, so that your slice is too short (https://golang.org/pkg/strings/#FieldsFunc).

~mmf 10 months ago

yes, indeed, I added some logging and this is the file that's crashing everything: 1526999220.15704_126.x1c6,U=39669

~benburwell 9 months ago

This is fixed in 4ab82bf306370ae4d79c12f5028a51b38fe40547 -- aerc will now display an error for that specific message rather than panicking. You will still need to fix whatever is improperly naming your maildir file(s).

~sircmpwn REPORTED FIXED 9 months ago

Register here or Log in to comment, or comment via email.