[OE-core] [PATCH 1/1] sanity.bbclass: check TMPDIR is not too long
Robert Yang
liezhi.yang at windriver.com
Tue May 22 10:27:07 UTC 2012
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 at 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 = ""
More information about the Openembedded-core
mailing list