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

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) ===
Fixes: https://discuss.linuxcontainers.org/t/can-not-start-bash-on-a-container/9315
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 0814fd4d1145147f09314b64bd9b9740acb3be79 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Thu, 29 Oct 2020 20:17:17 +0100
Subject: [PATCH] exec: make sure to only use TIOCGPTPEER if available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes: 
https://discuss.linuxcontainers.org/t/can-not-start-bash-on-a-container/9315
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 lxd/instance_exec.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lxd/instance_exec.go b/lxd/instance_exec.go
index 23f7ddbc2d..76db1bfaee 100644
--- a/lxd/instance_exec.go
+++ b/lxd/instance_exec.go
@@ -21,6 +21,7 @@ import (
        "github.com/lxc/lxd/lxd/instance/instancetype"
        "github.com/lxc/lxd/lxd/operations"
        "github.com/lxc/lxd/lxd/response"
+       "github.com/lxc/lxd/lxd/state"
        "github.com/lxc/lxd/shared"
        "github.com/lxc/lxd/shared/api"
        log "github.com/lxc/lxd/shared/log15"
@@ -44,6 +45,7 @@ type execWs struct {
        controlConnectedDone bool
        fds                  map[int]string
        devptsFd             *os.File
+       s                    *state.State
 }
 
 func (s *execWs) Metadata() interface{} {
@@ -133,7 +135,7 @@ func (s *execWs) Do(op *operations.Operation) error {
                ttys = make([]*os.File, 1)
                ptys = make([]*os.File, 1)
 
-               if s.devptsFd != nil {
+               if s.devptsFd != nil && s.s.OS.NativeTerminals {
                        ptys[0], ttys[0], err = 
shared.OpenPtyInDevpts(int(s.devptsFd.Fd()), s.rootUid, s.rootGid)
                        s.devptsFd.Close()
                        s.devptsFd = nil
@@ -504,6 +506,7 @@ func containerExecPost(d *Daemon, r *http.Request) 
response.Response {
 
        if post.WaitForWS {
                ws := &execWs{}
+               ws.s = d.State()
                ws.fds = map[int]string{}
 
                if inst.Type() == instancetype.Container {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to