From c91af840e510ccbed54a858a97623792398aa1ee Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 24 Jul 2024 11:12:31 -0400 Subject: [PATCH] Robust handling of relative link resolv.conf resolv.conf may be a relative link, normal file, or absolute link. Handle all cases. --- imgutil/imgutil | 2 ++ 1 file changed, 2 insertions(+) diff --git a/imgutil/imgutil b/imgutil/imgutil index 907a3b64..bc34af01 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -942,6 +942,8 @@ def fancy_chroot(args, installroot): sourceresolv = '/etc/resolv.conf' if os.path.islink(sourceresolv): sourceresolv = os.readlink(sourceresolv) + # normalize and resolve relative and absolute paths + sourceresolv = os.path.normpath(os.path.join('/etc', sourceresolv)) dstresolv = os.path.join(installroot, 'etc/resolv.conf') if os.path.islink(dstresolv): dstresolv = os.path.join(installroot, os.readlink(dstresolv)[1:])