Skip to content

run_shell doesn't pass arguments to scripts #29365

Description

@styurin

Description of the bug:

When run_shell is used with a script of big size, Bazel saves the script to a file and runs it. With that, arguments of the action are not passed to the script.

Which category does this issue belong to?

Core

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Example with the problem: bazelbuild/examples#685

Running bazel build shell_command:echo produces this error:

ERROR: .../examples/rules/shell_command/BUILD:22:5: Action shell_command/echo.txt failed: (Exit 1): bash failed: error executing Action command (from target //shell_command:echo) /bin/bash -c bazel-out/darwin_arm64-fastbuild/bin/shell_command/echo.run_shell_0.sh '' arg

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
bazel-out/darwin_arm64-fastbuild/bin/shell_command/echo.run_shell_0.sh: line 2: $1: unbound variable

However, if I remove one "a" from this line, the build succeeds.

Which operating system are you running Bazel on?

MacOS

What is the output of bazel info release?

release 8.1.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

It looks like it's related to #6391, but the current issue is more generic. It reports an issue that can appear with scripts which size depends on input files: with small set of input files such actions can work fine, but fail unexpectedly when number of input files grows.

Any other information, logs, or outputs that you want to share?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    team-CoreSkyframe, bazel query, BEP, options parsing, bazelrctype: buguntriagedHas not yet been seen by appropriate subteam

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions