mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0125-p2v-Set-LANG-C-in-the-remote-shell-so-we-can-match-o.patch

e76f14
From 5ca9876f652f093230ed8c4f50463a64b76dce62 Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Thu, 23 Jun 2016 11:27:01 +0100
e76f14
Subject: [PATCH] p2v: Set LANG=C in the remote shell so we can match on error
e76f14
 messages.
e76f14
e76f14
Since commit 5b6a8e086264c85fb048c0eadff6c34351663133 we are now
e76f14
matching on error messages, and therefore we must set LANG=C.
e76f14
e76f14
(cherry picked from commit 5e794b86072cfaa1d2017d93bd3a24be72636c02)
e76f14
---
e76f14
 p2v/ssh.c | 4 +++-
e76f14
 1 file changed, 3 insertions(+), 1 deletion(-)
e76f14
e76f14
diff --git a/p2v/ssh.c b/p2v/ssh.c
e76f14
index d2c8035..aa070d5 100644
e76f14
--- a/p2v/ssh.c
e76f14
+++ b/p2v/ssh.c
e76f14
@@ -425,6 +425,8 @@ start_ssh (struct config *config, char **extra_args, int wait_prompt)
e76f14
    * we can do is to repeatedly send 'export PS1=<magic>' commands
e76f14
    * until we synchronize with the remote shell.
e76f14
    *
e76f14
+   * Since we parse error messages, we must set LANG=C.
e76f14
+   *
e76f14
    * We don't know if the user is using a Bourne-like shell (eg sh,
e76f14
    * bash) or csh/tcsh.  Setting environment variables works
e76f14
    * differently.
e76f14
@@ -455,7 +457,7 @@ start_ssh (struct config *config, char **extra_args, int wait_prompt)
e76f14
     /* The purpose of the '' inside the string is to ensure we don't
e76f14
      * mistake the command echo for the prompt.
e76f14
      */
e76f14
-    if (mexp_printf (h, "export PS1='###''%s''### '\n", magic) == -1) {
e76f14
+    if (mexp_printf (h, "export LANG=C PS1='###''%s''### '\n", magic) == -1) {
e76f14
       set_ssh_error ("random_string: %m");
e76f14
       mexp_close (h);
e76f14
       return NULL;
e76f14
-- 
e76f14
1.8.3.1
e76f14