Debian Bug report logs - #803405
does not properly restore console colors on exit anymore

version graph

Package: mutt; Maintainer for mutt is Mutt maintainers <mutt@packages.debian.org>; Source for mutt is src:mutt (PTS, buildd, popcon).

Reported by: Joey Hess <id@joeyh.name>

Date: Thu, 29 Oct 2015 18:03:02 UTC

Severity: normal

Merged with 803406

Found in version mutt/1.5.24-1

Done: Evgeni Golov <evgeni@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Antonio Radici <antonio@dyne.org>:
Bug#803405; Package mutt. (Thu, 29 Oct 2015 18:03:05 GMT) (full text, mbox, link).


Acknowledgement sent to Joey Hess <id@joeyh.name>:
New Bug report received and forwarded. Copy sent to Antonio Radici <antonio@dyne.org>. (Thu, 29 Oct 2015 18:03:05 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Joey Hess <id@joeyh.name>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: does not properly restore console colors on exit anymore
Date: Thu, 29 Oct 2015 13:57:20 -0400
[Message part 1 (text/plain, inline)]
Package: mutt
Version: 1.5.24-1
Severity: normal

Before upgrading to mutt 1.5.24, I could run mutt, press 'q' and 
the shell prompt was the same color as it was before mutt ran.
Now, after quitting mutt, the color setting is apparently left at
light grey on black. I have to run `reset` to fix it.

See attached screenshot.

-- Package-specific info:
Mutt 1.5.24 (2015-08-30)
Copyright (C) 1996-2009 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.2.0-1-amd64 (x86_64)
ncurses: ncurses 6.0.20151024 (compiled with 6.0)
libidn: 1.32 (compiled with 1.32)
hcache backend: tokyocabinet 1.4.48

Compiler:
Using built-in specs.
COLLECT_GCC=/usr/bin/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='Debian 5.2.1-17' --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 --with-arch-32=i586 --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.2.1 20150911 (Debian 5.2.1-17) 

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,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2 -I/usr/include/qdbm'

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

Compile options:
-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"
To contact the developers, please mail to <mutt-dev@mutt.org>.
To report a bug, please visit 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

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mutt depends on:
ii  libassuan0         2.3.0-1
ii  libc6              2.19-22
ii  libcomerr2         1.42.13-1
ii  libgnutls-deb0-28  3.3.18-1
ii  libgpg-error0      1.20-1
ii  libgpgme11         1.6.0-1
iu  libgssapi-krb5-2   1.13.2+dfsg-3
ii  libidn11           1.32-3
iu  libk5crypto3       1.13.2+dfsg-3
iu  libkrb5-3          1.13.2+dfsg-3
iu  libncursesw5       6.0+20151024-1
ii  libsasl2-2         2.1.26.dfsg1-14
ii  libtinfo5          6.0+20151024-1
ii  libtokyocabinet9   1.4.48-3

Versions of packages mutt recommends:
ii  libsasl2-modules                2.1.26.dfsg1-14
ii  locales                         2.19-22
it  mime-support                    3.59
ii  postfix [mail-transport-agent]  2.11.3-1

Versions of packages mutt suggests:
ii  aspell           0.60.7~20110707-3
ii  ca-certificates  20150426
ii  gnupg            1.4.19-5
pn  mixmaster        <none>
ii  openssl          1.0.2d-1
pn  urlview          <none>

Versions of packages mutt is related to:
ii  mutt          1.5.24-1
pn  mutt-dbg      <none>
pn  mutt-patched  <none>

-- no debconf information

-- 
see shy jo
[screenshot.png (image/png, attachment)]
[signature.asc (application/pgp-signature, inline)]

Merged 803405 803406 Request was from Evgeni Golov <evgeni@debian.org> to control@bugs.debian.org. (Thu, 29 Oct 2015 18:30:05 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Antonio Radici <antonio@dyne.org>:
Bug#803405; Package mutt. (Mon, 02 Nov 2015 17:45:09 GMT) (full text, mbox, link).


Acknowledgement sent to Joey Hess <id@joeyh.name>:
Extra info received and forwarded to list. Copy sent to Antonio Radici <antonio@dyne.org>. (Mon, 02 Nov 2015 17:45:09 GMT) (full text, mbox, link).


Message #12 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Joey Hess <id@joeyh.name>
To: 803405@bugs.debian.org
Subject: worakaround
Date: Mon, 2 Nov 2015 12:48:48 -0400
[Message part 1 (text/plain, inline)]
Since this was getting very annoying, I wrote this script:

#!/bin/sh
/usr/bin/mutt "$@"
ret="$?"
/bin/echo -e '\e[0m'
exit "$ret"

Which also shows that a SGR reset is all that's missing.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Antonio Radici <antonio@dyne.org>:
Bug#803405; Package mutt. (Mon, 09 Nov 2015 18:51:14 GMT) (full text, mbox, link).


Acknowledgement sent to Javier Cantero <jcantero@escomposlinux.org>:
Extra info received and forwarded to list. Copy sent to Antonio Radici <antonio@dyne.org>. (Mon, 09 Nov 2015 18:51:14 GMT) (full text, mbox, link).


Message #17 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Javier Cantero <jcantero@escomposlinux.org>
To: Debian Bug Tracking System <803405@bugs.debian.org>
Subject: Re: does not properly restore console colors on exit anymore
Date: Mon, 9 Nov 2015 19:41:21 +0100
[Message part 1 (text/plain, inline)]
Package: mutt
Version: 1.5.24-1
Followup-For: Bug #803405

Dear Maintainer,

This bug is also in Stretch since the upgrade of ncurses5/libtinfo5
(occurred on November 5) from the previous version 6.0+20150810-1 to the
current 6.0+20151024-1.

-- Package-specific info:
Mutt 1.5.24 (2015-08-30)
Copyright (C) 1996-2009 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.2.5-amd64 (x86_64)
ncurses: ncurses 6.0.20151024 (compiled with 6.0)
libidn: 1.32 (compiled with 1.32)
hcache backend: tokyocabinet 1.4.48

Compiler:
Using built-in specs.
COLLECT_GCC=/usr/bin/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='Debian 5.2.1-17' --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 --with-arch-32=i586 --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.2.1 20150911 (Debian 5.2.1-17) 

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,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2 -I/usr/include/qdbm'

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

Compile options:
-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"
To contact the developers, please mail to <mutt-dev@mutt.org>.
To report a bug, please visit 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

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (600, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.5-amd64 (SMP w/4 CPU cores)
Locale: LANG=es_ES.utf8, LC_CTYPE=es_ES.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mutt depends on:
ii  libassuan0         2.3.0-1
ii  libc6              2.19-22
ii  libcomerr2         1.42.13-1
ii  libgnutls-deb0-28  3.3.18-1
ii  libgpg-error0      1.20-1
ii  libgpgme11         1.6.0-1
ii  libgssapi-krb5-2   1.13.2+dfsg-4
ii  libidn11           1.32-3
ii  libk5crypto3       1.13.2+dfsg-4
ii  libkrb5-3          1.13.2+dfsg-4
ii  libncursesw5       6.0+20151024-1
ii  libsasl2-2         2.1.26.dfsg1-14+b1
ii  libtinfo5          6.0+20151024-1
ii  libtokyocabinet9   1.4.48-3

Versions of packages mutt recommends:
ii  exim4-daemon-light [mail-transport-agent]  4.86-5
ii  libsasl2-modules                           2.1.26.dfsg1-14+b1
ii  locales                                    2.19-22
ii  mime-support                               3.59

Versions of packages mutt suggests:
ii  aspell           0.60.7~20110707-3
ii  ca-certificates  20150426
ii  gnupg            1.4.19-6
pn  mixmaster        <none>
ii  openssl          1.0.2d-3
pn  urlview          <none>

Versions of packages mutt is related to:
ii  mutt          1.5.24-1
pn  mutt-dbg      <none>
pn  mutt-patched  <none>

-- no debconf information



[signature.asc (application/pgp-signature, inline)]

Added tag(s) pending. Request was from Antonio Radici <antonio@dyne.org> to control@bugs.debian.org. (Wed, 17 Feb 2016 10:09:03 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#803405; Package mutt. (Wed, 17 Feb 2016 10:15:04 GMT) (full text, mbox, link).


Acknowledgement sent to Antonio Radici <antonio@dyne.org>:
Extra info received and forwarded to list. (Wed, 17 Feb 2016 10:15:05 GMT) (full text, mbox, link).


Message #24 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Antonio Radici <antonio@dyne.org>
To: Joey Hess <id@joeyh.name>, 803405@bugs.debian.org
Subject: Re: Bug#803405: does not properly restore console colors on exit anymore
Date: Wed, 17 Feb 2016 10:07:42 +0000
tag 803405 +pending
thanks

On Thu, Oct 29, 2015 at 01:57:20PM -0400, Joey Hess wrote:
> Package: mutt
> Version: 1.5.24-1
> Severity: normal
> 
> Before upgrading to mutt 1.5.24, I could run mutt, press 'q' and 
> the shell prompt was the same color as it was before mutt ran.
> Now, after quitting mutt, the color setting is apparently left at
> light grey on black. I have to run `reset` to fix it.

I also noticed this and it is very annoying, I'll have it fixed in the next
version.



Information forwarded to debian-bugs-dist@lists.debian.org, Antonio Radici <antonio@dyne.org>:
Bug#803405; Package mutt. (Wed, 08 Jun 2016 19:03:07 GMT) (full text, mbox, link).


Acknowledgement sent to Javier Cantero <jcantero@escomposlinux.org>:
Extra info received and forwarded to list. Copy sent to Antonio Radici <antonio@dyne.org>. (Wed, 08 Jun 2016 19:03:07 GMT) (full text, mbox, link).


Message #29 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Javier Cantero <jcantero@escomposlinux.org>
To: 803405@bugs.debian.org
Subject: Re: does not properly restore console colors on exit anymore
Date: Wed, 8 Jun 2016 20:47:05 +0200
[Message part 1 (text/plain, inline)]
I've found a way to fix this bug reverting a change in libncursesw5
(see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816887 ) but note
that this is not the definitive fix but a workaround (it's not clear
that the failure is in the library or because mutt is misusing it
somehow).

Another analysis of the bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825054#15

(Also #825054 should be merged here)


-- 
                       Saludos de Javier <jcantero@escomposlinux.org>


[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Antonio Radici <antonio@dyne.org>:
Bug#803405; Package mutt. (Wed, 15 Jun 2016 17:33:03 GMT) (full text, mbox, link).


Acknowledgement sent to Javier Cantero <jcantero@escomposlinux.org>:
Extra info received and forwarded to list. Copy sent to Antonio Radici <antonio@dyne.org>. (Wed, 15 Jun 2016 17:33:03 GMT) (full text, mbox, link).


Message #34 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Javier Cantero <jcantero@escomposlinux.org>
To: 816887@bugs.debian.org
Cc: 803405@bugs.debian.org
Subject: Re: libncursesw5: background color of mutt's message is black
Date: Wed, 15 Jun 2016 19:28:22 +0200
[Message part 1 (text/plain, inline)]
Ok, I've been able to isolate the bug that sets the xfce4-term with
ncurses's default COLOR_WHITE/COLOR_BLACK foreground/background colors
after running a program using (colored) ncurses. This small example is
enough to trigger the incorrect behaviour:

    #include <curses.h>

    int main(int argc, char **argv)
    {
        initscr();
        if ( argc > 1 )
        {
            start_color();
            if ( argc > 2 )
                use_default_colors();
        }

        /*refresh();*/ /* this doesn't affect */
        endwin();
        /*refresh();*/ /* uncomment to fix */
        endwin();

        printw("This is a test\n");
        getch();

        endwin();

        return 0;
    }

Note: the number of arguments is used as a quickest way to change the
behaviour of the program in this way:

  ./test-ncurses         # doesn't invoke start_color()
  ./test-ncurses foo     # invokes start_color() but not use_default_colors()
  ./test-ncurses foo bar # invokes start_color() and use_default_colors()

The error is caused by the two consecutive endwin() function calls, but
only if start_color() has been previously called AND
use_default_colors() hasn't. So the bug is only reproducible using the
second of the 3 cases above (./test-ncurses foo). The other two cases
are provided only to prove the difference in behaviour.

One way to solve the problem is to ensure that use_default_colors() is
called after start_color(). Another way is to avoid any consecutive
calls to endwin() by introducing a wrefresh() call between them. In that
regard, the bug can also be fixed in the example above by uncommenting
the second call to refresh() (the one between both endwins).

This behaviour happens specifically in mutt because it doesn't
usually[1] call use_default_colors(), and because it calls endwin() a
lot[2]. The mutt developers have written a mutt_endwin() function,
supposedly to ensure that refresh() is always called before endwin(),
but there are still some locations in the code from where endwin() is
directly called, and unfortunately one of them[3] is the source of this
bug.

I'm explaining all of this because, from my current point of view, the
error is rather on the side of mutt than ncurses (and therefore it
should be fixed in mutt), but others may disagree. Perhaps Mr. Dickey
could bring some light on this, and about the expected behavior of the
endwind() function.


 [1]: for some reason use_default_colors() is not called just after
      start_color(), but delayed until the color settings have been read
      from the configuration files. The function is not even called
      except if one of the defined colors the "default" special value.
      Considering the default configuration doesn't use this "default"
      color, it's easy to see why mutt usually ends up not calling
      use_default_colors().

 [2]: mainly to execute external command line programs such as gpg or
      ispell

 [3]: http://sources.debian.net/src/mutt/1.6.0-1/init.c/#L3251

-- 
                       Saludos de Javier <jcantero@escomposlinux.org>


[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Mutt maintainers <pkg-mutt-maintainers@lists.alioth.debian.org>:
Bug#803405; Package mutt. (Mon, 18 Jul 2016 10:15:29 GMT) (full text, mbox, link).


Acknowledgement sent to Javier Cantero <jcantero@escomposlinux.org>:
Extra info received and forwarded to list. Copy sent to Mutt maintainers <pkg-mutt-maintainers@lists.alioth.debian.org>. (Mon, 18 Jul 2016 10:15:29 GMT) (full text, mbox, link).


Message #39 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Javier Cantero <jcantero@escomposlinux.org>
To: 803405@bugs.debian.org
Cc: 825054@bugs.debian.org
Subject: Re: does not properly restore console colors on exit anymore
Date: Mon, 18 Jul 2016 12:14:15 +0200
[Message part 1 (text/plain, inline)]
This bug has been fixed since the upload of ncurses 6.0+20160625-1. See
Bug #816887[1] for more details.

 [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816887

-- 
                       Saludos de Javier <jcantero@escomposlinux.org>


[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Mutt maintainers <pkg-mutt-maintainers@lists.alioth.debian.org>:
Bug#803405; Package mutt. (Mon, 18 Jul 2016 10:36:04 GMT) (full text, mbox, link).


Acknowledgement sent to Evgeni Golov <evgeni@golov.de>:
Extra info received and forwarded to list. Copy sent to Mutt maintainers <pkg-mutt-maintainers@lists.alioth.debian.org>. (Mon, 18 Jul 2016 10:36:04 GMT) (full text, mbox, link).


Message #44 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Evgeni Golov <evgeni@golov.de>
To: Javier Cantero <jcantero@escomposlinux.org>, 803405@bugs.debian.org
Cc: 825054@bugs.debian.org
Subject: Re: [Pkg-mutt-maintainers] Bug#803405: does not properly restore console colors on exit anymore
Date: Mon, 18 Jul 2016 12:33:37 +0200
Hi Javier.

On Mon, Jul 18, 2016 at 12:14:15PM +0200, Javier Cantero wrote:
> This bug has been fixed since the upload of ncurses 6.0+20160625-1. See
> Bug #816887[1] for more details.
> 
>  [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816887

thanks for the heads up

does that mean the bug against mutt can just be closed?



Information forwarded to debian-bugs-dist@lists.debian.org, Mutt maintainers <pkg-mutt-maintainers@lists.alioth.debian.org>:
Bug#803405; Package mutt. (Mon, 18 Jul 2016 13:54:04 GMT) (full text, mbox, link).


Acknowledgement sent to Javier Cantero <jcantero@escomposlinux.org>:
Extra info received and forwarded to list. Copy sent to Mutt maintainers <pkg-mutt-maintainers@lists.alioth.debian.org>. (Mon, 18 Jul 2016 13:54:04 GMT) (full text, mbox, link).


Message #49 received at 803405@bugs.debian.org (full text, mbox, reply):

From: Javier Cantero <jcantero@escomposlinux.org>
To: Evgeni Golov <evgeni@golov.de>
Cc: 803405@bugs.debian.org, 825054@bugs.debian.org
Subject: Re: Bug#803405: does not properly restore console colors on exit anymore
Date: Mon, 18 Jul 2016 15:51:04 +0200
On Mon, Jul 18, 2016 at 12:33:37PM +0200, Evgeni Golov wrote:
> does that mean the bug against mutt can just be closed?

I would say yes (but I'm not the one who opened the bug).




Reply sent to Evgeni Golov <evgeni@debian.org>:
You have taken responsibility. (Mon, 18 Jul 2016 18:30:04 GMT) (full text, mbox, link).


Notification sent to Joey Hess <id@joeyh.name>:
Bug acknowledged by developer. (Mon, 18 Jul 2016 18:30:04 GMT) (full text, mbox, link).


Message #54 received at 803405-done@bugs.debian.org (full text, mbox, reply):

From: Evgeni Golov <evgeni@debian.org>
To: Javier Cantero <jcantero@escomposlinux.org>, 803405-done@bugs.debian.org
Cc: 825054-done@bugs.debian.org
Subject: Re: Bug#803405: does not properly restore console colors on exit anymore
Date: Mon, 18 Jul 2016 20:26:14 +0200
On Mon, Jul 18, 2016 at 03:51:04PM +0200, Javier Cantero wrote:
> On Mon, Jul 18, 2016 at 12:33:37PM +0200, Evgeni Golov wrote:
> > does that mean the bug against mutt can just be closed?
> 
> I would say yes (but I'm not the one who opened the bug).

I am sure they can reopen it if needed :)



Reply sent to Evgeni Golov <evgeni@debian.org>:
You have taken responsibility. (Mon, 18 Jul 2016 18:30:05 GMT) (full text, mbox, link).


Notification sent to Joey Hess <id@joeyh.name>:
Bug acknowledged by developer. (Mon, 18 Jul 2016 18:30:05 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 16 Aug 2016 07:25:14 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Aug 8 03:48:44 2024; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.