Bug 1213844

Summary: guestfish should reset the console on ^Z
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: norman, ptoscano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Richard W.M. Jones 2015-04-21 12:22:38 UTC
Description of problem:

If you use 'less' to view a file, and you use ^Z to suspend
the process group, then your terminal will have guestfish
colours (eg. red).

To demonstrate this:

$ guestfish -N fs -m /dev/sda1 
><fs> touch /foo
><fs> less /foo

At this point (inside less) hit Ctrl-Z to suspend the process:

[1]+  Stopped                 guestfish -N fs -m /dev/sda1

Now your terminal will be in red.

guestfish should detect the signal and reset the terminal
colours.

Version-Release number of selected component (if applicable):

guestfish 1.29.36fedora=23,release=1.fc23,libvirt

How reproducible:

100%

Steps to Reproduce:
1. See above.

Comment 1 Maros Zatko 2016-02-01 18:06:22 UTC
I can't seem to reproduce it.
Tried it on F20 and F23 with xfce4-terminal and gnome-terminal.

Comment 2 Richard W.M. Jones 2016-02-01 18:11:52 UTC
I can reproduce it with

libguestfs-tools-c-1.33.7-1.fc24.x86_64

and xfce4-terminal.

Comment 3 Norman Rasmussen 2019-10-03 07:52:18 UTC
I can reproduce with:

# disable any terminal color settings from your shell
PS1='\u@\h:\w\$ '
# configure guestfish prompts (this is directly from the man page)
export GUESTFISH_PS1='\[\e[92m\]><fs>\[\e[91m\] '
export GUESTFISH_OUTPUT='\e[0m'
export GUESTFISH_RESTORE='\e[0m'
export GUESTFISH_INIT='\e[94m'
guestfish
# ctrl-Z

on Debian with:
guestfish 1.40.2
GNOME Terminal 3.30.2 using VTE 0.54.2 +GNUTLS

package versions:
libguestfs-tools 1:1.40.2-2
gnome-terminal 3.30.2-2
libvte-2.91-0 0.54.2-2