All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Domenech Goulart <mario@parenteses.org>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] busybox: Guard against interrupted compiles
Date: Mon, 23 Jan 2017 15:37:37 +0100	[thread overview]
Message-ID: <87mveh4zbi.fsf@parenteses.org> (raw)
In-Reply-To: <1485176748.30673.16.camel@linuxfoundation.org> (Richard Purdie's message of "Mon, 23 Jan 2017 13:05:48 +0000")

On Mon, 23 Jan 2017 13:05:48 +0000 Richard Purdie <richard.purdie@linuxfoundation.org> wrote:

> On Mon, 2017-01-23 at 13:56 +0100, Mario Domenech Goulart wrote:
>> 
>> On Mon, 23 Jan 2017 12:35:52 +0000 Richard Purdie <richard.purdie@linuxfoundation.org> wrote:
>>
>> > On Mon, 2017-01-23 at 12:26 +0000, Richard Purdie wrote:
>> > > 
>> > > diff --git a/meta/recipes-core/busybox/busybox.inc
>> > > b/meta/recipes-
>> > > core/busybox/busybox.inc
>> > > index 1f4a48c..f247e8d 100644
>> > > --- a/meta/recipes-core/busybox/busybox.inc
>> > > +++ b/meta/recipes-core/busybox/busybox.inc
>> > > @@ -141,6 +141,10 @@ do_compile() {
>> > >  	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
>> > >  	if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep
>> > > "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
>> > >  	# split the .config into two parts, and make two busybox
>> > > binaries
>> > > +		if [ -e .config.org ]; then
>> > > +			# Need to guard again an interrupted
>> > > do_compile - restore any backup
>> > > +			cp .config.orig .config
>> > > +		fi
>> > I have fixed the typo...
>> Wouldn't it be better to have something like
>> 
>>    cp .config.orig .config || true
>> 
>> instead, to prevent race conditions?
>
> Prevent which race condition? I'd hope at this point we're the only
> thing touching the .config file?

Yeah, I hope so.

I mean, the "if exists(file){ do_something_with(file) }" idiom is
intrinsically subject to race conditions (time of check to time of use).
If we can [easily] avoid them, why not?

All the best.
Mario
-- 
http://parenteses.org/mario


  reply	other threads:[~2017-01-23 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 12:26 [PATCH] busybox: Guard against interrupted compiles Richard Purdie
2017-01-23 12:35 ` Richard Purdie
2017-01-23 12:56   ` Mario Domenech Goulart
2017-01-23 13:05     ` Richard Purdie
2017-01-23 14:37       ` Mario Domenech Goulart [this message]
2017-01-23 14:41         ` 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=87mveh4zbi.fsf@parenteses.org \
    --to=mario@parenteses.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.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 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.