leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
444 stars 48 forks source link

mrefile: preserve file times #157

Closed silby closed 4 years ago

silby commented 5 years ago

When I use mrefile(1) to move a message to a different folder in my mail structure, the resulting file has a fresh modification time. This mtime ends up getting used by isync's mbsync(1) when sending the message back to my mail host with an IMAP APPEND with an explicit internal time. The result is a refiled message on the IMAP server with a fresh internal time, as opposed to the original time the message was received.

mdeliver -M extracts the Date: from each message to use as the mtime of the resulting file. mutt(1) appears to have similar behavior when copying messages. I propose mrefile(1) should behave this way as well, or optionally behave this way, to accurately perform the "move messages between folders" task.

(It's late and I am unable to think through whether this should really be the job of mrefile(1) or if mbsync(1) using APPEND instead of somehow using COPY is a bug.)

leahneukirchen commented 5 years ago

Actually I think it should keep the mtime of the source?

leahneukirchen commented 5 years ago

Pushed code now to try a simple rename first, please test.

silby commented 5 years ago

Looks good to me, works for me, seems to interact as I was hoping with mbsync(1), and I agree that simply keeping the mtime of the source file is simpler and less surprising than whatever I was suggesting when I was delaying sleep to mess around with email. Thanks for taking the suggestion!