mutt does not properly restore console colors on exit

Bug #1582629 reported by Martin Rimmele
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mutt (Debian)
Fix Released
Unknown
mutt (Ubuntu)
Invalid
Undecided
Unassigned
Xenial
Invalid
Undecided
Unassigned
ncurses (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Triaged
Medium
Unassigned

Bug Description

With release of Ubuntu 16.04 Debian Bug 803405 also hits Ubuntu.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803405

After quitting mutt (with q or x) mutt doesn't restore colors of the console properly, colors are mangled, at least when colors used in mutt are different from console colors. Tested in xfce4-terminal and gnome-terminal, maybe also other terminal or text console is affected.

In addition to the information in the debian report this problem only occurs when a .muttrc (even when empty) exists for the user. Without a .muttrc file the behaviour of mutt on leaving is ok.

I could confirm this on amd64 and armv7l, so it seems platform independent.

Even if the bug is already known in Debian I repost this in Ubuntu just to have documented it also hits Ubuntu and to maybe have some fix for current mutt version (or to get an update to next version in this LTS release).

xxx@xxx:~$ lsb_release -rd
Description: Ubuntu 16.04 LTS
Release: 16.04

xxx@xxx:~$ apt-cache policy mutt
mutt:
  Installiert: 1.5.24-1build1
  Installationskandidat: 1.5.24-1build1
  Versionstabelle:
 *** 1.5.24-1build1 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status

xxx@xxx:~$ mutt -v
Mutt 1.5.24 (2015-08-30)
Copyright (C) 1996-2009 Michael R. Elkins und andere.
Mutt übernimmt KEINERLEI GEWÄHRLEISTUNG. Starten Sie »mutt -vv«, um
weitere Details darüber zu erfahren. Mutt ist freie Software.
Sie können es unter bestimmten Bedingungen weitergeben; starten Sie
»mutt -vv« für weitere Details.

System: Linux 4.4.0-22-generic (x86_64)
ncurses: ncurses 6.0.20160213 (compiled with 6.0)
libidn: 1.32 (compiled with 1.32)
hcache backend: tokyocabinet 1.4.48

Compiler:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.3.1-9ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.3.1 20160216 (Ubuntu 5.3.1-9ubuntu1)

Configure options: '--prefix=/usr' '--sysconfdir=/etc' '--mandir=/usr/share/man' '--with-docdir=/usr/share/doc' '--with-mailpath=/var/mail' '--disable-dependency-tracking' '--enable-compressed' '--enable-debug' '--enable-fcntl' '--enable-hcache' '--enable-gpgme' '--enable-imap' '--enable-smtp' '--enable-pop' '--with-curses' '--with-gnutls' '--with-gss' '--with-idn' '--with-mixmaster' '--with-sasl' '--without-gdbm' '--without-bdb' '--without-qdbm' '--build' 'x86_64-linux-gnu' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/qdbm'

Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall

Einstellungen bei der Compilierung:
-DOMAIN
+DEBUG
-HOMESPOOL +USE_SETGID +USE_DOTLOCK +DL_STANDALONE +USE_FCNTL -USE_FLOCK
+USE_POP +USE_IMAP +USE_SMTP
-USE_SSL_OPENSSL +USE_SSL_GNUTLS +USE_SASL +USE_GSS +HAVE_GETADDRINFO
+HAVE_REGCOMP -USE_GNU_REGEX
+HAVE_COLOR +HAVE_START_COLOR +HAVE_TYPEAHEAD +HAVE_BKGDSET
+HAVE_CURS_SET +HAVE_META +HAVE_RESIZETERM
+CRYPT_BACKEND_CLASSIC_PGP +CRYPT_BACKEND_CLASSIC_SMIME +CRYPT_BACKEND_GPGME
-EXACT_ADDRESS -SUN_ATTACHMENT
+ENABLE_NLS -LOCALES_HACK +COMPRESSED +HAVE_WC_FUNCS +HAVE_LANGINFO_CODESET +HAVE_LANGINFO_YESEXPR
+HAVE_ICONV -ICONV_NONTRANS +HAVE_LIBIDN +HAVE_GETSID +USE_HCACHE
-ISPELL
SENDMAIL="/usr/sbin/sendmail"
MAILPATH="/var/mail"
PKGDATADIR="/usr/share/mutt"
SYSCONFDIR="/etc"
EXECSHELL="/bin/sh"
MIXMASTER="mixmaster"
Um die Entwickler zu kontaktieren, schicken Sie bitte
eine Nachricht (auf Englisch) an <email address hidden>.
Um einen Fehler zu melden, besuchen Sie bitte http://bugs.mutt.org/.

misc/am-maintainer-mode.patch
features/ifdef.patch
features/trash-folder.patch
features/purge-message.patch
features/imap_fast_trash.patch
features/sensible_browser_position.patch
features/compressed-folders.patch
features/compressed-folders.debian.patch
debian-specific/Muttrc.patch
debian-specific/Md.etc_mailname_gethostbyname.patch
debian-specific/use_usr_bin_editor.patch
debian-specific/correct_docdir_in_man_page.patch
debian-specific/dont_document_not_present_features.patch
debian-specific/document_debian_defaults.patch
debian-specific/assumed_charset-compat.patch
debian-specific/467432-write_bcc.patch
debian-specific/566076-build_doc_adjustments.patch
misc/define-pgp_getkeys_command.patch
misc/gpg.rc-paths.patch
misc/smime.rc.patch
misc/fix-configure-test-operator.patch
upstream/531430-imapuser.patch
upstream/543467-thread-segfault.patch
upstream/548577-gpgme-1.2.patch
upstream/553321-ansi-escape-segfault.patch
upstream/528233-readonly-open.patch
upstream/228671-pipe-mime.patch
upstream/383769-score-match.patch
upstream/603288-split-fetches.patch
upstream/611410-no-implicit_autoview-for-text-html.patch
upstream/771125-CVE-2014-9116-jessie.patch
upstream/path_max.patch
translations/update_german_translation.patch
__separator__mutt.org.patch

Regards,
Martin

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mutt (Ubuntu):
status: New → Confirmed
Revision history for this message
Marius Gedminas (mgedmin) wrote :

The Debian bug filed for Mutt traces this change to a bug in ncurses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816887

Changed in mutt (Debian):
status: Unknown → Fix Released
Revision history for this message
Marius Gedminas (mgedmin) wrote :

Short summary of the ncurses bug:

- when you call start_color() and then endwin() twice without calling use_default_colors() in the middle, endwin() resets the color to grey on black (and then clears to end of line, which leaves an ugly black bar in my gnome-terminal which uses a white background).

Translated into muttrc:

- when you shell out to external programs before configuring 'default' as a color name, you get this bug

This leads to a workaround I've just tested:

- edit /etc/Muttrc and insert

    color normal default default

  just above the last line, which is

    source /usr/lib/mutt/source-muttrc.d|

Revision history for this message
Brian Murray (brian-murray) wrote :

This is fixed Yakkety which will become Ubuntu 16.10 as we have ncurses version 6.0+20160625-1ubuntu1 which includes:

ncurses (6.0+20160625-1) unstable; urgency=low

  * New upstream patchlevel.
    - Make linux3.0 entry the default linux entry (Closes: #823658, #515609).
    - Improve manual pages for wgetch and wget_wch to point out that they
      might return values without names in curses.h (Closes: #822426).
    - Amend change to _nc_do_color to restore the early return for the
      special case used in _nc_screen_wrap (report by Dick Streefland,
      Closes: #816887).

Changed in mutt (Ubuntu):
status: Confirmed → Invalid
Changed in mutt (Ubuntu Xenial):
status: New → Invalid
Changed in ncurses (Ubuntu):
status: New → Fix Released
Changed in ncurses (Ubuntu Xenial):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Brian Murray (brian-murray) wrote :
Revision history for this message
Marius Gedminas (mgedmin) wrote :

FWIW a cleaner workaround that also works is creating a /etc/Muttrc.d/00-fix-black-bar.rc that does

    color normal default default

This way you don't have to deal with conffile changes on next upgrade.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.