From 8028c989ccfc363e437da80c4791fabd7977d99b Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Fri, 11 Oct 2024 17:19:35 +0800 Subject: wic/rootfs.py: allow --exclude-path option to exclude symlinks 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. (From OE-Core rev: 42e829ac1e9d74646b6dfb327b18b15f6b0df60b) Signed-off-by: Yi Zhao Signed-off-by: Richard Purdie --- scripts/lib/wic/plugins/source/rootfs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/lib/wic/plugins/source/rootfs.py') diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index c990143c0d..06fce06bb1 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -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) -- cgit v1.2.3-54-g00ecf