Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Mike Crowe <mac@mcrowe.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/2] sanity: Use random filename for maximum path length test
Date: Mon, 25 Nov 2013 15:48:47 +0000	[thread overview]
Message-ID: <1385394527.24083.15.camel@ted> (raw)
In-Reply-To: <1385392815-29916-1-git-send-email-mac@mcrowe.com>

On Mon, 2013-11-25 at 15:20 +0000, Mike Crowe wrote:
> check_create_long_filename used a fixed filename for its test files. This
> meant that os.remove(testfile) could fail with ENOENT if two instances were
> running at the same time against the same sstate directory. Using a
> randomly generated filename stops this from happening.
> 
> (Although it might seem unlikely, this race did appear to occur multiple
> times with Jenkins - presumably because the matrix jobs were all kicked off
> at the same time.)
> 
> Signed-off-by: Mike Crowe <mac@mcrowe.com>
> ---
>  meta/classes/sanity.bbclass |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

We've been puzzling over this on the project autobuilder too, although I
didn't spot why, nicely found!

Cheers,

Richard

> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 6807a23..0d40792 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -175,7 +175,8 @@ def check_conf_exists(fn, data):
>      return False
>  
>  def check_create_long_filename(filepath, pathname):
> -    testfile = os.path.join(filepath, ''.join([`num`[-1] for num in xrange(1,200)]))
> +    import string, random
> +    testfile = os.path.join(filepath, ''.join(random.choice(string.ascii_letters) for x in range(200)))
>      try:
>          if not os.path.exists(filepath):
>              bb.utils.mkdirhier(filepath)




      parent reply	other threads:[~2013-11-25 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 15:20 [PATCH 1/2] sanity: Use random filename for maximum path length test Mike Crowe
2013-11-25 15:20 ` [PATCH 2/2] sanity: Don't hard code value of ENAMETOOLONG Mike Crowe
2013-11-25 15:48 ` Richard Purdie [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=1385394527.24083.15.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=mac@mcrowe.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