bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.99k stars 4.03k forks source link

Analysis tests generate scripts without a shebang #18940

Open keddad opened 1 year ago

keddad commented 1 year ago

Description of the bug:

Analysis tests automatically create a script with the test result, consisting of test messages and exit (0/1). It generally works nice. However, I've noticed that generated bash scripts don't contain a shebang. This means that if the test is built with Bazel, but runs with some outside tool, it might not be able to run such script without certain hacks which shouldn't be necessary.

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

Just build any analysis test on Linux and look at the generated script. No shebang.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

6.1.0-12

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 master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

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

I'm quite sure it can be fixed with a small fix to AnalysisTestActionBuilder, something along the lines of

if (isExecutedOnWindows) {
    sb.append("@echo off\n");
} else {
    sb.append("#/bin/sh")
}
iancha1992 commented 1 year ago

Hi @keddad. Thanks for letting us know about this. Can we have a snapshot of your output or logs (with no shebangs)? That'd be very helpful. Thanks.

fmeum commented 1 year ago

@iancha1992 The missing shebang line is pretty clear from the piece of code @keddad linked, so I don't think we need to see logs.

Ownership for this very particular action is probably hard to determine, but @rickeylev seems to be a good fit.