From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: "Stefan Weil" <sw@weilnetz.de>,
"Markus Armbruster" <armbru@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Beraldo Leal" <bleal@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH v2 3/9] tests/docker: fix a win32 error due to portability
Date: Sun, 29 Jan 2023 22:24:08 +0400 [thread overview]
Message-ID: <20230129182414.583349-4-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20230129182414.583349-1-marcandre.lureau@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
docker.py is run during configure, and produces an error: No module
named 'pwd'.
Use a more portable and recommended alternative to lookup the user
"login name".
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/docker/docker.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 3a1ed7cb18..688ef62989 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -23,10 +23,10 @@
import tempfile
import re
import signal
+import getpass
from tarfile import TarFile, TarInfo
from io import StringIO, BytesIO
from shutil import copy, rmtree
-from pwd import getpwuid
from datetime import datetime, timedelta
@@ -316,7 +316,7 @@ def build_image(self, tag, docker_dir, dockerfile,
if user:
uid = os.getuid()
- uname = getpwuid(uid).pw_name
+ uname = getpass.getuser()
tmp_df.write("\n")
tmp_df.write("RUN id %s 2>/dev/null || useradd -u %d -U %s" %
(uname, uid, uname))
@@ -570,7 +570,7 @@ def run(self, args, argv):
if args.user:
uid = os.getuid()
- uname = getpwuid(uid).pw_name
+ uname = getpass.getuser()
df.write("\n")
df.write("RUN id %s 2>/dev/null || useradd -u %d -U %s" %
(uname, uid, uname))
--
2.39.1
next prev parent reply other threads:[~2023-01-29 18:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 18:24 [PATCH v2 0/9] Various win32 fixes & teach 'getfd' QMP command to import sockets marcandre.lureau
2023-01-29 18:24 ` [PATCH v2 1/9] tests: fix path separator, use g_build_filename() marcandre.lureau
2023-01-29 18:24 ` [PATCH v2 2/9] tests: fix test-io-channel-command on win32 marcandre.lureau
2023-02-06 8:09 ` Thomas Huth
2023-02-07 12:55 ` Marc-André Lureau
2023-02-06 8:13 ` Philippe Mathieu-Daudé
2023-01-29 18:24 ` marcandre.lureau [this message]
2023-01-29 18:24 ` [PATCH v2 4/9] osdep: implement qemu_socketpair() for win32 marcandre.lureau
2023-01-29 18:24 ` [PATCH v2 5/9] qmp: 'add_client' actually expects sockets marcandre.lureau
2023-01-29 18:24 ` [PATCH v2 6/9] qapi: implement conditional command arguments marcandre.lureau
2023-01-29 18:24 ` [PATCH v2 7/9] qmp: teach 'getfd' to import sockets on win32 marcandre.lureau
2023-01-29 18:24 ` [PATCH v2 8/9] libqtest: make qtest_qmp_add_client work " marcandre.lureau
2023-01-29 18:24 ` [PATCH v2 9/9] qtest: enable vnc-display test " marcandre.lureau
2023-02-06 6:36 ` [PATCH v2 0/9] Various win32 fixes & teach 'getfd' QMP command to import sockets Marc-André Lureau
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=20230129182414.583349-4-marcandre.lureau@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=bleal@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=kraxel@redhat.com \
--cc=lvivier@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
--cc=wainersm@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.