[OE-core] [PATCH 1/1] package_manager.py: fix for "Argument list too long"

Christopher Larson clarson at kergoth.com
Sun Oct 16 04:26:59 UTC 2016


On Fri, Oct 14, 2016 at 3:18 AM, Robert Yang <liezhi.yang at windriver.com>
wrote:

> On 10/14/2016 05:58 PM, Robert Yang wrote:
>
>>
>>
>> On 10/13/2016 06:39 PM, Burton, Ross wrote:
>>
>>>
>>> On 13 October 2016 at 10:45, Robert Yang <liezhi.yang at windriver.com
>>> <mailto:liezhi.yang at windriver.com>> wrote:
>>>
>>>     This is because "copyhardlinktree(deploy_arch_dir, arch_channel)"
>>> does:
>>>     "cp -afl deploy_arch_dir/* arch_channel", while the
>>> deploy_arch_dir/* is
>>>     expanded to "deploy_arch_dir/pkg1 deploy_arch_dir/pkg2
>>>     deploy_arch_dir/pkg3 ..." which causes the "Argument list too long",
>>>     change cwd to deploy_arch_dir can avoid the error.
>>>
>>>
>>> Would it be better to change the implementation of copyhardlinktree so
>>> that it
>>> *can't* have this problem?
>>>
>>
>> Good idea, thanks, updated in the repo:
>>
>>   git://git.openembedded.org/openembedded-core-contrib rbt/long
>>   http://cgit.openembedded.org/cgit.cgi/openembedded-core-cont
>> rib/log/?h=rbt/long
>>
>>
> Sorry, this patch is not what I wanted to paste, it should be:
>
> diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
> index 06a5af2..1d9cca5 100644
> --- a/meta/lib/oe/path.py
> +++ b/meta/lib/oe/path.py
> @@ -80,15 +80,20 @@ def copyhardlinktree(src, dst):
>          cmd = "cd %s; find . -type d -print | tar --xattrs
> --xattrs-include='*' -cf - -C %s -p --no-recursion --files-from - | tar
> --xattrs --xattrs-include='*' -xf - -C %s" % (src, src, dst)
>          subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
>          source = ''
> +        oldcwd = os.getcwd()
>          if os.path.isdir(src):
> +            dst = os.path.realpath(dst)
> +            # chdir() to src to avoid "Argument list too long" error
> +            os.chdir(src)
>              import glob
> -            if len(glob.glob('%s/.??*' % src)) > 0:
> -                source = '%s/.??* ' % src
> -            source = source + '%s/*' % src
> +            if len(glob.glob('./.??*')) > 0:
> +                source = './.??* '
> +            source += './*'
>          else:
>              source = src
>          cmd = 'cp -afl --preserve=xattr %s %s' % (source, dst)
>          subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
> +        os.chdir(oldcwd)


Question, why not just pass cwd=src in the check_output() call, rather than
changing it in the parent python process?
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20161015/ff1ac626/attachment-0002.html>


More information about the Openembedded-core mailing list