From: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
To: Henning Schild <henning.schild@siemens.com>
Cc: vijaikumar.kanagarajan@gmail.com, isar-users@googlegroups.com
Subject: Re: [PATCH] meta/classes: Make sure the files exists before copying
Date: Fri, 8 Nov 2019 23:11:48 +0530 [thread overview]
Message-ID: <20191108174148.GA9643@oxygen> (raw)
In-Reply-To: <20191108181055.16316147@md1za8fc.ad001.siemens.net>
On Fri, Nov 08, 2019 at 06:10:55PM +0100, Henning Schild wrote:
> 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.
I had that dilemma. Decided to go with -e since realpath had that
provision. We could use -f as well, if that makes code more readable.
Will send a v2.
Thanks,
Vijai Kumar K
>
> Henning
next prev parent reply other threads:[~2019-11-08 17:41 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
2019-11-08 17:41 ` Vijai Kumar K [this message]
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=20191108174148.GA9643@oxygen \
--to=vijaikumar.kanagarajan@gmail.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.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