Case Sensitivity can lead to a template that compiles on Windows, but not Linux
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
`Bicep CLI version 0.3.255 (589f0375df)`
**Describe the bug**
Consider the following module definition
```bicep
module foo 'foo.bicep' = {
//...
}
```
If the filename of the module referenced is actually `FOO.BICEP` (note the case difference), then the template will compile fine on windows, but fail on linux due to difference in filesystem case sensitivity .
> /agent/_work/1/s/bar.bicep(46,13) : Error BCP091: An error occurred reading file. Could not find file '/agent/_work/1/s/foo.bicep'.
**Additional context**
It's not uncommon to have local dev on windows machines, but then have the build server run on linux (or vice versa).
I see three options to resolve this:
1. Make the paths case insensitive, regardless of the underlying filesystem case sensitivity
2. Force the paths to be case sensitive, even if the filesystem is case insensitive
3. Leave the case sensitivity dependant on the underlying filesystem, but provide warnings when the case doesn't match. (This warning could also be combined with a quick fix in the editor for easy resolution)
My vote would be for a mix of options 2 & 3 - force case sensitivity, but if a file is found that differs only in case, provide an error message (and ideally editor fix) that highlights this - e.g. `Did you mean 'FOO.bicep'`.
Contributor guide
Research direction
Reproduce the module reference from bar.bicep when the file is named FOO.BICEP, testing on Windows and Linux. Start by tracing how the compiler resolves the referenced foo.bicep path; done should mean a defined, consistent case-sensitivity behavior and an appropriate diagnostic when the filename differs only by case.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100