]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix wrong uid:gid on the basename symlink
authorCornelius Hoffmann <coding@hoffmn.de>
Fri, 26 May 2023 07:31:50 +0000 (09:31 +0200)
committerCornelius Hoffmann <coding@hoffmn.de>
Fri, 26 May 2023 09:57:26 +0000 (11:57 +0200)
Before this would have the uid:gid of root in the uidmap space
The link is now created in the staging area first to make the change atomic,
so that the wrong uid:gid pair is never seen in the output directory

mkosi/__init__.py

index a0157a26c692cafe5cc53e71026264743ed2fdc0..f8d2a4072e3ae656aa7cc3104521cda45b31c327 100644 (file)
@@ -1730,6 +1730,7 @@ def build_image(uid: int, gid: int, args: MkosiArgs, config: MkosiConfig) -> Non
 
         if not state.config.output_dir.joinpath(state.config.output).exists():
             state.config.output_dir.joinpath(state.config.output).symlink_to(state.config.output_with_compression)
+            os.chown(state.config.output_dir.joinpath(state.config.output), uid, gid, follow_symlinks=False)
 
     print_output_size(config.output_dir / config.output)