Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary targets on Windows use --run_under's runfiles manifest if the argument is a rule #10598

Closed
gmishkin opened this issue Jan 15, 2020 · 2 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@gmishkin
Copy link

gmishkin commented Jan 15, 2020

Description of the problem / feature request:

On Windows only, when using --run_under with an argument that's a binary rule in the workspace (as opposed to some binary from PATH), the binary rule you're actually running with bazel run sees the run under rule's runfiles manifest and not its own.

Of course that manifest doesn't have much of anything in it and so rlocation of an actual data dep of the binary rule fails. It works fine on Mac and Linux.

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

https://github.com/gmishkin/run_under_runfiles

bazel run //:printer

On Linux, it works fine. You see the contents of the data file from the "printer" rule and the "timer" run_under script prints the time it took.

On Windows it fails with cat: '': No such file or directory but you see the timer results from run_under. If you comment out the --run_under line in the .bazelrc you do see the contents of the data file, but not the elapsed time.

What operating system are you running Bazel on?

Windows 10 version 1909

What's the output of bazel info release?

release 2.0.0

Have you found anything relevant by searching the web?

Some stuff about runfiles on Windows but nothing about interaction with --run_under.

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

I'm using --enable_runfiles=yes on Windows but removing that has no effect one way or another.

@jin jin added area-Windows Windows-specific issues and feature requests untriaged labels Jan 23, 2020
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@philwo philwo added P1 I'll work on this now. (Assignee required) type: bug and removed untriaged labels Nov 26, 2020
@meteorcloudy
Copy link
Member

The fix for this issue turned out to be problematic, see: #14500

@meteorcloudy
Copy link
Member

If --run_under points to a rule, it's better that the target itself make sure it doesn't pass its own RUNFILES_* env vars to the binary it invokes. In this case,

diff --git a/timer.sh b/timer.sh
index df4efd1..7194607 100755
--- a/timer.sh
+++ b/timer.sh
@@ -2,4 +2,5 @@

 set -eu

+unset RUNFILES_MANIFEST_FILE
 time "$@"

will make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants