Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@linux.intel.com>
To: "Cui, Dexuan" <dexuan.cui@intel.com>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] oe-init-build-env, scripts/oe-buildenv-internal: add error detecting for $BDIR
Date: Wed, 03 Aug 2011 23:00:02 -0700	[thread overview]
Message-ID: <4E3A3562.1060907@linux.intel.com> (raw)
In-Reply-To: <1865303E0DED764181A9D882DEF65FB6B3044150C6@shsmsx502.ccr.corp.intel.com>



On 08/03/2011 07:25 PM, Cui, Dexuan wrote:
> Darren Hart wrote on 2011-08-03:
>> On 08/02/2011 11:46 PM, Cui, Dexuan wrote:
>>> Hi Darren, thanks for the suggestion! I considered the idea too,
>>> however, if we use the idea, it looks not that simple to gracefully
>>> and concisely handle the case if a user (by accident or by prank)
>>> passes / as $1 here, i.e., "readlink -f" would fail. So I didn't do
>>> that.
>>
>> Hi Dexuan, 
>> I had not considered that case, good catch. I can't think of a valid
>> use case for BDIR="/". Not only are write permissions unlikely, but
> Agree.
> 
>> the build would conflict with /tmp as well.
>>
>> if [ "$BDIR" == "/" ]; then
>> 	echo "ERROR: / is not supported as a build directory."
>> 	exit 1
>> fi
>> BDIR=${BDIR%/}
> Hi Darren,
> This seems good to me.
> Looks ${BDIR%/} can only remove one trailing slash. Do we need to consider more-than-one-slashes, e.g., $BDIR is /home/poky/build///? :-)   (We could use sed:  BDIR=`echo $BDIR | sed -re 's|/+$||'` , but I'm not sure if it deserves the complexity)
> Darren, could you please help to make a patch? 
> I really have few experience about how to validate a user's input. :-)

At some point I think it's fair for us to say "so don't do that" when
someone says "if I pass this random string of garbage to the script it
gives up and uses the current directory".

As for a patch, I'm on Jury duty all this week and only get to a very
small percentage of my tasks. I would appreciate if you would try to put
one together using the above source snippet, with the suggested changes
from Paul of course. Then just send it to the list with Paul and myself
on CC. We'll review and provided additional Acked-by's to confirm we're
all happy with the end result.

I would suggest you include a patch to first revert the previous patch
that was applied to address this issue.

--
Darren

> 
>> I would be happy with something like the above (untested). It seems a
>> lot more clear and direct to me.
>>
>> In any case, I don't see any reason to bail out and ask the user to
>> remove a trailing slash. We should just do this and move on. There is
>> no semantic difference from the user's perspective, and the blame is
>> to be placed on readlink, not the user.
> I agree.
> 
> Thanks,
> -- Dexuan
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



  reply	other threads:[~2011-08-04  6:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02  6:08 [PATCH 0/1] fix to bug 671 Dexuan Cui
2011-08-02  6:08 ` [PATCH 1/1] oe-init-build-env, scripts/oe-buildenv-internal: add error detecting for $BDIR Dexuan Cui
2011-08-02 11:43   ` Richard Purdie
2011-08-03  4:06     ` Darren Hart
2011-08-03  6:46       ` Cui, Dexuan
2011-08-03 13:50         ` Darren Hart
2011-08-03 14:01           ` Paul Eggleton
2011-08-03 14:11             ` Phil Blundell
2011-08-03 14:21               ` Paul Eggleton
2011-08-03 14:25                 ` Phil Blundell
2011-08-04  2:25           ` Cui, Dexuan
2011-08-04  6:00             ` Darren Hart [this message]
2011-08-04  7:37               ` Cui, Dexuan
2011-08-04 13:44                 ` Darren Hart
2011-08-04 14:49                   ` Cui, Dexuan
2011-08-04 14:53                     ` Phil Blundell
2011-08-04 15:14                       ` Cui, Dexuan
2011-08-09  2:13                     ` Cui, Dexuan
2011-08-09  4:35                       ` Darren Hart
2011-08-09 14:04                         ` Cui, Dexuan
2011-08-09 15:06                           ` Darren Hart
2011-08-10  3:18                             ` Cui, Dexuan
2011-08-10 12:21                               ` Richard Purdie
2011-08-10 13:04                               ` Richard Purdie
2011-08-04 12:07       ` Richard Purdie
2011-08-04 13:37         ` Darren Hart
2011-08-04 14:19           ` Richard Purdie

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=4E3A3562.1060907@linux.intel.com \
    --to=dvhart@linux.intel.com \
    --cc=dexuan.cui@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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