Repository navigation
fix: rename a file to a change of case only where rclone can - #8
Conversation
Renaming notes.txt to Notes.txt was refused as a name already in use wherever the filesystem ignores case: the guard stats the new name, the entry itself answers, and macOS's local backend answers with the name it was asked for, so the file looks like another entry. The folder's real names tell the two apart: an entry that is not the renamed one and matches the new name, in whatever case, keeps the refusal. Where nothing else does, the rename goes ahead only when rclone knows the filesystem ignores case (operations/fsinfo, Features.CaseInsensitive): it then moves the file through a temporary name, as on macOS. On Linux it reports FAT, exFAT and SMB mounts as case-sensitive however they behave, and the move would delete the file instead of renaming it: the refusal now says so and suggests a rename through another name, which works. The macOS failure was reported and diagnosed by Josh Kerr in #3. That approach, refusing only when the listing holds an entry of the exact new name, would also have let the move land on a Dropbox or OneDrive folder that holds two files differing only in case. The test wrapper also sets RCLONE_LOCAL_NO_CLONE=true: on macOS rclone clones a local-to-local copy, which ends at once whatever the bandwidth limit, and the tests that need a copy still running throttle one. Older rclones ignore the unknown variable.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 45 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
daemon_wrapper_excludes_inherited_credentials_and_remotes exec'd its wrapper through Command::output, with no retry: with many tests writing their own wrappers at once, a wrapper still open for writing in a child another test forked but not yet exec'd made the exec fail with "Text file busy", and the CI run flaked. Go through common::spawn, which retries that error, as the fixtures already do.
What and why
On macOS, renaming
notes.txttoNotes.txtwas refused with "“Notes.txt” already exists here": the rename guard stats the new name, and a case-insensitive filesystem answers with the file itself — macOS's local backend answers with the name it was asked for, so the file looks like another entry.The folder's real names tell the two apart. An entry that is not the renamed one and matches the new name in whatever case keeps the "already exists" refusal, which now also guards a Dropbox or OneDrive folder holding two files that differ only in case. Where nothing else matches, the rename goes ahead only when rclone itself knows the filesystem ignores case (
operations/fsinfo,Features.CaseInsensitive, present since 1.68.0): it then moves the file through a temporary name, as on macOS. On Linux rclone reports FAT, exFAT and SMB mounts as case-sensitive however they behave, and such a move deletes the file instead of renaming it (the danger in #3 as it stood, verified withrclone mount --vfs-case-insensitive): the refusal now explains that and suggests a rename through another name, which the test walks.Tests: a clash of two files on a case-sensitive filesystem stays refused; through
CaseInsensitiveDir::over, the rename succeeds where rclone knows it can (macOS) and is refused with the file intact where it cannot (the Linux FUSE mount); the two-step rename the message suggests works on both. The suite passes against rclone 1.68.0 and 1.75.2 on Linux; the macOS branch of the fsinfo test runs on a Mac.The test wrapper also sets
RCLONE_LOCAL_NO_CLONE=true(from #3): on macOS rclone clones a local-to-local copy, which ignores the bandwidth limit two tests throttle one with.Closes #3: the report and the macOS diagnosis are Josh Kerr's; this follows the approach agreed in that pull request's review.
Checklist
cargo fmt --check,cargo clippy --all-targets -- -D warningsandcargo testpassbook/src/) is updated if keys, options or behaviour changed (not needed: nothing documented changed)[Unreleased]in CHANGELOG.mdSummary by CodeRabbit