-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
runfiles.go should look at os.Args[0] + ".runfiles" etc. #2359
Comments
It doesn't look like any runfile environment variables are passed to an executable when run by a Because of the lack of any specification, and the fact runfiles work differently on different platforms and in different configurations, I'm hesitant to make changes here. |
There's some documentation at https://docs.bazel.build/versions/2.0.0/output_directories.html. Specifically, the lines
imply that the runfiles are at https://docs.bazel.build/versions/2.0.0/skylark/rules.html#tools-with-runfiles also covers this and documents the location relatively well. |
Thanks, that's helpful. It's been a while since I read through https://docs.bazel.build/versions/2.0.0/skylark/rules.html, but it looks like runfiles are documented better now.
|
What version of rules_go are you using?
0.21.2
What version of gazelle are you using?
None
What version of Bazel are you using?
2.0.0
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Debian GNU/Linux, x86-64
Any other potentially useful information about your toolchain?
No
What did you do?
I created the following workspace:
Then run
bazel build :copy.txt
.What did you expect to see?
Command succeeds
What did you see instead?
The issue is that Bazel actions don't pass runfiles environment variables, and the current directory is also incorrect. Rather, runfiles.go should look at
os.Args[0] + ".runfiles"
,os.Args[0] + ".runfiles/MANIFEST"
, andos.Args[0] + ".runfiles_manifest"
. See the C++ code for comparison: https://github.com/bazelbuild/bazel/blob/master/tools/cpp/runfiles/runfiles_src.cc#L271-L280.The text was updated successfully, but these errors were encountered: