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

Syncing file permissions #189

Closed
danielsz opened this issue Apr 17, 2015 · 2 comments
Closed

Syncing file permissions #189

danielsz opened this issue Apr 17, 2015 · 2 comments

Comments

@danielsz
Copy link
Contributor

Changing file permissions on files in the fileset don't carry through and "get lost" when those files are written to the file system.

Thoughts for a solution:

When doing a commit!, files in the fileset are copied with their attributes.
From an initial source reading, this should happen around here.

The JVM API to look for could be Files.copy(Path, Path, CopyOptions) where CopyOptions has COPY_ATTRIBUTES.

The exact file attributes supported are file system and platform dependent, but last-modified-time is supported across platforms and is copied to the target file.

Source: https://docs.oracle.com/javase/tutorial/essential/io/copy.html

@micha
Copy link
Contributor

micha commented May 20, 2015

This is actually kind of complicated to implement and has other implications because of the way the fileset works internally. The main problem is that the files underneath the immutable fileset object are themselves immutable and interned, in a way.

When you add files to the fileset the file is copied into a special temp directory, named for the md5 hash of its contents, and write permission removed. This makes the canonical representation of this file immutable. Then, when commit! is called on the fileset object, hard links are created from other directories in the working tree to these immutable files.

The problem is that links cannot have different permissions from the things they point to, which means that the canonical representation for a file must now include the permissions as well as the contents. This adds a good deal of complexity in a place where things are already kind of weird.

If anyone has ideas for a clean way to implement this please feel free to reopen this ticket or make a pull request etc.

@micha micha closed this as completed May 20, 2015
@danielsz
Copy link
Contributor Author

Thank you for the thorough explanation. This is very helpful.

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

2 participants