The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/345

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
This fixes #341.

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>

From 434ba3e20fafc17697562222d3dbcf3326546ccf Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Wed, 17 Jun 2020 08:53:19 +0200
Subject: [PATCH] shared/util: Fix locale when importing GPG keys

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 shared/util.go | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/shared/util.go b/shared/util.go
index 0814dd3..e768db0 100644
--- a/shared/util.go
+++ b/shared/util.go
@@ -142,9 +142,16 @@ func recvGPGKeys(gpgDir string, keyserver string, keys 
[]string) (bool, error) {
        for _, f := range publicKeys {
                args := append(args, "--import")
 
-               err := lxd.RunCommandWithFds(strings.NewReader(f), nil, "gpg", 
args...)
+               cmd := exec.Command("gpg", args...)
+               cmd.Stdin = strings.NewReader(f)
+               cmd.Env = append(os.Environ(), "LANG=C.UTF-8")
+
+               var buffer bytes.Buffer
+               cmd.Stderr = &buffer
+
+               err := cmd.Run()
                if err != nil {
-                       return false, err
+                       return false, fmt.Errorf("Failed to run: %s: %s", 
strings.Join(cmd.Args, " "), strings.TrimSpace(buffer.String()))
                }
        }
 
@@ -154,7 +161,7 @@ func recvGPGKeys(gpgDir string, keyserver string, keys 
[]string) (bool, error) {
 
        args = append(args, append([]string{"--recv-keys"}, fingerprints...)...)
 
-       _, out, err := lxd.RunCommandSplit(nil, nil, "gpg", args...)
+       _, out, err := lxd.RunCommandSplit(append(os.Environ(), 
"LANG=C.UTF-8"), nil, "gpg", args...)
        if err != nil {
                return false, err
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to