]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
run: Make sure we resolve relative /etc/resolv.conf symlinks properly
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 28 Jul 2023 10:54:26 +0000 (12:54 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 28 Jul 2023 13:50:48 +0000 (15:50 +0200)
If the symlink is relative, we should resolve it relative to /etc/resolv.conf
and not /

mkosi/run.py

index 111266f9bac157ca4103c1191d047454ec72210b..af2d39f8cdd7cdb75ea79de53bc1f3a0fd920700 100644 (file)
@@ -369,7 +369,7 @@ def chroot_cmd(root: Path, *, options: Sequence[PathString] = (), network: bool
             # mkdir(symlink) which obviously fails if multiple components of the dangling symlink path don't
             # exist yet. As a workaround, we resolve the symlink ourselves so that bubblewrap will correctly
             # create all missing components in the target path.
-            resolve = (root / resolve).readlink()
+            resolve = resolve.parent / (root / resolve).readlink()
 
         # If we're using the host network namespace, use the same resolver.
         cmdline += ["--ro-bind", "/etc/resolv.conf", Path("/") / resolve]