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 <[email protected]>
---
 scripts/lib/wic/plugins/source/rootfs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/plugins/source/rootfs.py 
b/scripts/lib/wic/plugins/source/rootfs.py
index ecf749740d..592bcf5175 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:" % (cmd, path))
             sys.exit(1)
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#205666): 
https://lists.openembedded.org/g/openembedded-core/message/205666
Mute This Topic: https://lists.openembedded.org/mt/108945750/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to