paulk-asert opened a new pull request, #2862: URL: https://github.com/apache/groovy/pull/2862
…ce edit An in-place edit does not modify the file, it replaces it: the original is moved aside, either to a named backup or to a scratch sibling, and a new file is created at the same path. That new file took the ambient umask, so a file the user had restricted came back widened - 0600 content readable by the group and the world after a rewrite that was only meant to change its text. sed and perl preserve the mode for this reason. The permissions are now read before the original is moved and applied to its replacement. They are applied at creation rather than afterwards, so the rewritten contents are never briefly readable by anyone the original excluded. Preserving means preserving in both directions: an executable stays executable, not merely a private file staying private. Where the file system does not record POSIX permissions there is nothing to carry over and the writer creates the file as before. Ownership is untouched. A process cannot in general give a file away, and the in-place edit already runs as the user who owns what it rewrites. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
