Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Cc: "Zhao, Zhenfeng" <Zhenfeng.Zhao@windriver.com>
Subject: Re: [PATCH 1/1] sanity.bbclass: check TMPDIR is not too long
Date: Tue, 22 May 2012 18:27:07 +0800	[thread overview]
Message-ID: <4FBB69FB.7030801@windriver.com> (raw)
In-Reply-To: <228b3adfffa660477cc65e00fc32c95f2bf976fd.1336445265.git.liezhi.yang@windriver.com>


I've rebased the code to the up-to-date master branch, and pushed to:

   git://git.pokylinux.org/poky-contrib robert/tmpdir
   http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/tmpdir

// Robert

On 05/08/2012 10:50 AM, Robert Yang wrote:
> When the length of TMPDIR is longer than a threshold, there would be an
> "Argument list too long" error when building gcc-cross, this is the
> error from the exec(), the maximum length of argument is defined in
> /usr/include/linux/limits.h:
>
>    #define ARG_MAX       131072    /* # bytes of args + environ for exec() */
>
> It's hard to determine the threshold of the TMPDIR, here is the
> experimental value:
> len(TMPDIR) = 182	Success
> len(TMPDIR) = 192	Failed
>
> So set the maximum length of TMPDIR to 180 seems proper.
>
> [YOCTO #2434]
>
> Signed-off-by: Robert Yang<liezhi.yang@windriver.com>
> ---
>   meta/classes/sanity.bbclass |   11 +++++++++++
>   1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 687ddeb..6aaac1e 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -30,6 +30,7 @@ def check_sanity_sstate_dir_change(sstate_dir, data):
>       testmsg = ""
>       if sstate_dir != "":
>           testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
> +
>       return testmsg
>
>   def check_sanity_tmpdir_change(tmpdir, data):
> @@ -83,6 +84,12 @@ def check_create_long_filename(filepath, pathname):
>               return "Failed to create a file in %s: %s" % (pathname, strerror)
>       return ""
>
> +def check_long_path(filepath, pathname):
> +    # The 180 is just an empirical value
> +    if len(filepath)>  180:
> +	return "The path length of %s is too long, this would cause the \"Argument list too long\" error, please use a shorter path.\n" % pathname
> +    return ""
> +
>   def check_connectivity(d):
>       # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable
>       # using the same syntax as for SRC_URI. If the variable is not set
> @@ -353,6 +360,10 @@ def check_sanity(e):
>       tmpdir = data.getVar('TMPDIR', e.data, True)
>       sstate_dir = data.getVar('SSTATE_DIR', e.data, True)
>
> +    # Check whether the length of TMPDIR is too long to cause the
> +    # argument list too long error
> +    messages = messages + check_long_path(tmpdir, "TMPDIR")
> +
>       # Check saved sanity info
>       last_sanity_version = 0
>       last_tmpdir = ""



      parent reply	other threads:[~2012-05-22 10:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08  2:50 [PATCH 0/1] sanity.bbclass: check TMPDIR is not too long Robert Yang
2012-05-08  2:50 ` [PATCH 1/1] " Robert Yang
2012-05-08  3:00   ` Robert Yang
2012-05-08  7:14   ` Phil Blundell
2012-05-08  9:58     ` Robert Yang
2012-05-22 10:27   ` Robert Yang [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=4FBB69FB.7030801@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=Zhenfeng.Zhao@windriver.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