All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm-autonomy/arm-autonomy-host-image-minimal: Resolve guest path if symlink
@ 2020-11-10 13:41 Nathan Dunne
  2020-11-16 14:23 ` [meta-arm] " Jon Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Dunne @ 2020-11-10 13:41 UTC (permalink / raw)
  To: meta-arm; +Cc: nd

In ARM_AUTONOMY_HOST_IMAGE_EXTERN_GUESTS, remove fatal error if guest path
is a symlink, and instead resolve using os.path.realpath.

Issue-Id: SCM-638
Signed-off-by: Nathan Dunne <Nathan.Dunne@arm.com>
Change-Id: Ic4fdd7ae03ed6bb6caa55e722b89114080c90f4c
---
 .../images/arm-autonomy-host-image-minimal.bb            | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb b/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb
index 188e31d..47a07cd 100644
--- a/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb
+++ b/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb
@@ -106,7 +106,14 @@ python add_extern_guests () {
         _, _, path, _, _, parm = bb.fetch.decodeurl(entry)
         if 'guestname' in parm:
             if os.path.islink(path):
-                bb.fatal("Guest file is a symlink: " + path)
+                realpath = os.path.realpath(path)
+
+                if not os.path.exists(realpath):
+                    bb.fatal("ARM_AUTONOMY_HOST_IMAGE_EXTERN_GUESTS link does not resolve: " + path)
+
+                bb.note("Guest file is a symlink:\n " + path + "\nResolved to:\n " + realpath)
+                path = realpath
+
             bb.utils.mkdirhier(guestdir)
             dstname = parm['guestname']
             # Add file extension if not there
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [meta-arm] [PATCH] arm-autonomy/arm-autonomy-host-image-minimal: Resolve guest path if symlink
  2020-11-10 13:41 [PATCH] arm-autonomy/arm-autonomy-host-image-minimal: Resolve guest path if symlink Nathan Dunne
@ 2020-11-16 14:23 ` Jon Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Mason @ 2020-11-16 14:23 UTC (permalink / raw)
  To: Nathan Dunne; +Cc: meta-arm, nd

On Tue, Nov 10, 2020 at 01:41:52PM +0000, Nathan Dunne wrote:
> In ARM_AUTONOMY_HOST_IMAGE_EXTERN_GUESTS, remove fatal error if guest path
> is a symlink, and instead resolve using os.path.realpath.
> 
> Issue-Id: SCM-638
> Signed-off-by: Nathan Dunne <Nathan.Dunne@arm.com>
> Change-Id: Ic4fdd7ae03ed6bb6caa55e722b89114080c90f4c

Pulled into master.

Thanks,
Jon

> ---
>  .../images/arm-autonomy-host-image-minimal.bb            | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb b/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb
> index 188e31d..47a07cd 100644
> --- a/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb
> +++ b/meta-arm-autonomy/recipes-core/images/arm-autonomy-host-image-minimal.bb
> @@ -106,7 +106,14 @@ python add_extern_guests () {
>          _, _, path, _, _, parm = bb.fetch.decodeurl(entry)
>          if 'guestname' in parm:
>              if os.path.islink(path):
> -                bb.fatal("Guest file is a symlink: " + path)
> +                realpath = os.path.realpath(path)
> +
> +                if not os.path.exists(realpath):
> +                    bb.fatal("ARM_AUTONOMY_HOST_IMAGE_EXTERN_GUESTS link does not resolve: " + path)
> +
> +                bb.note("Guest file is a symlink:\n " + path + "\nResolved to:\n " + realpath)
> +                path = realpath
> +
>              bb.utils.mkdirhier(guestdir)
>              dstname = parm['guestname']
>              # Add file extension if not there
> -- 
> 2.17.1
> 

> 
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-16 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 13:41 [PATCH] arm-autonomy/arm-autonomy-host-image-minimal: Resolve guest path if symlink Nathan Dunne
2020-11-16 14:23 ` [meta-arm] " Jon Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.