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

Support case-sensitive package loading #10345

Closed

Conversation

laszlocsomor
Copy link
Contributor

The new --[no]experimental_check_label_casing flag
enables a new validation step in package loading:
when enabled, Bazel requires that package paths be
case-correct.

When the user runs "bazel build //Foo/Bar:Baz",
Bazel looks up the package "Foo/Bar" by stat'ing
"Foo/Bar/BUILD". If the file exists, then the
package exists. Every Label that Bazel creates in
this package is derived from the "Foo/Bar" string.

On Linux the filesystem is case-sensitive, so the
path casing must be correct for stat() to succeed,
so it's impossible to load the package "//Foo/Bar"
as "//FOO/baR".

On Windows and macOS the filesystem ignores the
difference between lower and upper case letters,
so stat("foo/bAr/BUILD") and stat("FOO/bar/build")
would both suceed, so "bazel build //foo/bAr:Baz"
and "bazel build //FOO/bar:Baz" both work. This
leads to bugs such as #6401, #8009, and #8799.

Change-Id: I5ad86a0ede6f85aa9cac8e8e56072630738db55c

The new --[no]experimental_check_label_casing flag
enables a new validation step in package loading:
when enabled, Bazel requires that package paths be
case-correct.

When the user runs "bazel build //Foo/Bar:Baz",
Bazel looks up the package "Foo/Bar" by stat'ing
"Foo/Bar/BUILD". If the file exists, then the
package exists. Every Label that Bazel creates in
this package is derived from the "Foo/Bar" string.

On Linux the filesystem is case-sensitive, so the
path casing must be correct for stat() to succeed,
so it's impossible to load the package "//Foo/Bar"
as "//FOO/baR".

On Windows and macOS the filesystem ignores the
difference between lower and upper case letters,
so stat("foo/bAr/BUILD") and stat("FOO/bar/build")
would both suceed, so "bazel build //foo/bAr:Baz"
and "bazel build //FOO/bar:Baz" both work. This
leads to bugs such as bazelbuild#6401, bazelbuild#8009, and bazelbuild#8799.

Change-Id: I5ad86a0ede6f85aa9cac8e8e56072630738db55c
@laszlocsomor laszlocsomor changed the title WIP: Support case-sensitive package loading Support case-sensitive package loading Dec 2, 2019
@laszlocsomor laszlocsomor marked this pull request as ready for review December 2, 2019 13:09
@laszlocsomor laszlocsomor requested a review from ulfjack December 2, 2019 13:09
Change-Id: Ib1e8ed4eb468f9fa9d858a461ee617e1cb77b9c5
Change-Id: I7feebbdf3d98d66fa3fa2ce8578e267c89a83cfd
Change-Id: I178cbbcd1b30dac6cc32671887c2c5c58244f444
Change-Id: I43dd967f7695c13d6cc4a1b18e82c165ade95b5a
@laszlocsomor
Copy link
Contributor Author

I'll split up this PR to smaller chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants