-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
package hash differs between operating systems due to file system case sensitivity #18089
Comments
First step to troubleshooting this will be to run |
The mac side seems to show 6 fewer files. Upon looking at the tar, these files are included in the tar twice with different case sensitivity in the filename. i.e.:
|
I've found the same comparing Windows and Linux. Windows gives the same hash as MacOS and the missing files are the same as listed above |
Should one allow OS specific hashes in zon dependency description? Otherwise one will be fighting these corner cases forever. |
This would be problematic if the files with the same case insensitive name, but different case sensitive name actually contained different data |
Oooof...differences in case-sensitivity of file names strikes again. My suggestion would be for Zig to detect and by default reject archives that aren't usable on all supported platforms. So in this case you'd get: $ zig build
error: dependency `iterm2_themes` contains the following filename conflicts:
alacritty/Darkermatrix.yml
alacritty/darkermatrix.yml
alacritty/Darkmatrix.yml
alacritty/darkmatrix.yml
... This solution might be "good enough" and will encourage developers to create archives that are more portable. That being said...if we do want to support these types of archives (not saying we should), we have some options. We could allow projects to opt-in to allowing these conflicts, i.e. .{
// ...
.iterm2_themes = .{
.url = "https://github.com/mbadolato/iTerm2-Color-Schemes/archive/aed2a8f0565a51913e8ddc1731f25bc71978a1e0.tar.gz",
.allow_filename_casing_conflicts = true,
}
} Note this would mean the package becomes usable when building on a system where zig's package cache is on a case-insensitive filesystem. This would break cross-compilation to/from particular targets which is unfortunate. A better option could be to provide some sort of way to modify how the archive is extracted to resolve the filename conflicts, i.e. .{
// ...
.iterm2_themes = .{
.url = "https://github.com/mbadolato/iTerm2-Color-Schemes/archive/aed2a8f0565a51913e8ddc1731f25bc71978a1e0.tar.gz",
.renames = &.{
&.{ "alacritty/Darkmatrix.yml", "alacritty/darkmatrix2.yml" },
},
}
} This means no longer having a requirement on a case-sensitive filesystem and the dependency is uniform across all platforms. This being said, I think it's reasonable to start with simply rejecting these types of archives and allow authors to repackage them in a more portable form, after all they'd be the best ones to know the correct changes. Enabling new exotic cross-compilation can be used as a motivator for these kinds of changes. We can think about whether we'd like to make it easy to patch archives separately. P.S. It seems weird that Windows/macOS, the 2 big OS's backed by large companies happen to be the problem children that don't use case-sensitive filesystems by default. I expect this from Windows but macOS? |
once #14597 is solved one could conditionally allow packages with conflicts like these on platforms where its allowed |
I've also made an upstream PR to fix the source repo: mbadolato/iTerm2-Color-Schemes#425 We probably should still figure out the proper behavior for Zig though in these cases. |
the tar unpacker should error on windows/macos that there's name conflicts when creating the files. |
The first step is to implement errors in the tar unpacking code when a tar file cannot be extracted correctly due to the file system being incompatible with the tar file. This is already the case with, for example, symlinks on Windows with default settings. It also needs to be implemented in the git fetching code. Just like with symlinks, errors with these particular files should be ignored if they are not included by the package manifest (i.e. filtered with the Just like with symlinks, this will cause URLs to work on some operating systems but fail to be fetched on others. What @marler8997 is describing is useful functionality, but I think it should be a separate linting feature. Here's a laundry list of features such a linter could provide:
|
Fail with error if file already exists. File is not silently overwritten but an error is raised. Fixes: ziglang#18089
Like in issue ziglang#18089, this tar contains, same file name in two case sensitive name version. Unpack should fail on case insensitive file systems and succeed on case sensitive. $ tar tvf 18089.tar 18089/ 18089/alacritty/ 18089/alacritty/darkermatrix.yml 18089/alacritty/Darkermatrix.yml
In order to close this issue:
|
Fail with error if file already exists. File is not silently overwritten but an error is raised. Fixes: ziglang#18089
Like in issue ziglang#18089, this tar contains, same file name in two case sensitive name version. Unpack should fail on case insensitive file systems and succeed on case sensitive. $ tar tvf 18089.tar 18089/ 18089/alacritty/ 18089/alacritty/darkermatrix.yml 18089/alacritty/Darkermatrix.yml
Zig Version
0.12.0-dev.1647+325e0f5f0
Steps to Reproduce and Observed Behavior
On macOS:
12201fff83e91996f5c6abf51c8d0a54630926d81564f75681e1972575058d6476fc
On Linux:
12202a04dfdfc563f0c74a61559a549c194405f0ef562e5c20e32066bde0bbcd1020
Expected Behavior
Hashes should match. I'm not sure what is causing the problem yet.
The text was updated successfully, but these errors were encountered: