Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Nitin A Kamble <nitin.a.kamble@intel.com>
To: "Hart, Darren" <darren.hart@intel.com>,
	 "Openembedded-core@lists.openembedded.org"
	<Openembedded-core@lists.openembedded.org>,
	 "Burton, Ross" <ross.burton@intel.com>,
	 "richard.purdie@linuxfoundation.org"
	<richard.purdie@linuxfoundation.org>
Subject: Re: [PATCH 1/1] INITRD var: make it a list of filesystem images
Date: Tue, 05 Aug 2014 10:05:25 -0700	[thread overview]
Message-ID: <53E10ED5.6030508@intel.com> (raw)
In-Reply-To: <D006556F.9F7C9%darren.hart@intel.com>


On 8/5/2014 9:45 AM, Hart, Darren wrote:
> On 8/4/14, 21:33, "Kamble, Nitin A" <nitin.a.kamble@intel.com> wrote:
>
>> On 8/4/2014 9:38 AM, Hart, Darren wrote:
>>> On 7/29/14, 11:34, "Kamble, Nitin A" <nitin.a.kamble@intel.com> wrote:
> ...
>
>>>> +	if [ -n "${INITRD}" ]; then
>>>> +		rm -f $dest/initrd
>>>> +		for fs in ${INITRD}
>>>> +		do
>>>> +			if [ -n "${fs}" ] && [ -s "${fs}" ]; then
>>> The -n test is unnecessary here. How would "for fs in ${INITRD}" result
>>> in
>>> an fs of "" ?
>> The -n test is needed here, it checks whether the file exist or not.
>
> Nope, -n tests if the string length is non-zero. See the bash manual
> section "CONDITIONAL EXPRESSIONS". -s tests if the file exists and has a
> size > 0.
You are right. it is "-N" which checks for presence of the file.

>
>>>> +				cat ${fs} >> $dest/ignited
>>>> +			fi
>>> Some kind of a warning at least is warranted if a file appears in the
>>> INITRD list but is either 0-size or non-existent.
>> I tried to keep the original style of the code. But it makes sense to
>> add a warning  or even an error here.
>
> Style is fine, but error checking is a functional thing. If it was missing
> before, it was a bug.
Noted.

>>>> build_iso() {
>>>> 	# Only create an ISO if we have an INITRD and NOISO was not set
>>>> -	if [ -z "${INITRD}" ] || [ ! -s "${INITRD}" ] || [ "${NOISO}" = "1"
>>>> ];
>>>> then
>>>> +	if [ -z "${INITRD}" ] || [ "${NOISO}" = "1" ]; then
>>>> 		bbnote "ISO image will not be created."
>>>> 		return
>>>> 	Fi
>>> Perhaps the -s test should be replaced with a -s of $dest/initrd?
>> The -s test is replaced by the loop few lines below.
>>>> +	# ${INITRD} is a list of multiple filesystem images
>>>> +	for fs in ${INITRD}
>>>> +	do
>>>> +		if [ ! -s "${fs}" ]; then
>>>> +			bbnote "ISO image will not be created. ${fs} is invalid."
>>>> +			return
>>>> +		fi
>>>> +	done
>>> This additional loop could be eliminated by including this test above.
>>> Right? Or am I missing something subtle here?
>> That approach will leave a hole where, the function will continue when
>> one of the filesystem image is invalid.
>> So the loop is better here as it does not leave any hole.
>
> But you've already built it right? So you have already tested for -s ${fs}
> previously. The only thing that matters now is that the assembled image is
> valid. $dest/initrd. Right?
No, the dest/initrd is not built at this point. It will be built in the 
populate function which is called later. so that check will always fail 
wrongly.

I also notice that RP has pulled in part of the commit already, hence I 
will be making another commit to address the feedback.

Thanks,
Nitin




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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 18:34 [PATCH 0/1] A commit to extend the INITRD variable nitin.a.kamble
2014-07-29 18:34 ` [PATCH 1/1] INITRD var: make it a list of filesystem images nitin.a.kamble
2014-08-04 16:38   ` Hart, Darren
2014-08-05  4:33     ` Nitin A Kamble
2014-08-05 16:45       ` Hart, Darren
2014-08-05 17:05         ` Nitin A Kamble [this message]

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=53E10ED5.6030508@intel.com \
    --to=nitin.a.kamble@intel.com \
    --cc=Openembedded-core@lists.openembedded.org \
    --cc=darren.hart@intel.com \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=ross.burton@intel.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