[ 
https://issues.apache.org/jira/browse/GROOVY-12337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18110678#comment-18110678
 ] 

ASF GitHub Bot commented on GROOVY-12337:
-----------------------------------------

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.




> limit umask when using groovy -i
> --------------------------------
>
>                 Key: GROOVY-12337
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12337
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to