summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2026-06-14 03:56:57 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2026-06-14 03:56:57 +0000
commit8599dba96a5ac81bdac269e95e8498b84def98ce (patch)
treee8dea4cf0ae3f1ce004f963efdd200d7e1df977c
parent96fd20b66e7a31b903f6a1545aef94b4739f8c28 (diff)
downloadmeta-virtualization-8599dba96a5ac81bdac269e95e8498b84def98ce.tar.gz
lxc: drop templates-actually-create-DOWNLOAD_TEMP-directory.patch
The local patch added in 2018 was meant to ensure DOWNLOAD_TEMP pointed at a directory that actually existed by routing mktemp through the -p option. Its else branch is reached precisely when DOWNLOAD_TEMP is unset (the elif catches the set case), but the rewrite DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)" substitutes an empty ${DOWNLOAD_TEMP} into the command line, leaving the shell to parse mktemp -p -d as -d being the argument value for -p rather than its own flag. mktemp then fails immediately with mktemp: failed to create file via template '-d/tmp.XXXXXXXXXX': No such file or directory and lxc-create exits before doing any network work. Every invocation of lxc-create --template download is broken. Ferry Toth reported this on the meta-virt list 2026-06-13 (subject "lxc: starting a container errors out"). His diagnosis is correct and the fix he proposed — drop the patch — is the right one. The original upstream line DOWNLOAD_TEMP="${DOWNLOAD_TEMP}$(mktemp -d)" handles both cases correctly: with DOWNLOAD_TEMP set the elif branch runs first, and with it unset the else branch reduces to just DOWNLOAD_TEMP="$(mktemp -d)" which lets mktemp pick the default TMPDIR / /tmp location and create the directory. The original 2018 motivation ("DOWNLOAD_TEMP will not be pointing to an actual directory") does not match how mktemp -d actually behaves on modern systems — the directory IS created, and that's the whole point of mktemp -d. The reported failure mode was likely a build-host environment quirk specific to that 2018 setup rather than a general bug worth carrying a layer-local patch for. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch37
-rw-r--r--recipes-containers/lxc/lxc_git.bb1
2 files changed, 0 insertions, 38 deletions
diff --git a/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch b/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch
deleted file mode 100644
index 3a2b1f0d..00000000
--- a/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From b30643c37d0d64a15d15026ac94e548cae8a88d2 Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Thu, 31 May 2018 16:21:45 -0400
4Subject: [PATCH] templates: actually create DOWNLOAD_TEMP directory
5
6The way 'mktemp' is currently used you will get a temp directory in
7$TMPDIR or '/tmp' and DOWNLOAD_TEMP will not be pointing to an actual
8directory. This will result in the wget operations failing and the
9container will fail to create:
10
11 ERROR: Failed to download http://....
12
13Instead we want to use the '-p' option for mktemp to set the base path
14and this will ensure that the temp directory is created in the correct
15location and DOWNLOAD_TEMP will be consistent with this location.
16
17Upstream-Status: Pending
18
19Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
20
21---
22 templates/lxc-download.in | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/templates/lxc-download.in b/templates/lxc-download.in
26index 4cb2129..923d2a1 100644
27--- a/templates/lxc-download.in
28+++ b/templates/lxc-download.in
29@@ -329,7 +329,7 @@ elif [ -n "${DOWNLOAD_TEMP}" ]; then
30 mkdir -p "${DOWNLOAD_TEMP}"
31 DOWNLOAD_TEMP="$(mktemp -p "${DOWNLOAD_TEMP}" -d)"
32 else
33- DOWNLOAD_TEMP="${DOWNLOAD_TEMP}$(mktemp -d)"
34+ DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)"
35 fi
36
37 # Simply list images
diff --git a/recipes-containers/lxc/lxc_git.bb b/recipes-containers/lxc/lxc_git.bb
index fdb93e32..ec26f2c8 100644
--- a/recipes-containers/lxc/lxc_git.bb
+++ b/recipes-containers/lxc/lxc_git.bb
@@ -39,7 +39,6 @@ RDEPENDS:${PN}-networking += "iptables"
39SRC_URI = "git://github.com/lxc/lxc.git;branch=main;protocol=https \ 39SRC_URI = "git://github.com/lxc/lxc.git;branch=main;protocol=https \
40 file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ 40 file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \
41 file://run-ptest \ 41 file://run-ptest \
42 file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \
43 file://template-make-busybox-template-compatible-with-core-.patch \ 42 file://template-make-busybox-template-compatible-with-core-.patch \
44 file://templates-use-curl-instead-of-wget.patch \ 43 file://templates-use-curl-instead-of-wget.patch \
45 file://0001-download-don-t-try-compatbility-index.patch \ 44 file://0001-download-don-t-try-compatbility-index.patch \