spacedrive
spacedrive copied to clipboard
Error logged when getting the hash of an on-demand file
Describe the bug
- When Spacedrive attempts to read the metadata from an on-demand file, an error is printed to the log
- On-Demand files allows OneDrive to download files as they are needed by programs
- Error only occurs if OneDrive is not running, otherwise the file will be downloaded (which is also not good)
- Error is logged both during the indexing process, and every time the directory containing the file is opened
- On-Demand files are a built-in feature of NTFS Example:
2023-11-01T19:29:02.533749Z ERROR sd_core::object::file_identifier: Failed to extract file metadata: FileIOError {
path: "C:\\Users\\xxxxx\\OneDrive\\Document.docx",
source: Os {
code: 362,
kind: Uncategorized,
message: "The cloud file provider is not running.",
},
maybe_context: None,
}
Reproduction
- Close OneDrive
- Add directory containing on-demand files to Spacedrive (Opening an already indexed location works too)
- One of the following occurs: a. If OneDrive is open, the file is downloaded b. If OneDrive is closed, an error is printed to the log
Expected behavior
- Each file should be checked for the
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESSattribute. And if it has the attribute, it should be handled in a way that doesn't trigger a download or the error.
Platform and versions
pnpm --version: 8.10.0
cargo --version: cargo 1.73.0 (9c4383fb5 2023-08-26)
rustc --version: rustc 1.73.0 (cc66ad468 2023-10-03)
Get-ComputerInfo | Select-Object OsName,OsVersion,CsModel | Format-List:
OsName : Microsoft Windows 11 Enterprise
OsVersion : 10.0.22621
CsModel : Blade 14 - RZ09-0370
Seems that the error occurs when attempting to generate a hash for the file, which obviously won't work if the file is "offline". A possible solution would be to skip hashing the file. Maybe instead, a hash could be created using the file's metadata? That could be used to detect whether an offline file has been changed, even if it remains "offline".