Repository navigation
lib/fs: Evaluate root when watching not on fs creation (fixes #5043) - #5105
Conversation
| // penetrate symlinks. On Windows, paths must not end with a slash. | ||
| if root[len(root)-1] != filepath.Separator { | ||
| root = longFilenameSupport(root) | ||
| } else if root[len(root)-1] != filepath.Separator { |
There was a problem hiding this comment.
I'd do a real strings.HasSuffix here instead, avoids crashing on the empty string etc
There was a problem hiding this comment.
Done. I also adapted the windows fs creation test for unixes to check this and other basic scenarios. Apparently the tilde and absolutification meddling above already changed "" to "/", so it wouldn't panic even before.
I've seen that permission denied error before, but I don't remember what caused it. IIRC, somehow the "_recvonly" dir or the containing dir gets chmod 000 due to some integration with another test... It passes reliably in master and fails reliably on this branch which is odd. |
|
It does not pass reliable on master, it just seems to be happening a whole lot right now. See e.g. here: https://build.syncthing.net/viewLog.html?buildId=24835&tab=buildResultsDiv&buildTypeId=Syncthing_BuildWindows#testNameId8662697608653222476 I initially didn't want to fix #5110 immediately (that's why I created the issue as a reminder), but these recurrent failures changed my mind - PR incoming. Hopefully it will actually fix things... |
* release: lib/model: Fixes on receive-only test setup and pulling (syncthing#5136) lib/fs: Don't add path separators at end of path (fixes syncthing#5144) (syncthing#5146) lib/fs: Evaluate root when watching not on fs creation (fixes syncthing#5043) (syncthing#5105)
Purpose
Currently the folder root is evaluated (to resolve symlinks) at fs creation. At that point the directory may not exist or
EvalSymlinksmay fail for other reasons. The current implementation just ignores that case by assuming there are no symlinks. That's dangerous because if there are, it will lead to panics on watching. Also the only place where this evaluated root is needed is for watching. Therefore the evaluation of the root path now happens whenfs.Watchis called. This call will then just fail iffilepath.EvalSymlinksreturns an error, making it transparent to the user, leading to retries and preventing the panic.Testing
Existing ones still pass.