neomutt / neomutt

✉️ Teaching an Old Dog New Tricks -- IRC: #neomutt on irc.libera.chat
https://neomutt.org/
GNU General Public License v2.0
3.25k stars 308 forks source link

+mailbox: no such file or directory (errno = 2) when trying to attach files #519

Closed 15bitgames closed 5 years ago

15bitgames commented 7 years ago

I've been using NeoMutt for a while and recently I noticed that if I change mailboxes with a folder hook and then create a new email and want to add an attachment I get the following error.

+work: No such file or directory (errno = 2)

My mailbox is symlinked to another directory (/mnt/random/mail) so as a test I decided to move the mailbox to my home directory and it still didn't work (where the symlink originally was).

Below are links to my configuration files and I've also attached a debug file where you can see the issue at the end of the file. There is no sensitive information in the configuration files.

Is there some kind of mis-configuration somewhere? I couldn't find much online about the issue.

muttrc

###
# ~/.mutt/muttrc
###

# directories and commands
set alias_file       = ~/.mutt/alias         # alias file
set mailcap_path     = ~/.mutt/mailcap       # w3m html viewing
set header_cache     = ~/.mutt/cache/headers # where to store headers
set message_cachedir = ~/.mutt/cache/bodies  # where to store bodies
set certificate_file = ~/.mutt/certificates  # where to store certs
set mailcap_path     = ~/.mutt/mailcap       # entrys for filetypes
set signature        = ~/.mutt/sig           # my signature file
set tmpdir           = ~/.mutt/temp          # where to keep temp files
set editor='nvim'
set sig_on_top       = yes

# main options
set text_flowed     = yes         # stop weird line breaks
set mbox_type       = Maildir         # mailbox type
set folder          = ~/mail          # mailbox location
set spoolfile       = "+mrrobot/INBOX"  # mrrobot is default inbox
set timeout         = 3               # idle time before scanning
set mail_check      = 0               # minimum time between scans
set sort_alias      = alias           # sort alias file by alias
set reverse_alias                     # show names from alias file in index
unset move                            # gmail does that
set smart_wrap = yes
set allow_ansi = yes
set delete                            # don't ask, just do
unset confirmappend                   # don't ask, just do!
set quit                              # don't ask, just do!!
unset mark_old                        # read/new is good enough for me
set beep_new = yes                    # bell on new mails
set check_new = yes

set pipe_decode                       # strip headers and eval mimes when piping
set thorough_search                   # strip headers and eval mimes before searching
set send_charset="us-ascii:utf-8"
set mail_check_stats = yes

set sleep_time = 0

# printing
set print_command="/usr/bin/muttprint %s"

# Status Bar -----------------------------------------
set status_chars  = " *%A"
set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
color status red default

# Header Options -------------------------------------
set hdrs=yes

unignore from: to: cc: date: subject:   # show only these
unhdr_order *                           # some distros order things by default
hdr_order date: from: to: cc: subject:  # and in this order

# index options
set sort              = reverse-last-date-received  # like gmail
set uncollapse_jump                                 # don't collapse on an unread message
set sort_re                                         # thread based on regex
set reply_regexp      = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"

# pager options
# set pager_context     = 3
# set pager_index_lines = 10  # number of index lines to show
# set pager_context     = 35  # number of context lines to show
# set pager_stop        = yes # don't go to next message automatically
set menu_scroll             # scroll in menus
set smart_wrap              # don't split words
set tilde                   # show tildes like in vim
set markers = no             # no ugly plus signs
auto_view text/html         # view html automatically
alternative_order text/html text/enriched text/plain
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"

# formats
set date_format     = "[%d/%m/%y] [%I:%M%P]"
set index_format    = "%3C [%Z] %D %-20.18F //   %s"
set alias_format    = "%4n %t %-20a %r"

# composing mail
set realname        = "Dean Thomson"     # who am i?
set envelope_from                        # which from?
set sig_dashes                           # dashes before my sig... sweet
set edit_headers                         # show headers when composing
set fast_reply                           # skip to compose when replying
set sendmail_wait   = 1                  # wait for sending... to complete
set askcc                                # ask for CC:
set fcc_attach                           # save attachments with the body
unset mime_forward                       # forward attachments as part of body
set forward_format  = "Fwd: %s"          # format for subject when forwarding
set forward_decode                       # decode when forwarding
set attribution     = "On %d, %n wrote:" # set the attribution
set reply_to                             # reply to Reply to: field
set reverse_name                         # reply as whomever it was to
set include                              # include message in replies
set forward_quote                        # include message in forwards
set beep_new = yes
set ispell = "aspell -e -c"
set skip_quoted_offset = 3

# headers to show

# ignore *                                 # ignore all headers
unignore from: to: cc: date: subject:   # show only these
hdr_order from: to: cc: date: subject:  # and in this order

# boxes
mailboxes +work/INBOX +work/INBOX.Keys +work/INBOX.Sent +work/INBOX.Drafts
mailboxes +virtua/INBOX +virtua/Sent +virtua/Spam +virtua/Archive +virtua/Drafts +virtua/Trash
mailboxes +mrrobot/INBOX +mrrobot/Sent
mailboxes +lechuck/INBOX +lechuck/Sent
mailboxes +gmail/INBOX +gmail/Sent +gmail/Drafts +gmail/Trash +gmail/Receipts +gmail/Work

# progress bar patch
color progress white magenta

# always sourced
source $alias_file              # required for functionality
source ~/.mutt/colors            # source colors file
source ~/.mutt/sidebar.muttrc   # any muttng options are here
source ~/.mutt/mrrobot.muttrc   # main fsociety email
source ~/.mutt/lechuck.muttrc   # automated nas email
source ~/.mutt/gmail.muttrc

# account specific sources
folder-hook work/*      source ~/.mutt/work.muttrc
folder-hook virtua/*    source ~/.mutt/virtua.muttrc
folder-hook mrrobot/*   source ~/.mutt/mrrobot.muttrc
folder-hook lechuck/*   source ~/.mutt/lechuck.muttrc
folder-hook gmail/*     source ~/.mutt/gmail.muttrc

# these just give me headaches
bind index,pager \#    noop
bind index i           noop

# bindings
bind pager q           exit
bind pager /           search
bind pager <up>        previous-line
bind pager <down>      next-line
bind pager k           previous-line
bind pager j           next-line
bind pager gg          top
bind pager G           bottom
bind index gg          first-entry
bind index G           last-entry
bind pager K           previous-undeleted
bind pager J           next-undeleted
bind index K           previous-unread
bind index J           next-unread
bind index,pager R     group-reply

# macros
macro index \Cr "<tag-prefix><clear-flag>N" "mark tagged messages as read"
macro index <esc>m "T~N<enter>;WNT~O<enter>;WO\CT~T<enter>" "mark all messages read"
macro index B   "<limit>~b "                "search message bodies"
macro index I   "<change-folder>!<enter>"   "go to Inbox"
# save a decoded copy in ~
macro index P   "<pipe-message>cat > ~/"    "save message as"

# quick-sync ~/Mail immediately with offlineimap
macro index Z   "<shell-escape>/usr/bin/offlineimap -q -o<enter>" "sync IMAP"

# load browser
macro attach 'V' "<pipe-entry>cat >~/.cache/mutt/mail.html && qutebrowser --backend webengine --target auto ~/.cache/mutt/mail.html<enter>"

mailcap

text/html; w3m -I %{charset} -T text/html; copiousoutput;

work.muttrc

###
# work specific options
###

set from      = "<<removed>>"
set sendmail  = "/usr/bin/msmtp -a ccasoftware"
set mbox      = "+work/INBOX"
set record    = "+work/INBOX.Sent"
set postponed = "+work/INBOX.Draft"
set signature = "$HOME/.mutt/work.sig"
color status cyan default

macro index ,v "<change-folder>+virtua/INBOX<return>" "change to virtua email"
macro index ,r "<change-folder>+mrrobot/INBOX<return>" "change to mrrobot email"
macro index ,l "<change-folder>+lechuck/INBOX<return>" "change to lechuck email"
macro index ,g "<change-folder>+gmail/INBOX<return>" "change to gmail mail"

macro index D "<save-message>+work/INBOX.Trash<enter>" "move message to the trash"
macro index S "<save-message>+work/INBOX.Spam<enter>"  "mark message as spam"

mrrobot.muttrc

###
# personal
###

set from      = "<<removed>>"
set sendmail  = "/usr/bin/msmtp -a mrrobot"
set mbox      = "+mrrobot/INBOX"
set record    = "+mrrobot/Sent"
set postponed = "+mrrobot/Draft"
set signature = ""
color status cyan default

macro index ,w "<change-folder>+work/INBOX<return>" "change to cca email"
macro index ,v "<change-folder>+virtua/INBOX<return>" "change to virtua email"
macro index ,l "<change-folder>+lechuck/INBOX<return>" "change to lechuck email"
macro index ,g "<change-folder>+gmail/INBOX<return>" "change to gmail mail"

macro index D "<save-message>+mrrobot/Trash<enter>" "move message to the trash"
macro index S "<save-message>+mrrobot/Spam<enter>"  "mark message as spam"

virtua.muttrc

###
# personal
###

set from      = "<<removed>>"
set sendmail  = "/usr/bin/msmtp -a virtua"
set mbox      = "+virtua/INBOX"
set record    = "+virtua/Sent"
set postponed = "+virtua/Draft"
set signature = "~/.mutt/virtua.sig"
color status cyan default

macro index ,w "<change-folder>+work/INBOX<return>" "change to cca email"
macro index ,r "<change-folder>+mrrobot/INBOX<return>" "change to mrrobot email"
macro index ,l "<change-folder>+lechuck/INBOX<return>" "change to lechuck email"
macro index ,g "<change-folder>+gmail/INBOX<return>" "change to gmail mail"

macro index D "<save-message>+virtua/Trash<enter>" "move message to the trash"
macro index S "<save-message>+virtua/Spam<enter>"  "mark message as spam"

lechuck.muttrc

###
# personal
###

set from      = "<<removed>>"
set sendmail  = "/usr/bin/msmtp -a lechuck"
set mbox      = "+lechuck/INBOX"
set record    = "+lechuck/Sent"
set postponed = "+lechuck/Draft"
set signature = ""
color status cyan default

macro index ,w "<change-folder>+work/INBOX<return>" "change to cca email"
macro index ,v "<change-folder>+virtua/INBOX<return>" "change to virtua email"
macro index ,r "<change-folder>+mrrobot/INBOX<return>" "change to mrrobot email"
macro index ,g "<change-folder>+gmail/INBOX<return>" "change to gmail mail"

macro index D "<save-message>+lechuck/Trash<enter>" "move message to the trash"
macro index S "<save-message>+lechuck/Spam<enter>"  "mark message as spam"

gmail.muttrc

###
# gmail specific options
###

set from      = "<<removed>>"
set sendmail  = "/usr/bin/msmtp -a gmail"
set mbox      = "+gmail/INBOX"
unset record
set postponed = "+gmail/Drafts"
color status green default

macro index ,w "<change-folder>+work/INBOX<return>" "change to cca email"
macro index ,v "<change-folder>+virtua/INBOX<return>" "change to virtua email"
macro index ,r "<change-folder>+mrrobot/INBOX<return>" "change to mrrobot email"
macro index ,l "<change-folder>+lechuck/INBOX<return>" "change to lechuck email"

macro index D "<save-message>+gmail/Trash<enter>" "move message to the trash"
macro index S "<save-message>+gmail/Spam<enter>"  "mark message as spam"

[removed outcommented lines, @toogley]

15bitgames commented 7 years ago

mutt -v

NeoMutt 20170306 (1.8.0)
Copyright (C) 1996-2016 Michael R. Elkins and others.
Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.
Mutt is free software, and you are welcome to redistribute it
under certain conditions; type `mutt -vv' for details.

System: Linux 4.10.8-1-ARCH (x86_64)
libidn: 1.33 (compiled with 1.33)
hcache backends: gdbm

Compiler:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 6.3.1 20170306 (GCC) 

Configure options: '--prefix=/usr' '--sysconfdir=/etc' '--enable-debug' '--enable-pgp' '--enable-gpgme' '--enable-notmuch' '--enable-pop' '--enable-imap' '--enable-smtp' '--enable-sidebar' '--enable-compressed' '--with-gss=/usr' '--with-ssl=/usr' '--with-sasl' '--with-curses=/usr' '--with-regex' '--with-idn' '--with-gdbm' 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'

Compilation CFLAGS: -Wall -pedantic -Wno-long-long -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-delete-null-pointer-checks

Compile options:
+CRYPT_BACKEND_CLASSIC_PGP +CRYPT_BACKEND_CLASSIC_SMIME +CRYPT_BACKEND_GPGME 
+DEBUG -DL_STANDALONE +ENABLE_NLS -EXACT_ADDRESS -HOMESPOOL -LOCALES_HACK 
-SUN_ATTACHMENT +HAVE_BKGDSET +HAVE_COLOR +HAVE_CURS_SET +HAVE_FUTIMENS 
+HAVE_GETADDRINFO +HAVE_GETSID +HAVE_ICONV +HAVE_LANGINFO_CODESET 
+HAVE_LANGINFO_YESEXPR +HAVE_LIBIDN +HAVE_META -HAVE_REGCOMP +HAVE_RESIZETERM 
+HAVE_START_COLOR +HAVE_TYPEAHEAD +HAVE_WC_FUNCS +ICONV_NONTRANS 
+USE_COMPRESSED +USE_DOTLOCK +USE_FCNTL -USE_FLOCK -USE_FMEMOPEN +USE_GNU_REGEX 
+USE_GSS +USE_HCACHE +USE_IMAP +USE_NOTMUCH -USE_NNTP +USE_POP +USE_SASL 
-USE_SETGID +USE_SIDEBAR +USE_SMTP -USE_SSL_GNUTLS +USE_SSL_OPENSSL 
-DOMAIN
-MIXMASTER
-ISPELL
SENDMAIL="/usr/sbin/sendmail"
MAILPATH="/var/mail"
PKGDATADIR="/usr/share/mutt"
SYSCONFDIR="/etc"
EXECSHELL="/bin/sh"

patch-attach-headers-color-neomutt
patch-compose-to-sender-neomutt
patch-compress-neomutt
patch-cond-date-neomutt
patch-encrypt-to-self-neomutt
patch-fmemopen-neomutt
patch-forgotten-attachments-neomutt
patch-forwref-neomutt
patch-ifdef-neomutt
patch-index-color-neomutt
patch-initials-neomutt
patch-keywords-neomutt
patch-kyoto-neomutt
patch-limit-current-thread-neomutt
patch-lmdb-neomutt
patch-multiple-fcc-neomutt
patch-nested-if-neomutt
patch-new-mail-neomutt
patch-nntp-neomutt
patch-notmuch-neomutt
patch-progress-neomutt
patch-quasi-delete-neomutt
patch-reply-with-xorig-neomutt
patch-sensible-browser-neomutt
patch-sidebar-neomutt
patch-skip-quoted-neomutt
patch-status-color-neomutt
patch-timeout-neomutt
patch-tls-sni-neomutt
patch-trash-neomutt

To learn more about NeoMutt, visit: http://www.neomutt.org/
If you find a bug in NeoMutt, please raise an issue at:
    https://github.com/neomutt/neomutt/issues
or send an email to: <neomutt-devel@neomutt.org>
15bitgames commented 7 years ago

debug where it occurs

[2017-04-13 17:09:38] Sorting mailbox...
[2017-04-13 17:09:48] In mutt_reflow_windows
[2017-04-13 17:09:49] +work: No such file or directory (errno = 2)
[2017-04-13 17:09:49] +work: No such file or directory (errno = 2)
[2017-04-13 17:09:52] mutt_free_body: unlinking /home/guts/.mutt/temp/mutt-fs0ciety-laptop-1000-8035-12484527844210594473.
[2017-04-13 17:09:52] Mail not sent.
[2017-04-13 17:09:53] Mailbox is unchanged.
somini commented 7 years ago

Does your attachment path includes spaces? I get a similar error when I paste a path that includes spaces, and have to manually navigate to it.

15bitgames commented 7 years ago

I can't even manually navigate, and none of the directories have spaces in them.

d-k-c commented 7 years ago

I tried but cannot reproduce the issue you're facing. Can you try to reduce your config files to the bare minimum and detail the steps you do to trigger the issue?

flatcap commented 7 years ago

Is this still a problem? Did you try to minimise your config as @d-k-c suggested?

BrunoMSantos commented 5 years ago

I just stumbled on this issue. Interestingly enough I changed nothing in my configuration and I've been running later versions than the one that triggered this issue.

I can try to bisect the issue because it probably related to a recent update. But let me describe something that may be at the root of the issue:

The issue is not present when neomutt is fired up, it's only after using one of these macros (I have similar ones):

macro index ,g "<change-folder>+gmail/INBOX<return>" "change to gmail mail"

Replacing the + in those macros with a normal path fixes it. In fact the error message for that case would be:

+gmail: No such file or directory (errno = 2)

It seems to me that the + is not expanded in those macros. Does this help with reproducing the problem? Of course a long time has passed so it may not be directly related with the original issue.