You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sync from Linux to Mac with ownership - Local additions after rescan #9039
bugA problem with current functionality, as opposed to missing functionality (enhancement)frozen-due-to-ageIssues closed and untouched for a long time, together with being locked for discussionneeds-triageNew issues needed to be validated
Syncthing v1.23.6 on Mac (Monterey 12.6.2 and Big Sur 11.7.9) and Linux (Debian GNU/Linux 12 (bookworm))
We have a syncthing folder setup as a “send only” folder on a linux system and sync that with a “receive only” folder on a couple of Macs.
Syncthing on the Macs is started by a user with elevated priviledges.
The synced folder on the Macs is located under /Users/Shared/foldername.
The “sync ownership” option is enabled. Both systems are members of a domain.
The sync completes and all looks good, there are no errors or warnings in the log. Ownership and permissions of user and group get synced totally fine.
But after a rescan ALL Files are marked as local additions. If i disable “sync ownership” all works as expected and we do not have that problem.
Tested that with a new testfolder with only a few files in it and was able to replicate the behaviour.
I excluded the mac-folder from spotilight search and experimented with some settings like setting “modTimeWindowS” but that did not solve it.
I dont see a change in the files, there are no extended attributes set and the timestamp of the files does not change after the sync.
This one clearly slipped through the cracks, sorry.
Could you enable debugging (in the UI actions > advanced > GUI > debugging) and then run syncthing cli debug file <folder-id> <rel-file-path> on an affected file both on the mac and linux, and post the output here.
Sounds like a similar problem I encountered. Syncing from Linux to Linux where one PC is send&receive and the other one is receive-only. Both are using the SyncOwnership folder config.
Every time I revert the local changes on the receiving PC nearly all files pop up again as local changes.
Maybe that's because of this logic:
func unixOwnershipEqual(a, b *UnixData) bool {
if a == nil && b == nil {
return true
}
if a == nil || b == nil {
return false
}
return a.UID == b.UID && a.GID == b.GID && a.OwnerName == b.OwnerName && a.GroupName == b.GroupName
}
In my case the receiver hasn't the same users as it is just a server and it would be sufficient for me if it just stores the UID and the GID.
The output of syncthing cli debug file SHARE FILEPATH seems to support this:
Because the ownerName and groupName can't be synchronized the current behavior led to an endless sync loop especially when receive-only is set to send&receive.
Syncthing records both the numerical UID and GID for a file and the corresponding user and group names, when they are known. When applying ownership Syncthing will first attempt to look up a local user or group with the given name, and if that fails it will fall back to the numerical UID and GID.
You can propose another mechanism, but then that's a separate feature issue I think.
Linux: 1.27.9 from syncthing repo
Receive Only, Ignore permissions, Sync Ownership, Sync Extended Attr's
Running as root systemd service with: # /etc/systemd/system/[email protected]/override.conf [Service] AmbientCapabilities=CAP_CHOWN CAP_FOWNER
All the data is synced fine but none of the permissions or ownerships are (not sure if Android uses extended attr's). On the Linux backup, it shows "Local additions" and the "Revert Local Changes" button appears to work but, within a few seconds, goes back to "Local additions".
This patch would resolve this right? but it's still Unverified/not committed? Anything I can do to fix my instances? I found that if I manually use chown/chmod on the Linux backup data, then it becomes synced and number of "Locally Changed Items" decreases. Thx
bugA problem with current functionality, as opposed to missing functionality (enhancement)frozen-due-to-ageIssues closed and untouched for a long time, together with being locked for discussionneeds-triageNew issues needed to be validated
Activity
imsodin commentedon Dec 19, 2023
This one clearly slipped through the cracks, sorry.
Could you enable debugging (in the UI actions > advanced > GUI > debugging) and then run
syncthing cli debug file <folder-id> <rel-file-path>on an affected file both on the mac and linux, and post the output here.sven commentedon Dec 27, 2023
Sounds like a similar problem I encountered. Syncing from Linux to Linux where one PC is
send&receiveand the other one isreceive-only. Both are using theSyncOwnershipfolder config.Every time I revert the local changes on the receiving PC nearly all files pop up again as local changes.
Maybe that's because of this logic:
In my case the receiver hasn't the same users as it is just a server and it would be sufficient for me if it just stores the
UIDand theGID.The output of
syncthing cli debug file SHARE FILEPATHseems to support this:Sender:
Receiver:
Because the
ownerNameandgroupNamecan't be synchronized the current behavior led to an endless sync loop especially whenreceive-onlyis set tosend&receive.A proposed fix would be:
Would this be ok?
calmh commentedon Dec 27, 2023
I think the check should probably be "equal or either side is empty" for the name values...
sven commentedon Dec 27, 2023
Wouldn't that fail if the UID or GID is assigned to a different user/group on the target?
I think there is a use-case for both problems:
So the better solution would be having a switch to sync either the UID or the username between the hosts. But that sounds like a future thing :-)
calmh commentedon Dec 27, 2023
You can propose another mechanism, but then that's a separate feature issue I think.
lib/protocol: handle ownername and groupname emptyness in unixOwnersh…
lib/protocol: handle empty names in unixOwnershipEqual (fixes syncthi…
sven commentedon Dec 28, 2023
@calmh Thanks for your help. I hope I understand your proposal correctly and the PR is done right: #9306
lib/protocol: handle empty names in unixOwnershipEqual (fixes syncthi…
Merge branch 'main' into tokensdb
Merge branch 'main' into cli_completion
Merge branch 'main' into integrationtests
lib/protocol: handle empty names in unixOwnershipEqual (fixes syncthi…
scarlion1 commentedon Jul 6, 2024
Hey I think I'm having similar issues to backup Android
/sdcardto Linux backup drive (ext4).Android: 1.27.6 from F-droid, root enabled/granted
Send Only, Send Ownership, Send Extended Attr's.
Linux: 1.27.9 from syncthing repo
Receive Only, Ignore permissions, Sync Ownership, Sync Extended Attr's
Running as root systemd service with:
# /etc/systemd/system/[email protected]/override.conf[Service]AmbientCapabilities=CAP_CHOWN CAP_FOWNERAll the data is synced fine but none of the permissions or ownerships are (not sure if Android uses extended attr's). On the Linux backup, it shows "Local additions" and the "Revert Local Changes" button appears to work but, within a few seconds, goes back to "Local additions".
This patch would resolve this right? but it's still Unverified/not committed? Anything I can do to fix my instances? I found that if I manually use chown/chmod on the Linux backup data, then it becomes synced and number of "Locally Changed Items" decreases. Thx