Seth LaForge wrote:
I start Thunderbird, and it opens my INBOX and checks for new messages. I switch to the ".Spam!" folder, which has ~1700 message, of which ~1200 are unread. I select all of the unread messages, and mark them as read. (In the IMAP logs, a "uid store" command is issued, and it's echoed back that all messages are now \Seen.) I then navigate to the ".Spam?" folder, which is empty. I navigate back to ".Spam!", Thunderbird fetches message status, and lots of messages come back as unseen.
It appears to me that the Seen status is not being properly stored to disk. (This gets stored by renaming files, right?) Are there any changes in 1.2.12 that could affect this?
Next stop - ktrace?
OK, I traced the server, and I believe I've found the problem. The executive summary:
Thunderbird sends Binc a command to mark about 1000 messages seen. Binc open()s the cur/ directory and calls getdirentries() a few times - only enough to read a portion of the directory. Binc then renames 51 files to mark them unseen. Then calls getdirentries() to fetch more of the directory, but getdirentries() returns 0 - end of file! At that point Binc decides that it's done and reports to Thunderbird that all messages have been marked seen.
So, it looks to me that on OS X with HFS+ you cannot rely on getdirentries() to work correctly if there are writes to the directory between calls to getdirentries(). This strikes me as rather fishy - surely you've got to be able to get a consistent directory listing if you list a directory while somebody is copying into it?
To fix this, presumably binc should read the entire directory before renaming files. I'll try that tonight.
Seth
12306 bincimapd 1112940681.948403 CALL read(0,0xbfffec40,0x400)
12306 bincimapd 1112940681.948418 GIO fd 0 read 447 bytes
"29 uid store 177:178,180,182,184:185,187:188,190:192,194,196:197,200,2\
02,204,206:208,210:214,216:220,222,224:225,227:228,232,564,566,571,575\
,578,581,583:611,613:645,647:650,654,656:657,659:668,670,672,738:741,7\
43,745:746,748:749,751:753,755,757:758,761,763,765,767:769,771:775,777\
:781,783,785:786,788:789,793,796:797,799:801,803:807,809:811,813:819,8\
22,824,925:1254,1257:1631,1637:1794,1796:1803,1805:1806,1809:1844,1847\
,1851:1982 +Flags (\\Seen)\r
"
12306 bincimapd 1112940681.948430 RET read 447/0x1bf
12306 bincimapd 1112940681.996371 CALL stat(0x1007954,0xbfffefc0)
12306 bincimapd 1112940681.996419 NAMI ".Spam!/cur/"
12306 bincimapd 1112940681.996450 RET stat 0
12306 bincimapd 1112940681.996460 CALL open(0x1007954,0x4,0x5)
12306 bincimapd 1112940681.996473 NAMI ".Spam!/cur/"
12306 bincimapd 1112940681.996484 RET open 10/0xa
12306 bincimapd 1112940681.996490 CALL fstat(0xa,0xbfffefc0)
12306 bincimapd 1112940681.996497 RET fstat 0
12306 bincimapd 1112940681.996502 CALL fcntl(0xa,0x2,0x1)
12306 bincimapd 1112940681.996508 RET fcntl 0
12306 bincimapd 1112940681.996518 CALL fstatfs(0xa,0xbffff020)
12306 bincimapd 1112940681.996528 RET fstatfs 0
12306 bincimapd 1112940681.996543 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940682.021140 RET getdirentries 4068/0xfe4
12306 bincimapd 1112940682.021930 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940682.290521 RET getdirentries 4064/0xfe0
12306 bincimapd 1112940682.291241 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940682.652459 RET getdirentries 4072/0xfe8
12306 bincimapd 1112940682.653184 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940682.976429 RET getdirentries 4096/0x1000
12306 bincimapd 1112940682.977133 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940683.299461 RET getdirentries 4064/0xfe0
12306 bincimapd 1112940683.300158 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940683.663372 RET getdirentries 4084/0xff4
12306 bincimapd 1112940683.664123 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940684.056009 RET getdirentries 4072/0xfe8
12306 bincimapd 1112940684.056735 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940684.399364 RET getdirentries 4076/0xfec
12306 bincimapd 1112940684.400127 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940684.757277 RET getdirentries 4060/0xfdc
12306 bincimapd 1112940684.757997 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940685.082270 RET getdirentries 4052/0xfd4
12306 bincimapd 1112940685.082974 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940685.418222 RET getdirentries 4060/0xfdc
12306 bincimapd 1112940685.418351 CALL rename(0x100120c,0x100132c)
12306 bincimapd 1112940685.418366 NAMI
".Spam!/cur/1112254075.M322563P14177V0E000005I0009B292_0.burn.ofb.net,S=11629:2,"
12306 bincimapd 1112940685.418485 NAMI
".Spam!/cur/1112254075.M322563P14177V0E000005I0009B292_0.burn.ofb.net,S=11629:2,S"
12306 bincimapd 1112940685.627359 RET rename 0
12306 bincimapd 1112940685.627473 CALL rename(0x100120c,0x100126c)
12306 bincimapd 1112940685.627490 NAMI
".Spam!/cur/1112254774.M858114P14237V0E000005I0009B298_0.burn.ofb.net,S=3507:2,"
12306 bincimapd 1112940685.627610 NAMI
".Spam!/cur/1112254774.M858114P14237V0E000005I0009B298_0.burn.ofb.net,S=3507:2,S"
12306 bincimapd 1112940685.627774 RET rename 0
... 47 other successful renames ...
12306 bincimapd 1112940685.650789 CALL rename(0x100120c,0x10012cc)
12306 bincimapd 1112940685.650797 NAMI
".Spam!/cur/1112282134.M810162P16792V0E000005I0009B3A9_0.burn.ofb.net,S=2957:2,"
12306 bincimapd 1112940685.650844 NAMI
".Spam!/cur/1112282134.M810162P16792V0E000005I0009B3A9_0.burn.ofb.net,S=2957:2,S"
12306 bincimapd 1112940685.651211 RET rename 0
12306 bincimapd 1112940685.651286 CALL rename(0x100120c,0x100132c)
12306 bincimapd 1112940685.651295 NAMI
".Spam!/cur/1112283836.M358750P16961V0E000005I0009B3EB_0.burn.ofb.net,S=9672:2,"
12306 bincimapd 1112940685.651363 NAMI
".Spam!/cur/1112283836.M358750P16961V0E000005I0009B3EB_0.burn.ofb.net,S=9672:2,S"
12306 bincimapd 1112940685.651496 RET rename 0
12306 bincimapd 1112940685.651524 CALL
getdirentries(0xa,0x1015a00,0x1000,0x1900284)
12306 bincimapd 1112940685.653310 RET getdirentries 0
12306 bincimapd 1112940685.653337 CALL lseek(0xa,0,0,0)
12306 bincimapd 1112940685.653347 RET lseek 0
12306 bincimapd 1112940685.653364 CALL close(0xa)
12306 bincimapd 1112940685.653380 RET close 0
12306 bincimapd 1112940685.701288 CALL setitimer(0,0xbfffefc0,0xbfffefd0)
12306 bincimapd 1112940685.701354 RET setitimer 0
12306 bincimapd 1112940685.701374 CALL write(0x1,0x1008c00,0x400)
12306 bincimapd 1112940685.701408 GIO fd 1 wrote 1024 bytes
"* 114 FETCH (FLAGS (\\Seen) UID 177)\r
* 115 FETCH (FLAGS (\\Seen) UID 178)\r
* 117 FETCH (FLAGS (\\Seen) UID 180)\r
...