From: Richard Jones <rjones@redhat.com>
Date: Tue, 30 Mar 2010 12:34:16 +0000 (+0100)
Subject: daemon: Set TERM=dumb inside the daemon.
X-Git-Tag: 1.0.89~9
X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=641e8275b3b63b68c82ef80735bb55f9da05ef2c;p=libguestfs.git

daemon: Set TERM=dumb inside the daemon.

Since commit 977edb3185fe8f we have been passing TERM from the
library into the appliance (for the benefit of virt-rescue).
However this changes the output of parted, which I would argue
is a bug in parted:

 TERM=xterm /sbin/parted -m -- /dev/sda unit b print 2>&1 | hexdump -C
 00000000  1b 5b 3f 31 30 33 34 68  42 59 54 3b 0a 2f 64 65  |.[?1034hBYT;./de|

Notice the escape-sequence junk before the official "BYT;"
header.

By setting TERM=dumb we avoid this.
---

diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 1518438..69baf9e 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -227,6 +227,7 @@ main (int argc, char *argv[])
   setenv ("PATH", "/sbin:/usr/sbin:/bin:/usr/bin", 1);
   setenv ("SHELL", "/bin/sh", 1);
   setenv ("LC_ALL", "C", 1);
+  setenv ("TERM", "dumb", 1);
 
 #ifndef WIN32
   /* We document that umask defaults to 022 (it should be this anyway). */