Repository navigation
Description
We detect directories with a path component length of 200 as a "virtual" parent of the actual encrypted file that has a longer name (and was thus split into multiple path components). There's no way to distinguish if a certain directory of that length (200 + 3 leading chars) is a "real" directory or just the parent of the real file with a longer path.
A possible fix is to prefix "virtual" parents with e.g. p- and detect them by that. This will introduce spurious locally changed items on all existing receive-encrypted users with any items with a path >203. Given we consider this feature in beta, that might be acceptable. Other ideas?
I originally believed the opposite was true, i.e. we do not detect virtual parent directories at all.
Detected in the log posted here: https://forum.syncthing.net/t/unexpected-items-on-remote-untrusted-rpi3/17221/39
[YZZY6] 2021/09/28 20:36:36.782699 set.go:254: DEBUG: xxxxx-nnqhx Get(9.syncthing-enc/2M/VA0TOP630CP52N0AOJQKJSNUERPCKH0U7MU6MDVOSEMS3D9SSSAPFJT70NAI43E
6R0G07DQ6FEOFU3DTEHRUTP8JJC4N2OVQF1K0RGIVOE4NNQQ9H6DC9E5R68FTEATO9HA13QVN0A0VR2D7BCJ6KNLBG37G6F684Q41SA8PSAHNO3F5EFS337FN1NB9686S6V0S17RT)
[YZZY6] 2021/09/28 20:36:36.783196 walk.go:438: DEBUG: walker/xxxxx-nnqhx@0x2cdc660 dir: 9.syncthing-enc/2M/VA0TOP630CP52N0AOJQKJSNUERPCKH0U7MU6MDVOSEMS
3D9SSSAPFJT70NAI43E6R0G07DQ6FEOFU3DTEHRUTP8JJC4N2OVQF1K0RGIVOE4NNQQ9H6DC9E5R68FTEATO9HA13QVN0A0VR2D7BCJ6KNLBG37G6F684Q41SA8PSAHNO3F5EFS337FN1NB9686S6V0S
17RT Directory{Name:"9.syncthing-enc/2M/VA0TOP630CP52N0AOJQKJSNUERPCKH0U7MU6MDVOSEMS3D9SSSAPFJT70NAI43E6R0G07DQ6FEOFU3DTEHRUTP8JJC4N2OVQF1K0RGIVOE4NNQQ9
H6DC9E5R68FTEATO9HA13QVN0A0VR2D7BCJ6KNLBG37G6F684Q41SA8PSAHNO3F5EFS337FN1NB9686S6V0S17RT", Sequence:0, Permissions:0755, ModTime:2021-09-25 07:43:35.173
070932 +1000 AEST, Version:{[{YZZY6NC 1632825396}]}, VersionHash:, Deleted:false, Invalid:false, LocalFlags:0x8, NoPermissions:true}
[YZZY6] 2021/09/28 20:36:36.783771 set.go:254: DEBUG: xxxxx-nnqhx Get(9.syncthing-enc/2M/VA0TOP630CP52N0AOJQKJSNUERPCKH0U7MU6MDVOSEMS3D9SSSAPFJT70NAI43E6R0G07DQ6FEOFU3DTEHRUTP8JJC4N2OVQF1K0RGIVOE4NNQQ9H6DC9E5R68FTEATO9HA13QVN0A0VR2D7BCJ6KNLBG37G6F684Q41SA8PSAHNO3F5EFS337FN1NB9686S6V0S17RT/RQ6254UP0)
[YZZY6] 2021/09/28 20:36:36.784260 walk.go:391: DEBUG: walker/xxxxx-nnqhx@0x2cdc660 unchanged: File{Name:"9.syncthing-enc/2M/VA0TOP630CP52N0AOJQKJSNUERPCKH0U7MU6MDVOSEMS3D9SSSAPFJT70NAI43E6R0G07DQ6FEOFU3DTEHRUTP8JJC4N2OVQF1K0RGIVOE4NNQQ9H6DC9E5R68FTEATO9HA13QVN0A0VR2D7BCJ6KNLBG37G6F684Q41SA8PSAHNO3F5EFS337FN1NB9686S6V0S17RT/RQ6254UP0", Sequence:416, Permissions:0644, ModTime:2009-02-14 10:31:30 +1100 AEDT, Version:{[{AAAAAAA 1620954337}]}, VersionHash:, Length:59483, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:false, BlockSize:131112, Blocks:[Block{0/58821/0/e90e40d0d1be7243a14373d39a3d8b4a46b585ac099095e6484420328fc06875cf4247f4d6a44beb1fdbd62b65472633}], BlocksHash:367fcec076ce3c13ac38a6771f26467ba04792892288f0ef4a38f19b9f70dfb7} 1234567890 -rw-r--r--
If we slashify the encrypted filename due to it's length, we introduce a "virtual" directory. We already do that for two top-level directories, which get detected by protocol.IsEncryptedParent. These "non-toplevel virtual directories" are not detected. And I don't see a sensible way to detect them without introducing breaking changes: A directory with the max. length is not necessarily a virtual directory, it might also be a legitimate encrypted directory that just happens to have exactly that length. And looking up if the dir has any children every time seems ugly/wasteful. A possible solution is to prefix such directories with p-. This will of course add to locally changed items on upgrade, but only on items which are already affected by this bug. So I'd say that together with the feature still being labelled as beta makes it an acceptable solution.
Activity
[-]Files with long paths lead to spurious local changes on receive-encrypted[/-][+]Directories with a path length of 203 not handled on receive-encrypted[/+]