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

Cannot save remote files that I do not own. #11

Closed
sellmerfud opened this issue Feb 27, 2013 · 2 comments
Closed

Cannot save remote files that I do not own. #11

sellmerfud opened this issue Feb 27, 2013 · 2 comments

Comments

@sellmerfud
Copy link
Contributor

When I edit a file that I do not own on the remote system, but I do have write permission (group or world), the save operation cannot complete.

This is due to to the rmate script creating a temporary file and then trying to chown the file with the user:group of the original file. Since I do not own the file, this fails and the write operation aborts.

@sorbits
Copy link
Member

sorbits commented Feb 27, 2013

We don’t write directly to the original file since we want to do an atomic update, especially considering we get the file data over the network (which isn’t 100% reliable).

Suggestions (or patches) for how to improve the code though are more than welcome.

On Feb 27, 2013, at 10:01 PM, Curt Sellmer notifications@github.com wrote:

When I edit a file that I do not own on the remote system, but I do have write permission (group or world), the save operation cannot complete.

This is due to to the rmate script creating a temporary file and then trying to chown the file with the user:group of the original file. Since I do not own the file, this fails and the write operation aborts.


Reply to this email directly or view it on GitHub.

@sellmerfud
Copy link
Contributor Author

Not a big deal, now that I know the limitation. There's no indication that it fails so it took a bit of time to discover it.

The only alternative that I can think of is rather than hard link the file then copy the temp file over the original, you could make a copy of the original, then write directly over the original. Then if there were no errors, delete the backup copy. This would be slower for large files, but it would preserve the files attributes. Of course the ownership of the backup copy would be set to your user and default group.

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