Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: Support syncing ownership (fixes #1329) #8434

Merged
merged 17 commits into from Jul 26, 2022
Merged

Conversation

calmh
Copy link
Member

@calmh calmh commented Jul 14, 2022

This adds support for syncing ownership on Unixes and on Windows. The scanner always picks up ownership information, but it is not applied unless the new folder option "Sync Ownership" is set.

Ownership data is stored in a new FileInfo field called "Platform". This is intended to hold further OS specific data in the future (specifically, extended attributes).

Also refactors the FileInfo comparison which started to grow a lot of inscrutable boolean arguments, now instead taking a struct with the comparison parameters. (Perhaps the comparison function should be a method on the comparison struct?)

(This is an alternative implementation to #8415, eschewing maps...)

calmh added 11 commits July 5, 2022 10:01
This adds support for syncing ownership on Unixes and on Windows. The
scanner always picks up ownership information, but it is not applied
unless the new folder option "Sync Ownership" is set.

Ownership data is stored in a new FileInfo field called "OS data". This
is intended to hold further OS specific data in the future
(specifically, extended attributes), which is why the whole design is a
bit overkill for just ownership.
* main:
  gui, man, authors: Update docs, translations, and contributors
  cmd/syncthing/cli: Add show discovery command (fixes syncthing#8007) (syncthing#8378)
  gui, man, authors: Update docs, translations, and contributors
  lib/osutil: Only announce address of interfaces which are up (fixes syncthing#7458) (syncthing#8422)
  gui: Fix missing span end tag and missing nbsp semicolon in HTML (syncthing#8419)
Comment on lines +151 to +154
message PlatformData {
UnixData unix = 1 [(gogoproto.nullable) = true];
WindowsData windows = 2 [(gogoproto.nullable) = true];
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will grow with more entries soon, to enable xattr support.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be called ownership then/oppose to unix/windows?
Or is that going to go under *Data?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning to stuff windows xattrs in windows platform data, and invent new linux/freebsd/macOS/etc platform data fields for xattrs for those platforms. The reason being that even if the apis are similar the xattrs for one don't apply to the other. (And also add a non-wire-sent inode modtime field to detect changes.)

@calmh calmh changed the title all: Support syncing ownership (fixes #xxx) (alternative implementation) all: Support syncing ownership (fixes #1329) Jul 21, 2022
@calmh
Copy link
Member Author

calmh commented Jul 21, 2022

Deepsource seems confused about which "problems" are added in this PR, and anyway somewhat annoying...

@AudriusButkevicius
Copy link
Member

I'm out till Monday/Tuesday, but hopefully not forget to have a look once I am back.

Copy link
Member

@AudriusButkevicius AudriusButkevicius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly lgtm

Comment on lines +151 to +154
message PlatformData {
UnixData unix = 1 [(gogoproto.nullable) = true];
WindowsData windows = 2 [(gogoproto.nullable) = true];
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be called ownership then/oppose to unix/windows?
Or is that going to go under *Data?

//go:build !windows
// +build !windows

package model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to have folder_<foldertype>_<thing>_<os>.go ?
Seems like folder_<foldertype>_<os>.go would already result in quite a big matrix.

@calmh calmh merged commit adce6fa into syncthing:main Jul 26, 2022
@calmh calmh deleted the owners2 branch July 26, 2022 06:25
calmh added a commit to calmh/syncthing that referenced this pull request Jul 26, 2022
* main:
  all: Support syncing ownership (fixes syncthing#1329) (syncthing#8434)
  gui, man, authors: Update docs, translations, and contributors
@calmh calmh added this to the v1.21.0 milestone Jul 26, 2022
calmh added a commit to calmh/syncthing that referenced this pull request Jul 28, 2022
* main:
  cmd/syncthing, lib/config: Remove restartOnWakeup option & functionality (fixes syncthing#8448) (syncthing#8449)
  gui: Remove blank meta tags (syncthing#8362)
  gui: Add device sync status (fixes syncthing#7981) (syncthing#8401)
  gui: Fix detailed staggered versioning information in folder info (ref syncthing#8348) (syncthing#8433)
  all: Support syncing ownership (fixes syncthing#1329) (syncthing#8434)
  gui, man, authors: Update docs, translations, and contributors
  lib/model, lib/config: Apply sensible defaults for auto-accepted encrypted folder (fixes syncthing#8296) (syncthing#8427)
  gui: Move filesystem watcher explanation from tooltip to help block (syncthing#8432)
  gui: Use discovered IDs from cache when adding a new remote device (syncthing#8382)
  build: Update goleveldb (syncthing#8440)
  gui, man, authors: Update docs, translations, and contributors
  cmd/syncthing/cli: Add show discovery command (fixes syncthing#8007) (syncthing#8378)
  gui, man, authors: Update docs, translations, and contributors
  lib/osutil: Only announce address of interfaces which are up (fixes syncthing#7458) (syncthing#8422)
  gui: Fix missing span end tag and missing nbsp semicolon in HTML (syncthing#8419)
Martchus pushed a commit to Martchus/syncthing that referenced this pull request Aug 4, 2022
This adds support for syncing ownership on Unixes and on Windows. The
scanner always picks up ownership information, but it is not applied
unless the new folder option "Sync Ownership" is set.

Ownership data is stored in a new FileInfo field called "platform data". This
is intended to hold further platform-specific data in the future
(specifically, extended attributes), which is why the whole design is a
bit overkill for just ownership.
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jul 26, 2023
@syncthing syncthing locked and limited conversation to collaborators Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants