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

Support syncing file permissions and ownership #39

Open
masiqbal opened this issue Jul 26, 2019 · 5 comments
Open

Support syncing file permissions and ownership #39

masiqbal opened this issue Jul 26, 2019 · 5 comments

Comments

@masiqbal
Copy link

Hello,

Thank you for this great software. I just installed and run it easily.

The bidirectional synchronization works great, except it can not sync file permission and ownership. Am I missed something or it is not supported?

Warms Regards

@stephenh
Copy link
Owner

Hi, yeah, that is generally/intentionally not supported. My rationale was that:

  1. unix permissions are usually id-based, and its unlikely ids match across machines (granted, I could resolve the id to a user/group name, and then lookup that user/group name on the other side)

  2. the client/server may be different platforms

  3. I typically run mirror as a user-level program anyway (i.e. not a daemon), with the right user I want to own the permissions anyway (i.e. my personal user on the client, and my personal user on the server), which makes the default file permissions work out.

@masiqbal
Copy link
Author

Yeah, that makes perfect sense. But if there are options to sync permission and ownership, it would be great. :-)

@stephenh stephenh changed the title Can not Sync File Permission and Ownership Support syncing file permissions and ownership Aug 4, 2019
@Bessonov
Copy link

Bessonov commented Jan 4, 2020

From my point of view, syncing of user/groups isn't necessary in most cases. But syncing of permissions is a must.

the client/server may be different platforms

True, but MacOS and Linux behaves in similar (or I'm not aware of differences) and windows isn't supported. How do git do that? But maybe (not windows user here) wsl makes it possible right now.

with the right user I want to own the permissions anyway

Please don't interchange permissions with ownership. They are different and has different requirements. chown changes ownership and chmod changes permissions. My use case is to syncing permissions.

granted, I could resolve the id to a user/group name, and then lookup that user/group name on the other side

If this have an use case, then I would propose to introduce a mapping on uid/gid level, like --map-uid=1000:1001 where the first is local user id and the second is remote user id and error for unmapped id's. Same approach for groups.

@stephenh
Copy link
Owner

stephenh commented Jan 6, 2020

windows isn't supported

Yeah, although in theory mirror is fairly platform independent at this point (granted, watchman is beta on windows), so in general I have historically defaulted to less-platform-specific features...

I.e. something like this will be more POSIX-specific API calls instead of just normal java.io.File things that are (generally) auto-supported across all platforms.

My use case is to syncing permissions.

Yeah, makes sense...I wouldn't be against adding a chmod string to each file, that only POSIX platforms would use.

@nickodell
Copy link

True, but MacOS and Linux behaves in similar (or I'm not aware of differences) and windows isn't supported. How do git do that? But maybe (not windows user here) wsl makes it possible right now.

Git can sync whether or not a file is marked as executable. If you write a shell script, mark it as executable, and commit it, anyone who clones the repository will also get a script marked as executable. In POSIX terms, Git supports mode 644 and mode 755, and nothing else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants