From a008db77c4644c9ea22c7dd1e42e892bbd5f810e 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. (cherry picked from commit 56aac42ade164860be6783aa9ab57e2b62e2f42d) --- 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 7d976ceaa3..b5db510d47 100644 --- a/src/cosalib/cmdlib.py +++ b/src/cosalib/cmdlib.py @@ -267,7 +267,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'], 'oci-archive:' + tarfile])