public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: <vijaikumar.kanagarajan@gmail.com>
Cc: <isar-users@googlegroups.com>,
	Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Subject: Re: [PATCH] meta/classes: Make sure the files exists before copying
Date: Fri, 8 Nov 2019 18:10:55 +0100	[thread overview]
Message-ID: <20191108181055.16316147@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20191108114158.30076-1-Vijaikumar_Kangarajan@mentor.com>

Am Fri, 8 Nov 2019 17:11:58 +0530
schrieb <vijaikumar.kanagarajan@gmail.com>:

> From: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
> 
> By default realpath doesnot check if the file exists and hence
> might return an invalid path. Use -e to check if the file actually
> exists.
> 
> Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
> ---
>  meta/classes/image.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 8384b71..5b2eee0 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -128,12 +128,12 @@ EOF
>  
>  do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
>  do_copy_boot_files() {
> -    kernel="$(realpath -q '${IMAGE_ROOTFS}/${KERNEL_FILE}')"
> +    kernel="$(realpath -eq '${IMAGE_ROOTFS}/${KERNEL_FILE}')"
>      if [ -n "$kernel" ]; then
>          cp -f "$kernel" '${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE}'
>      fi
>  
> -    initrd="$(realpath -q '${IMAGE_ROOTFS}/initrd.img')"
> +    initrd="$(realpath -eq '${IMAGE_ROOTFS}/initrd.img')"
>      if [ -n "$initrd" ]; then
>          cp -f "$initrd" '${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}'
>      fi

I would rather convert the "-n" checks into "-f". It is the same but i
think more readable. People are more likely to know test -f than
realpath -q ... i guess.

Henning

  reply	other threads:[~2019-11-08 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 11:41 vijaikumar.kanagarajan
2019-11-08 17:10 ` Henning Schild [this message]
2019-11-08 17:41   ` Vijai Kumar K
2019-11-08 17:47     ` [PATCH v2] " vijaikumar.kanagarajan
2019-12-03  5:33       ` vijai kumar
2019-12-05  9:36         ` Henning Schild
2019-12-05 12:55       ` Baurzhan Ismagulov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108181055.16316147@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=Vijaikumar_Kanagarajan@mentor.com \
    --cc=isar-users@googlegroups.com \
    --cc=vijaikumar.kanagarajan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox