bazel argument list too long in build_tar (pkg_tar)

382 views
Skip to first unread message

Rohit Saboo

unread,
Jun 9, 2016, 7:18:53 PM6/9/16
to bazel-...@googlegroups.com
Hello bazel-discuss,

I'm receiving an argument list too long error while using @bazel_tools//tools/build_defs/pkg/pkg.bzl:pkg_tar when bazel runs build_tar.py. Can we change it so that this command is executed via xargs or takes the file list from stdin?

Thanks,
Rohit

Damien Martin-guillerez

unread,
Jun 10, 2016, 4:05:29 AM6/10/16
to Rohit Saboo, bazel-...@googlegroups.com
Hi,

Can you give us more information? Which version of Bazel? What is the error log?

https://github.com/bazelbuild/bazel/commit/9cad21f817237de333c09953eadc4e73b10a18e5 has been there since 0.2.1 and it is using a file for passing the arguments.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAM01fBriKWxwFeb%2B-M80ryJq2Um97N9JZbr5BF7pO-xVa8cL_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Rohit Saboo

unread,
Jun 10, 2016, 4:33:46 AM6/10/16
to Damien Martin-guillerez, bazel-...@googlegroups.com
Hi Damien,

I'm using bazel version @ac08bab72 (pretty close to head) on an OSX 10.11.5 machine.

I created a filegroup with a large bunch of files and then passed this to a docker_build command as follows:

filegroup(
   ...
   srcs = [...],   // A large file list with some long paths.
)

docker_build(
  ...
  files = [":data"],
  ...
)

The output of bazel build looks like the following:

____Loading...
____Found 1 target...
____Building...
____[0 / 2] BazelWorkspaceStatusAction stable-status.txt
...
>>>>>>>>> # //<docker_target> [action 'DockerLayer <docker target>.layer']
(cd /private/var/tmp/_bazel_rohit/a10731376421707628e091029859af4a/execroot/... && \
  exec env - \
    PATH='...' \
    TMPDIR=/var/folders/p2/yz_3gtqd4z9d15l2ptzcjbsm0000gn/T/ \
bazel-out/host/bin/external/bazel_tools/tools/build_defs/pkg/build_tar '--output=bazel-out/local-fastbuild/bin/<docker_target>.layer' '--directory=...' '--mode=0555' '--file=foo/bar/abc.txt=foo/bar/abc.txt' ... (many more file arguments ...)
ERROR: ...BUILD:10:1: null failed: build_tar failed: error executing command·  (cd /private/var/tmp/_bazel_rohit/a10731376421707628e091029859af4a/execroot/beam && \
  exec env - \ 
    PATH='...' \
    TMPDIR=/var/folders/p2/yz_3gtqd4z9d15l2ptzcjbsm0000gn/T/ \
bazel-out/host/bin/external/bazel_tools/tools/build_defs/pkg/build_tar '--output=bazel-out/local-fastbuild/bin/<docker_target>.layer' '--directory=...' '--mode=0555' '--file=foo/bar/abc.txt=foo/bar/abc.txt' ... (many more file arguments ...)
...): java.io.IOException: Cannot run program "/private/var/tmp/_bazel_rohit/a10731376421707628e091029859af4a/execroot/.../_bin/process-wrapper" (in directory "/private/var/tmp/_bazel_rohit/a10731376421707628e091029859af4a/execroot/..."): error=7, Argument list too long.
Target ... failed to build

Thanks,
Rohit

Damien Martin-guillerez

unread,
Jun 10, 2016, 4:36:06 AM6/10/16
to Rohit Saboo, bazel-...@googlegroups.com
Oh I see that's the docker rules don't use that flag.
Reply all
Reply to author
Forward
0 new messages