Kevin McCarthy [Mon, 27 Aug 2018 01:43:20 +0000 (18:43 -0700)]
Add additional error handling to safe_rename()
It is apparently possible for link() to return an error but the link
to still be created. Add a double check for that case. If the files
match, unlink the src and return success.
Kevin McCarthy [Fri, 24 Aug 2018 19:56:54 +0000 (12:56 -0700)]
Display an error message if syncing fails
Ticket 36 reported an issue where a maildir was removed while the
mailbox was opened. Later, attempting to sync displayed the message
"Writing xxx...", which remained on the screen. The reporter actually
thought mutt was frozen, but it was simply that on a sync error Mutt
wasn't clearing or updating the message window.
There is some error message handling for mbox.c check_mailbox, but I
don't think that is the right place to further propogate messages.
Instead, add an error to the same place the initial "Writing..."
message is created.
Kevin McCarthy [Tue, 14 Aug 2018 21:31:34 +0000 (14:31 -0700)]
Remove compare_stat() call in safe_rename()
Some filesystems, such as sshfs, implement hard links strangely. The
hard link is created, but is represented by a different inode number
by the sshfs layer. The current maildir code goes into an infinite
loop in this case. Remove the compare_stat() and trust that a link()
return code of 0 means the link really did get created. Still, keep
the stats just as a minor check.
Kevin McCarthy [Tue, 14 Aug 2018 21:04:05 +0000 (14:04 -0700)]
Remove legacy trim_incomplete_mbyte() in the pager
Commit 4b1deb57 added the trim_incomplete_mbyte() call, but at
that time, the function was using fgets() into a fixed-sized
buffer. The function was passing in "blen - 1" to the size
parameter of fgets, so the check for blen-2 was to see if the
buffer was completely filled by the fgets.
Commit d39d9c0c converted to use a dynamic buffer, but the
trim_incomplete_mbyte() was left in. It now serves no purpose
because the entire line will be read in. Presumably the buggy
regexp lib should have been fixed by now too.
Kevin McCarthy [Sat, 28 Jul 2018 22:26:34 +0000 (15:26 -0700)]
Fix -z and -Z options to work with IMAP
-Z did not work if $imap_passive was set (the default). I think using
the option implies the desire to open a new connection and check
buffy at startup, so temporarily turn it off during the buffy.
-z was not hooked up for IMAP. Change it to call imap_status(). This
also requires $imap_passive be unset, so temporarily turn the option
off too.
Kevin McCarthy [Sat, 28 Jul 2018 19:59:35 +0000 (12:59 -0700)]
Fix AUXSORT usage in compare_spam
AUXSORT already checks if the first parameter is zero.
Additionally, the macro expands into more than one statement, so
putting inside an unbracketed if is misleading and generates a
warning on the latest gcc.
Fortunately, both statements checked if the first parameter was zero,
so no actual bug resulted.
Kevin McCarthy [Thu, 26 Jul 2018 00:52:40 +0000 (17:52 -0700)]
Add mx_ops.msg_padding_size to return the padding for a mx type
Mbox pads with a 1 byte, while mmdf pads with 10. Because compress
depends on the child type, we create a mx_ops, which allows compress.c
to delegate to the child ops.
Kevin McCarthy [Wed, 25 Jul 2018 01:23:25 +0000 (18:23 -0700)]
Skip sort in mbox_sync_mailbox() when new/reopen occurs
Callers of mx_sync_mailbox() and mx_close_mailbox() already check for
those cases and call update_index(). So remove the need_sort flag
setting when mbox_check_mailbox() returns new/reopen inside
mbox_sync_mailbox().
Kevin McCarthy [Wed, 25 Jul 2018 01:12:20 +0000 (18:12 -0700)]
Handle reopen/new_mail when closing mailbox in <imap-logout-all>
Other callers, such as OP_QUIT, OP_MAIN_CHANGE_FOLDER, and
OP_MAIN_SYNC_FOLDER handle the case where a sync or close_mailbox
fails due to new mail or a reopen.
OP_MAIN_LOGOUT_ALL appears to have been accidentally missed. Add a
call to update_index() to properly sort and update vcounts.
Vincent Lefevre [Tue, 24 Jul 2018 01:52:41 +0000 (03:52 +0200)]
Add ctx->vsize = 0 in a couple of places
It is not clear whether this is needed, but in both cases, the old value
(if not 0) is obsolete. If there is a bug somewhere else about vsize, it
will be easier to notice it.
Vincent Lefevre [Sun, 22 Jul 2018 00:57:32 +0000 (02:57 +0200)]
Improved limit-to-all detection by skipping leading spaces of the pattern
There are many equivalent limit-to-all patterns, but in practice, one
may want to limit to " ~A" in order to prevent the pattern from being
recorded in the history. Thus it is important to detect at least this
pattern and similar ones.
Vincent Lefevre [Sat, 21 Jul 2018 23:46:03 +0000 (01:46 +0200)]
Bug fix: reset ctx->vsize in update_index_unthreaded on reopened mailbox
This fixes a bug observed when doing the following:
1. Start Mutt on some mailbox.
2. Limit the view.
3. Set sort by date (thus unthreaded).
4. Set $status_format to display the size of the messages shown (%L).
5. Copy a message matching the limit pattern to this mailbox.
6. With another Mutt instance, remove this message from this mailbox.
7. Move the cursor to update the view.
Result: one was getting a value equal to twice the initial size.
Kevin McCarthy [Fri, 20 Jul 2018 03:28:38 +0000 (20:28 -0700)]
Display matching new messages in a thread-limited index
Previously, the index performed pattern matching first, and then
resorted new mail. The problem was that thread-limiting patterns,
e.g. ~(pattern), require threading data to properly match against the
new messages.
We already save new messages for the purposes of uncollapsing threads.
To keep the code cleaner, split off update_index() into
update_index_threaded()/unthreaded(). Then for threaded mode, save
the new messages first. We can then sort (before pattern matching),
and use the save_new array to pattern match the new messages
afterwards.
The $uncollapse_new loop was unnecessarily performing a n^2 search.
Simplify to just iteratate over the save_new instead.
Richard Russon [Fri, 31 Aug 2018 23:18:43 +0000 (00:18 +0100)]
merge: minor fixes
* warn when logging at the highest level
* boolify locals of mutt_select_file()
* buf,buflen for menu_make_entry()
* fix comment for nntp_expand_path()
* doxygen: mailbox backends
* doc: add maildir note for new mail feature
* doxy: fix imap config descriptions