Issue 2572 terminal left in bad state when editor is suspended

Title terminal left in bad state when editor is suspended
Priority bug Status unknown
Milestone Resolved in
Superseder Nosy List bf
Assigned To

Created on 2018-03-05.09:39:24 by bf, last changed 2018-03-09.10:45:25 by bf.

msg19938 (view) Author: bf Date: 2018-03-05.09:39:23
Quoting Evan Laforge <qdunkan@gmail.com> on darcs-users:

Actually it's xterm on linux.  I *think* I saw it on iterm2 on OS X as
well.  It doesn't happen with 2.10.1, and does with 2.12.5.

My guess it that it has to do with how darcs prompts put the terminal
into raw mode, then vim of course uses raw mode, somehow the state
saving and restoring gets messed up when you ^Z out and fg back in.
It's easy for me to reproduce:

Record changes in darcs 2.12.5, then say yes to "add a long comment"
where EDITOR=vim.  Now ^Z out of vim, and then fg back.  At that
point, vim is in command mode, but any keys just appear literally on
the screen, so there's no way to save or quit or do anything.  The
only way out is to kill vim from another terminal, at which point
darcs finishes the record (I guess it doesn't mind that vim return
msg19939 (view) Author: bf Date: 2018-03-05.10:09:39
It seems the resumed editor actually reacts to all the command keys in
the usual way, it's just that escape sequences are printed literally on
the screen, so you can't see what you will get.
msg19940 (view) Author: bf Date: 2018-03-05.11:01:40
I tested with darcs-2.10.2 and it behaves the same as the head. I am now
trying to build 2.10.1...done. Yes! darcs-2.10.1 does not have this bug.
This should narrow it down to the 38 patches between 2.10.1 and 2.10.2.
msg19941 (view) Author: bf Date: 2018-03-05.13:51:55
This did not work out as I planned. My self-built darcs-2.10.2 works,
the ubuntu package version does not. These are the differences in the
output of --exact-version:

ben@yuiitsu[3]:~>diff bad good -y --suppress-common-lines -W 60 | grep
-v compiled
                             >  HTTP-4000.2.23
attoparsec-          |  attoparsec-
cryptohash-0.11.6            |  cryptohash-0.11.9
hashable-             |  hashable-
                             >  network-
                             >  network-uri-
parsec-3.1.9                 |  parsec-
regex-applicative-    |  regex-applicative-0.3.3
tar-                  |  tar-
text-                 |  text-
unix-compat-          |  unix-compat-
vector-              |  vector-
zlib-                 |  zlib-

These all look pretty much unsuspicious to me. Also, the libraries used
in the good version are all newer than those in the bad version. Any
ideas what to do now?
msg19951 (view) Author: bf Date: 2018-03-09.10:45:14
I thought I had tracked it down to a single patch. Without the patch, it
works, when I pull it, it fails. However, fom the content of the patch
it is obvious that it simply /cannot/ cause this failure! So I re-built
completely (by throwing away dist*) and now it works again! Very
strange, perhaps a bug in cabal new-build. So I'll have to do a complete
rebuild from now on which is really inconvenient.
Date User Action Args
2018-03-05 09:39:24bfcreate
2018-03-05 10:09:40bfsetmessages: + msg19939
2018-03-05 11:01:42bfsetmessages: + msg19940
2018-03-05 13:51:56bfsetmessages: + msg19941
2018-03-09 10:45:25bfsetmessages: + msg19951