Olaf Hering [Tue, 3 Dec 2013 15:42:39 +0000 (16:42 +0100)]
examine_directory: set directory/symlink size to zero
The size of a directory or symlink in the folder browser is not meaningful.
For directories it means just how many blocks were allocated to hold all
entries. It does not mean that the entries are still present in the directory.
For symlinks its the size of the target.
Set both to zero to simplify the folder browser output.
Kevin McCarthy [Thu, 11 Jan 2018 21:24:30 +0000 (13:24 -0800)]
Create pgp and s/mime default and sign_as key vars. (see #3983)
The $postpone_encrypt and $(pgp/smime)_self_encrypt configuration
variables have created a somewhat messier situation for users. Many
of them now have to specify their keys across multiple configuration
variables.
(Trac) Ticket #3983 had a reasonable request: "if my encrypt and
signing keys are the same, why can't I just specify my key once in my
.muttrc?"
The problem currently is that $smime_default_key and $pgp_sign_as are
both used to specify signing keys, and are set by the "sign (a)s"
security menu choice. So we can't store encryption keys there because
some users have separate sign-only capability keys.
Create $pgp_default_key to store the default encryption key. Change
signing to use $pgp_default_key, unless overridden by $pgp_sign_as.
The pgp "sign (a)s" will continue setting $pgp_sign_as.
Create $smime_sign_as. Change signing to use $smime_default_key
unless overridden by $smime_sign_as. Change s/mime "sign (a)s" menu
to set $smime_sign_as instead.
Change $postpone_encrypt and $(pgp/smime)_self_encrypt to use
$(pgp/smime)_default_key by default.
Mark $(pgp/smime)_self_encrypt_as deprecated. They are now aliases
for the $(pgp/smime)_default_key config vars.
Change $(pgp/smime)_self_encrypt default to set.
The intent is that most users now need only set
$(pgp/smime)_default_key. If they have a sign-only key, or have
separate signing and encryption keys, they can put that in
$(pgp/smime)_sign_as. This also enables to default self_encrypt on
and solve a very common request.
Thanks to Michele Marcionelli and Vincent Lefèvre for gently pushing
me towards a solution.
Fabian Groffen [Sun, 7 Jan 2018 12:06:56 +0000 (13:06 +0100)]
cmd_handle_fatal: make error message a bit more descriptive
When there are multiple IMAP connections available, "Mailbox closed"
doesn't give a hint as to which one. Use account info to identify which
mailbox was closed.
Kevin McCarthy [Sat, 6 Jan 2018 23:55:17 +0000 (15:55 -0800)]
Change imap literal counts to parse and store unsigned ints.
IMAP literals are of type number. Change imap_get_literal_count() to
use mutt_atoui() instead of atoi(). Change the return type variables
used to store the count to type unsigned int.
It's doubtful this was a real issue, but as long as we're cleaning up
incorrect atoi() usage, we should fix this too.
Kevin McCarthy [Sat, 6 Jan 2018 04:39:50 +0000 (20:39 -0800)]
Fix improper signed int conversion of IMAP uid and msn values.
Several places in the imap code, when parsing "number" and "nz-number"
values from the IMAP data, use atoi() and strtol(). This is
incorrect, and can result in failures when a uid value happens to be
larger than 2^31.
Create a helper function, mutt_atoui() and use that instead. One
place was using strtol() and relying on the endptr parameter, and so
was changed to use strtoul() instead.
Thanks to Paul Saunders for the bug report and original patch, which
this commit is based on.
Kevin McCarthy [Sun, 31 Dec 2017 03:10:16 +0000 (19:10 -0800)]
Disable message security if the backend is not available.
Gitlab issue #3 exposed an awkward corner case: if mutt is configured
without PGP or S/MIME, and with GPGME, but $crypt_use_gpgme is unset.
In this case, no backend will be available, but WithCrypto will be set
with both APPLICATION_PGP and APPLICATION_SMIME bits.
That will allow various config vars to enable encryption or signing,
even though there will be no backend available to perform them. The
message security flag might then be set, but when the user hits send,
will end up back at the compose menu due to the error.
The pgp or smime menu might not even be available to clear the
security setting!
Add a check in send.c before the compose menu is invoked, and give a
warning message for the menu ops inside the compose menu.
I believe this should prevent the issue. However this is a corner
case combined with user misconfiguration, so I don't believe is worth
a large effort to completely eradicate.
Kevin McCarthy [Mon, 18 Dec 2017 20:55:20 +0000 (12:55 -0800)]
Determine latest tag using git describe.
Commit 8648db83 relies on `sort -V` which is unavailable on some
platforms. Instead just use `git describe` with --abbrev=0 to only
output the tag. We still manually compute the distance to avoid the
problem mentioned in that commit.
Additionally, add Vincent's fix from commit 3b142cea to the stable
branch.
Adam Borowski [Sun, 17 Dec 2017 12:36:21 +0000 (13:36 +0100)]
manually touch atime when reading a mbox file
The only common use of atime left is local mail agents leaving a mark on
mbox file after the mail has been read. And, since POSIX-2008, it is
possible to use futimens() to alter atime even on filesystems mounted with
noatime.
There's no extra cost for doing this on when atime updates are enabled:
the inode will be dirty already.
Commit c1bcf4ba exposed a bug in the s/mime encryption code. It was
errorneously calling unlink on the list of generated cert files to
use.
Prior to that commit, the list had an initial space, which apparently
made the unlink fail. After that commit, encrypting to a single
certificate would end up deleting the certificate.
Remove the calls to unlink the cert file. Add some missing cleanup if
the call to openssl fails.
Aaron Schrab [Tue, 12 Dec 2017 02:46:30 +0000 (21:46 -0500)]
Change version.sh to manually compute version and distance.
In some cases `git describe` gives bizarre results (see URL below),
instead get the highest version-numbered tag contained in HEAD then
count the number of commits that aren't included in it.
Kevin McCarthy [Wed, 15 Nov 2017 22:53:19 +0000 (14:53 -0800)]
Fix $smart_wrap to not be disabled by whitespace-prefixed lines. (closes #3857)
changeset:737102af74eb fixed a folded header display issue with $smart_wrap
by disabling $smart_wrap for lines beginning with whitespace.
Unfortunately, this turns off smart wrapping in the body of an email
too, even when the line has other whitespace breaks in it.
An earlier commit, changeset:125076e0fdfa added an infinite loop fix
when MUTT_PAGER_NSKIP is set, by disabling the smart_wrap if the space
backtracking went to the beginning of the line. That is, a line
beginning with 1+ whitespace followed by a single long word.
Extend this second commit by always disabling the smart_wrap in that
case, not just when MUTT_PAGER_NSKIP is set. This also solves the
folded header issue without other side effects.
Kevin McCarthy [Sat, 11 Nov 2017 23:49:15 +0000 (15:49 -0800)]
Add $change_folder_next option to control mailbox suggestion order.
This patch is out of the Gentoo package maintained by Fabian Groffen.
From the link below, it appears the original author was Simon Burge.
I made some minor changes to get it to apply correctly, and cleaned up
the documentation a bit.
Original patch description:
This patch brings back the original behaviour of change-folder, which
some people find more useful. It suggests the next folder in your
mailboxes list that has new mail measured from the current folder,
instead of the first folder from your mailboxes list in any case. This
prevents starvation of folders defined at the back of your list ;)
See discussion: http://thread.gmane.org/gmane.mail.mutt.devel/12457
David Wilson [Wed, 8 Nov 2017 21:40:34 +0000 (13:40 -0800)]
Use fgets_unlocked and fgetc_unlocked if available.
Since mutt does not use threads, there is no reason it should use the
locked variants of the FILE* IO functions. This checks if the unlocked
functions are available, and if so enables them globally via mutt.h.
Cuts load time for a 56k message, 1.8GB /var/mail mailbox from 14
seconds to ~6 seconds, since we avoid acquiring and releasing a mutex
for every character of input read.
Enable $reply_self for group-reply, even with $metoo unset.
For a (r)eply, the $metoo variable does not have any effect because
there is a single recipient.
However with (g)roup reply, the To was initially set to the sender,
but subsequently removed my $nometoo. The empty To line is then
replaced with the Cc line, resulting in a (logically correct but)
surprising outcome.
Change the behavior such that $nometoo will not strip a single To
recipient when $reply_self is set.
Kevin McCarthy [Wed, 27 Sep 2017 20:45:36 +0000 (13:45 -0700)]
Make cmd_parse_fetch() more precise about setting reopen/check flags.
Previously any FETCH with FLAGS would result in either
idata->reopen |= IMAP_EXPUNGE_PENDING;
-or-
idata->check_status = IMAP_FLAGS_PENDING;
being set.
This is unnecessary in the case of responses to FLAGS.SILENT updates
sent by mutt (which seem to commonly happen now-a-days).
Change imap_set_flags() to compare the old server flags against the
new ones, and report when _those_ updates would/did result in a local
header flag change. Only set one of the reopen/check_status flags in
the event of an actual change (or potential change if a local change
has been made to the header.)
Kevin McCarthy [Wed, 27 Sep 2017 02:44:11 +0000 (19:44 -0700)]
Fix uses of context->changed as a counter.
The first was in mx_update_tables(), but only when "not committing".
This is used by mh/maildir during an "occult" update, and in imap when
expunging the mailbox. It meant to simply turn on changed when a
single changed header is seen.
The second use was in imap_sync_message_for_copy(). Previously this
was used for a server side copy/save, but is now also used for
fast-trash copying. Remove the code that was trying to decrement the
counter: this function is not capable of properly setting a status
bit.
Kevin McCarthy [Tue, 26 Sep 2017 01:40:32 +0000 (18:40 -0700)]
Change maildir and mh check_mailbox to use dynamic sized hash. (closes #3973)
The original patch is by Matt Fleming, originally posted at
http://www.codeblueprint.co.uk/2017/01/15/a-kernel-devs-approach-to-improving2
The comments there indicate Matt tried to submit to trac and mutt-dev,
but ran into registration problems. Thank you for the patch, and
sorry for those problems, Matt.
I modified the patch by making the same change to the
mh_check_mailbox() code too.
Kevin McCarthy [Fri, 22 Sep 2017 18:12:25 +0000 (11:12 -0700)]
Close the imap socket for the selected mailbox on error.
The new $imap_poll_timeout calls the cmd_handle_fatal() error handler
on timeout, which is supposed to close and cleanup.
However, for the currently selected mailbox, the error handler was not
closing the socket after closing up the mailbox. This left extra
SSL/GnuTLS data around and was causing errors on an attempt to
reconnect.
Kevin McCarthy [Fri, 22 Sep 2017 18:07:27 +0000 (11:07 -0700)]
Fix imap sync segfault due to inactive headers during an expunge. (closes #3971)
Mutt has several places where it turns off h->active as a hack. For
example to avoid FLAG updates, or to exclude from imap_exec_msgset.
Unfortunately, when a reopen is allowed and the IMAP_EXPUNGE_PENDING
flag becomes set (e.g. a flag update to a modified header),
imap_expunge_mailbox() will be called by imap_cmd_finish().
The mx_update_tables() would free and remove these "inactive" headers,
despite that an EXPUNGE was not received for them. This would result
in memory leaks and segfaults due to dangling pointers in the
msn_index and uid_hash.
There should probably be a more elegant solution, removing the initial
hacks. However, this is causing a segfault, and the best solution
right now is to turn active back on for non-expunged messages in
imap_expunge_mailbox().
Extra thanks to chdiza, who bravely runs tip and found this issue
quickly.
Kevin McCarthy [Wed, 13 Sep 2017 22:48:16 +0000 (15:48 -0700)]
Change imap copy/save and trash to sync flags, excluding deleted. (closes #3966) (closes #3860)
imap_copy_messages() uses a helper to sync the flags before performing
a server-side copy. However, it had a bug that the "deleted" flag on
a local message, if set, will be propagated to the copy too.
Change the copy sync helper to ignore the deleted flag. Then, change
the imap trash function to use the same helper.
Thanks to Anton Lindqvist for his excellent bug report, suggested
fixes, and help testing.
Kevin McCarthy [Wed, 13 Sep 2017 22:48:13 +0000 (15:48 -0700)]
Remove \Seen flag setting for imap trash. (see #3966) (see #3860)
Commit 323e3d6e5e4c has a side effect where spurious FETCH flag
updates after setting the \Seen flag can cause a sync to abort.
Remove manually setting \Seen for all trashed message before copying.
The next commit will change the imap trash function to use the same
code as the imap copy/save function for syncing the message before
server-side copying.
Kevin McCarthy [Mon, 4 Sep 2017 20:26:55 +0000 (13:26 -0700)]
Add warning about using inline pgp with format=flowed. (closes #3963)
The reporter noted that when trying to use inline signing with
format=flowed, the flowed was turned off.
After some research, this appears to be deliberate, probably because
of strange interactions between inline PGP and format=flowed. In fact
the RFC strongly discourages their combined use:
https://tools.ietf.org/html/rfc3676#section-4.6
Add a warning and prompt to use PGP/MIME in mutt_protect().
Kevin McCarthy [Sat, 2 Sep 2017 16:36:52 +0000 (09:36 -0700)]
Fix the new certificate prompt translations.
The Esperanto, Dutch, and Czech po files weren't updated in time for
1.9. Fix the certificate prompt translations by adding a "(s)kip"
choice. Otherwise the prompts would not be functional.