Repository navigation
lib/model: Consider existing file when handling symlink on windows - #6977
Conversation
| case runtime.GOOS == "windows" && file.IsSymlink(): | ||
| if err := f.handleSymlinkCheckExisting(file, snap, scanChan); err != nil { | ||
| f.newPullError(file.Name, fmt.Errorf("handling unsupported symlink: %w", err)) | ||
| } |
There was a problem hiding this comment.
maybe also a // No reason to retry, changed-- as in one place above?
There was a problem hiding this comment.
Do we really know here that a retry won't help? In the case above it's an invalid file, that will never work. But here it might be e.g. a case-conflicting file that is about to be deleted in the pull later on.
|
This is concerning: though perhaps the Windows error is strangely worded, CreateFile means "create an fd" I think so this might be |
|
Where's that from? On the failed windows CI job for 88f1d1e I find |
|
It was indeed a |
* 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) ...

Purpose
When a file is replaced with a symlink (on a non-windows device), we currently leave that file alone on windows and add the symlink with the unsupported flag to the db. On next scan it will see the old file on disk, bump the version and thus reintroduce the old file to the remote, overriding the new symlink. Now before marking the symlink as unsupported on windows, we do check what is on disk and remove it (or rescan if changed).
Came up here: #6976 (comment)
Testing
New unit test.