One cannot have "external" top-level directory and more
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
Unfortunately if one have a directory named "external" it produces some kind of race (creating junction vs creating bazel internal directory with the same name) and often source forest creation **fails**:
```
ERROR: Source forest creation failed: Cannot create junction (name=C:\users\chebotarev_v\appdata\local\temp\_bazel_chebotarev_v\w0ulolcy\execroot\__main__\external, target=C:\users\chebotarev_v\perforce\chebotare
v_pdk\bin\bazel\external): ERROR: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\chebotarev_v\appdata\local\temp\_bazel_chebotarev_v\w0ulolcy\execroot\__main__\external, C:\users\chebotare
v_v\perforce\chebotarev_pdk\bin\bazel\external): ERROR: src/main/native/windows/file.cc(128): CreateJunction(\\?\C:\users\chebotarev_v\appdata\local\temp\_bazel_chebotarev_v\w0ulolcy\execroot\__main__\external):
Cannot create a file when that file already exists.
```
After second try it turns out that bazel erases source forest from bazel-bazel but **skips** directories which start from dot (see also #4060):
```
ERROR: Source forest creation failed: Cannot create junction (name=C:\users\chebotarev_v\appdata\local\temp\_bazel_chebotarev_v\w0ulolcy\execroot\__main__\.delivery, target=C:\users\chebotarev_v\perforce\chebotar
ev_pdk\bin\bazel\.delivery): ERROR: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\chebotarev_v\appdata\local\temp\_bazel_chebotarev_v\w0ulolcy\execroot\__main__\.delivery, C:\users\chebot
arev_v\perforce\chebotarev_pdk\bin\bazel\.delivery): ERROR: src/main/native/windows/file.cc(128): CreateJunction(\\?\C:\users\chebotarev_v\appdata\local\temp\_bazel_chebotarev_v\w0ulolcy\execroot\__main__\.delive
ry): Cannot create a file when that file already exists.
```
> ATTENTION! Please read and follow:
> - if this is a _question_ about how to build / test / query / deploy using Bazel, ask it on StackOverflow instead: https://stackoverflow.com/questions/tagged/bazel
> - if this is a _discussion starter_, send it to bazel-discuss@googlegroups.com
> - if this is a _bug_ or _feature request_, fill the form below as best as you can.
### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I believe one can get fairly big project and create "external" and ".something" top level directories with some BUILD files and run `bazel build ...`. I will try `tensorflow` and post results later in discussion below.
### What operating system are you running Bazel on?
Windows 10 x64
### What's the output of `bazel info release`?
release 0.8.0 and release 0.9.0
### Have you found anything relevant by searching the web?
No.
Contributor guide
Assessment
This issue has not been assessed yet.