Repository navigation
lib/model: Handle symlink deletion on windows (fixes #6972) - #6976
Conversation
| f.deleteFile(file, snap, dbUpdateChan, scanChan) | ||
| if runtime.GOOS == "windows" { | ||
| // We never had it, just pretend we deleted it | ||
| dbUpdateChan <- dbUpdateJob{file, dbUpdateDeleteFile} |
There was a problem hiding this comment.
This might not strictly be true, if it's a file that we synced once that then changed to be a symlink and then finally was deleted -- we would still have the file around? Or maybe that case would have been handled differently to begin with or picked up by the scanner after we ignored the symlink change...?
There was a problem hiding this comment.
Good point - I moved the fix into deleteFile.
Unrelated to the PR but a similar problem: We also don't fully handle valid file to symlink on windows: We do mark it as invalid and synced, but we do not check if there's an old file and remove that. Quite likely on next scan we then pick up the old file and give it a new version, overriding the symlink. Need to check that out.
| } | ||
| if fs.IsNotExist(err) { | ||
| if hasCur && !cur.Deleted { | ||
| if hasCur && !cur.Deleted && !cur.IsUnsupported() { |
There was a problem hiding this comment.
I wasn't sure whether this should be the generic test for unsupported flag or if it should be runtime.GOOS == windows && cur.IsSymlink(). Currently we only use the unsupported flag for this use case, so it applies. And if we keep using that flag for stuff we do not ever write to disk (which makes sense when it is unsupported), the generic check is sensible.
* main: (50 commits) cmd/ursrv: Properly sort versions (fixes syncthing#6991) cmd/ursrv: Recognize new-style dev versions gui, man, authors: Update docs, translations, and contributors build: Dockerfile that expects ready baked binaries lib/model: Consider case conflicts when checking to be deleted items (syncthing#6986) lib/fs: Optimize UnicodeLowercase (syncthing#6979) lib/db, lib/syncthing: Don't repair DB on upgrade, but on error (fixes syncthing#6917) (syncthing#6971) lib/model: Consider existing file when handling symlink on windows (syncthing#6977) lib/model: Handle symlink deletion on windows (fixes syncthing#6972) (syncthing#6976) lib/model: Fix case-only renames on pull (syncthing#6978) lib/fs: More efficient casefs cache (syncthing#6974) lib/model: Don't fail over case-conflict on tempfile (fixes syncthing#6973) (syncthing#6975) gui, man, authors: Update docs, translations, and contributors lib/fs: Use generic case resolver on windows (fixes syncthing#6968) (syncthing#6969) lib/model: Prevent duplicate need count on recalculating metadata (syncthing#6964) lib/db, lib/protocol: Never need empty-version entries (fixes syncthing#6961) (syncthing#6962) lib/model: Correct completion perc. when globalBytes is 0 (syncthing#6963) lib/db: Don't hang on double iterator release with Badger (syncthing#6960) test, lib/model: Various integration test updates & improvements (syncthing#6956) lib/db: Copy returned, old FileVersion (syncthing#6952) ...
We never have symlinks on windows, so no need to try to delete them (and get confused by it being in db but not on disk).
Tested manually.