From 2496825038dc93da65673e16575a7775272c192e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 3 Jun 2022 13:09:30 -0400 Subject: [PATCH] cmdlib: Ensure bare-user tmpdir is in $workdir/tmp Linux `tmpfs` still doesn't support `user.` xattrs, and so for toolbox-like containers that use a (proper!) `tmpfs` for `/tmp` instead of having it be `overlayfs`, we need to ensure that we create our tempdir in `$workdir/tmp` - the workdir must have `user.` xattr support for the `cache/repo-build` anyways. Closes: https://github.com/coreos/coreos-assembler/issues/2904 (cherry picked from commit e02480568ba41280fc1d104dbb2c3143fda1f8da) dustymabe: This cherry pick needed manual merge conflict resolution. The function call for import_ostree_commit() changed in 816ebae to pass the workdir in. I evaluated the changes in e024805 and 816ebae and determined this to be the most surgical change. --- src/cosalib/cmdlib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cosalib/cmdlib.py b/src/cosalib/cmdlib.py index 1b341b61ab..776f4187af 100644 --- a/src/cosalib/cmdlib.py +++ b/src/cosalib/cmdlib.py @@ -277,7 +277,8 @@ def import_ostree_commit(repo, buildpath, buildmeta, force=False): gid = os.getgid() subprocess.check_call(['sudo', 'chown', '-hR', f"{uid}:{gid}", repo]) else: - with tempfile.TemporaryDirectory() as tmpd: + tmpdir = os.path.join(os.getcwd(), 'tmp') + with tempfile.TemporaryDirectory(dir=tmpdir) as tmpd: subprocess.check_call(['ostree', 'init', '--repo', tmpd, '--mode=bare-user']) subprocess.check_call(['rpm-ostree', 'ex-container', 'import', '--repo', tmpd, '--write-ref', buildmeta['buildid'], 'ostree-unverified-image:oci-archive:' + tarfile])