[gnome-builder/1050-podman-absolute-workdir: 5/5] podman: Canonicalize --workdir path
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/1050-podman-absolute-workdir: 5/5] podman: Canonicalize --workdir path
- Date: Wed, 2 Oct 2019 11:37:39 +0000 (UTC)
commit eebcc62d64aad95e1caac6b7274c3845d7e6aa0d
Author: Will Thompson <will willthompson co uk>
Date: Wed Oct 2 12:10:08 2019 +0100
podman: Canonicalize --workdir path
ide_subprocess_launcher_get_cwd() may return "." or other relative
paths, but podman's "--workdir" argument must be absolute.
Without this change, the command-line project template can't be built in
a podman container which certainly has meson and ninja installed. Using
a wrapper script around `podman` to log its arguments, we see:
$ podman exec --privileged --workdir . 4683186e2b8f which ninja
Error: time="2019-10-02T07:25:11+01:00" level=error msg="exec failed: Cwd must be an absolute path\n"
exec failed: Cwd must be an absolute path: OCI runtime error
Error: time="2019-10-02T07:25:11+01:00" level=error msg="exec failed: Cwd must be an absolute path\n"
exec failed: Cwd must be an absolute path: OCI runtime error
$ podman exec --privileged --workdir . 4683186e2b8f which ninja-build
Error: time="2019-10-02T07:25:11+01:00" level=error msg="exec failed: Cwd must be an absolute path\n"
exec failed: Cwd must be an absolute path: OCI runtime error
With this change, the project builds successfully.
Fixes #1050.
src/plugins/podman/gbp-podman-subprocess-launcher.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/podman/gbp-podman-subprocess-launcher.c
b/src/plugins/podman/gbp-podman-subprocess-launcher.c
index 88ba6b785..f8b5ffe05 100644
--- a/src/plugins/podman/gbp-podman-subprocess-launcher.c
+++ b/src/plugins/podman/gbp-podman-subprocess-launcher.c
@@ -87,8 +87,10 @@ gbp_podman_subprocess_launcher_spawn (IdeSubprocessLauncher *launcher,
if ((cwd = ide_subprocess_launcher_get_cwd (launcher)))
{
+ g_autofree gchar *cwd_absolute = g_canonicalize_filename (cwd, NULL);
+
ide_subprocess_launcher_insert_argv (launcher, i++, "--workdir");
- ide_subprocess_launcher_insert_argv (launcher, i++, cwd);
+ ide_subprocess_launcher_insert_argv (launcher, i++, cwd_absolute);
}
/* Determine how many FDs we need to preserve.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]