-
Notifications
You must be signed in to change notification settings - Fork 837
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
Colon (:) in in object_store::path::{Path} is not handled on Windows #5592
Comments
This would be a breaking change but probably makes sense on balance |
@tustvold I guess it would be breaking but would anyone rely on a path that can't exists? Or does this sanitizing happen for the same set of chars across all platforms? |
It is the same set of chars across all platforms, although I suppose we could just add some special logic for windows within LocalFilesystem... |
|
I think probably we should add specific handling within LocalFilesystem on Windows. Just because Windows filesystems are a complete mess, I don't think that shouldn't leak out. This would also avoid a breaking change Perhaps we could explicitly escape them or something on Windows platforms? Is there standard way the windows ecosystem works around this limitation? |
@tustvold I did a lot of googling and from what I can tell there is no default way. I think it is a good route to go to just explicitly escape them. Maybe just starting with |
I was going to suggest to have several platform specific modified object_store/src/path/parts.rs
@@ -73,6 +73,7 @@ impl<'a> PathPart<'a> {
}
/// Characters we want to encode.
+#[cfg(target_family="windows")]
const INVALID: &AsciiSet = &CONTROLS
// The delimiter we are reserving for internal hierarchy
.add(DELIMITER_BYTE)
@@ -97,8 +98,38 @@ const INVALID: &AsciiSet = &CONTROLS
.add(b'\r')
.add(b'\n')
.add(b'*')
+ .add(b':')
.add(b'?');
I didn't have a thorough look but does it suffice to have this special logic in /// Return an absolute filesystem path of the given file location
pub fn path_to_filesystem(&self, location: &Path) -> Result<PathBuf> {
ensure!(
is_valid_file_path(location),
InvalidPathSnafu {
path: location.as_ref()
}
);
self.config.prefix_to_filesystem(location)
} |
It would be a breaking change, not to mention extremely disruptive, to add |
Thanks @tustvold! I'll gladly help out but might need some guidance to drive it home. I've created a draft, appreciate if you could take a look to see if I'm on the right track :) |
I agree with @tustvold that it should windows-only but I think it should be true be default given that it can never be a valid path on windows. |
Describe the bug
When creating a
Path
on Windows colon (:
) is not sanitized like<
and|
.To Reproduce
See SO for forbidden chars https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names
Expected behavior
I would have expected the output to be
Additional context
This came up here delta-io/delta-rs#2382
The text was updated successfully, but these errors were encountered: