public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH] devshell: Use different termination test to avoid warnings
Date: Sat, 16 May 2020 10:00:37 +0200	[thread overview]
Message-ID: <3b659fd0-15bb-d74c-8460-ffd67651401f@web.de> (raw)

From: Jan Kiszka <jan.kiszka@siemens.com>

As we run the terminal via a sudo chroot, OE's way of testing for the
existence of the target PID does not work. It will rather fail early due
to missing permissions (user tries to send signal to root process), and
we will wait in the unmount loop, generating warnings like

WARNING: mc:qemuamd64-buster:example-raw-0.3-r0 do_devshell: /work/build/tmp/deploy/buildchroot-target/debian-buster-amd64//home/builder/example-raw: Couldn't unmount, retrying...

This replaces the kill(pid, 0) with a test for the existence of the
corresponding /proc/<pid> directory.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/lib/oe/terminal.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 87058040..a9fb62b9 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -245,9 +245,11 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
     finally:
         os.unlink(pidfile)

+    # Test for /proc entry so that target pid can also be privileged
+    procpid = "/proc/%d" % pid
     while True:
         try:
-            os.kill(pid, 0)
+            os.stat(procpid)
             time.sleep(0.1)
         except OSError:
            return
--
2.26.1


             reply	other threads:[~2020-05-16  8:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  8:00 Jan Kiszka [this message]
2020-05-25 16:11 ` Baurzhan Ismagulov
2020-05-25 16:13   ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3b659fd0-15bb-d74c-8460-ffd67651401f@web.de \
    --to=jan.kiszka@web.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox