]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
wic/rootfs.py: allow --exclude-path option to exclude symlinks
authorYi Zhao <yi.zhao@eng.windriver.com>
Fri, 11 Oct 2024 09:19:35 +0000 (17:19 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 11 Oct 2024 12:33:13 +0000 (13:33 +0100)
Currently, if we specify a symbolic link in --exclude-path option,
we will get the following error in do_image_wic:

ERROR: --exclude-path: Must point inside the rootfs: usr/bin/hello.link

This is because it uses os.path.realpath to eliminate symbolic links. To
exclude symbolic links, use os.path.abspath instead of os.path.realpath.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/plugins/source/rootfs.py

index c990143c0dae365cf13010e0c0dea3636114f0b6..06fce06bb156905e8af64996d09dc6cb527a0db9 100644 (file)
@@ -41,7 +41,7 @@ class RootfsPlugin(SourcePlugin):
         # Disallow climbing outside of parent directory using '..',
         # because doing so could be quite disastrous (we will delete the
         # directory, or modify a directory outside OpenEmbedded).
-        full_path = os.path.realpath(os.path.join(rootfs_dir, path))
+        full_path = os.path.abspath(os.path.join(rootfs_dir, path))
         if not full_path.startswith(os.path.realpath(rootfs_dir)):
             logger.error("%s: Must point inside the rootfs: %s" % (cmd, path))
             sys.exit(1)