You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/09/19 06:15:55 UTC

[GitHub] [netbeans] lkishalmi opened a new pull request, #4654: Made FileUtil to copy POSIX permissions

lkishalmi opened a new pull request, #4654:
URL: https://github.com/apache/netbeans/pull/4654

   Well as a DevOps engineer, I copy scripts and other executable inside the IDE. They lose the executable flag. That bothers me for years. Here is how I try to fix that.
   
   Also added `FileObject` `Path` conversion methods, to make the life easier.
   


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lkishalmi commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1282653670

   I hope I can make those minimal changes needed. The day is just started for me. If I can't make that happen, you are right, I'll move this to NB17.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lkishalmi merged pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
lkishalmi merged PR #4654:
URL: https://github.com/apache/netbeans/pull/4654


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic commented on a diff in pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#discussion_r976187007


##########
platform/openide.filesystems/test/unit/src/org/openide/filesystems/FileUtilTest.java:
##########
@@ -704,6 +709,24 @@ public void close() throws SecurityException {
         assertTrue(result.toExternalForm().endsWith("/"));  //NOI18N
     }
 
+    public void testCopyPosixPerms() throws Exception {
+        if (Utilities.isWindows()) return;

Review Comment:
   can use `assumeFalse()`, the test will appear as 'skipped' in results.



##########
platform/openide.filesystems/apichanges.xml:
##########
@@ -25,6 +25,30 @@
         <apidef name="filesystems">Filesystems API</apidef>
     </apidefs>
     <changes>
+        <change id="fileutil.copyposixperms">
+            <api name="filesystems"/>
+            <summary>FileObject copy preserves source posix permissions.</summary>
+            <version major="9" minor="30"/>

Review Comment:
   Bump version in `manifest.mf` too 



##########
platform/openide.filesystems/apichanges.xml:
##########
@@ -25,6 +25,30 @@
         <apidef name="filesystems">Filesystems API</apidef>
     </apidefs>
     <changes>
+        <change id="fileutil.copyposixperms">
+            <api name="filesystems"/>
+            <summary>FileObject copy preserves source posix permissions.</summary>
+            <version major="9" minor="30"/>
+            <date day="18" month="9" year="2022"/>
+            <author login="lkishalmi"/>
+            <compatibility addition="yes" semantic="compatible"/>
+            <description>
+                <a href="@TOP@/org/openide/filesystems/FileUtil.html#">FileUtil.copy</a> now preserves POSIX permissions if possible during file copy.

Review Comment:
   missing anchor to the FileUtil.copy chapter ?



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lkishalmi commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1381349249

   Unfortunately `Files.copy` made other tests fail in masterfs and filesystems module. I'll revert to the previous implementation.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic commented on a diff in pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#discussion_r1069638636


##########
platform/openide.filesystems/apichanges.xml:
##########
@@ -25,6 +25,30 @@
         <apidef name="filesystems">Filesystems API</apidef>
     </apidefs>
     <changes>
+        <change id="fileutil.copyposixperms">
+            <api name="filesystems"/>
+            <summary>FileObject copy preserves source posix permissions.</summary>
+            <version major="9" minor="31"/>
+            <date day="12" month="1" year="2023"/>
+            <author login="lkishalmi"/>
+            <compatibility addition="yes" semantic="compatible"/>
+            <description>
+                <a href="@TOP@/org/openide/filesystems/FileUtil.html#copyFile-org.openide.filesystems.FileObject-org.openide.filesystems.FileObject-java.lang.String-java.lang.String-">FileUtil.copyFile(...)</a> now preserve ATTRIBUTES and POSIX permissions.
+            </description>
+            <class name="FileUtil" package="org.openide.filesystems"/>
+        </change>
+        <change id="fileutil.niofilepath">
+            <api name="filesystems"/>
+            <summary>FileUtil can convert FileObject to/from java.nio.file.Path.</summary>
+            <version major="9" minor="30"/>

Review Comment:
   9.32 (master has currently 9.31). We should probably bump version for each api change to allow proper autoupdates from the daily builds for those bleeding-edge testers.



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1282127840

   @lkishalmi still a few things to address here.  I also agree with @mbien and @jtulach about 1:1 mapping behaviour with Path and Files::copy COPY_ATTRIBUTES.  Not sure whether at least minimal things can be addressed and merged for NB16 or we should push all changes to NB17?


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] mbien commented on a diff in pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#discussion_r977201017


##########
platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java:
##########
@@ -567,6 +569,7 @@ static FileObject copyFileImpl(FileObject source, FileObject destFolder, String
             }
 
             copy(bufIn, bufOut);
+            copyPosixPerms(source, dest);
             copyAttributes(source, dest);

Review Comment:
   just a thought:
   Files.copy(...) would copy posix permissions too (there is also a COPY_ATTRIBUTES option). Alternative impl would check if its an actual file first, if it is, it would use Files.copy() with paths, otherwise use streams.
   
   Maybe its worth thinking about refreshing this code if it isn't too much work? Otherwise we end up reimplementing everything what Files.copy already does.



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
sdedic commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1250821125

   Two questions:
   - given that FileUtil.copy did not copy the attributes or is not specified as 'copied by stream content' ... isn't that an incompatible API change ?
   - what about the `AclFileAttributesView` - this is useful on Windows. Except for file owner, ACLs may be (usually) set by a regular user.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lkishalmi commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1251141775

   Well that API is ancient, from those times, when the Executable permissions could not be set by Java (pre-Java 6) without some magic.
   
   As a DevOps Engineer, I'm working with a lot of scripts recently, so I thought I fix my issue when copy them in the IDE. That's all. I do not know how important Windows ACL for other people, well if that's really missed, contributions are welcome!


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lkishalmi commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1381281078

   > I always dreamed about 1:1 mapping between Path and FileObject. They could delegate to each other. Always. E.g. the new methods shall never return null.
   
   Well, this PR won't make that dream true. Probably one day when someone would have a lot of time. AFAIK we need to provide a few FileSystem implementation to be able to use `Path` in all cases which are covered by `FileObject`.
   
   As of returning `null` is in sync with the current implementation. Returning `Optional` would be an outlier in the API. 


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic commented on a diff in pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#discussion_r1069638636


##########
platform/openide.filesystems/apichanges.xml:
##########
@@ -25,6 +25,30 @@
         <apidef name="filesystems">Filesystems API</apidef>
     </apidefs>
     <changes>
+        <change id="fileutil.copyposixperms">
+            <api name="filesystems"/>
+            <summary>FileObject copy preserves source posix permissions.</summary>
+            <version major="9" minor="31"/>
+            <date day="12" month="1" year="2023"/>
+            <author login="lkishalmi"/>
+            <compatibility addition="yes" semantic="compatible"/>
+            <description>
+                <a href="@TOP@/org/openide/filesystems/FileUtil.html#copyFile-org.openide.filesystems.FileObject-org.openide.filesystems.FileObject-java.lang.String-java.lang.String-">FileUtil.copyFile(...)</a> now preserve ATTRIBUTES and POSIX permissions.
+            </description>
+            <class name="FileUtil" package="org.openide.filesystems"/>
+        </change>
+        <change id="fileutil.niofilepath">
+            <api name="filesystems"/>
+            <summary>FileUtil can convert FileObject to/from java.nio.file.Path.</summary>
+            <version major="9" minor="30"/>

Review Comment:
   9.32 (master has currently 9.31)



##########
platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java:
##########
@@ -567,6 +569,7 @@ static FileObject copyFileImpl(FileObject source, FileObject destFolder, String
             }
 
             copy(bufIn, bufOut);
+            copyPosixPerms(source, dest);

Review Comment:
   Please make a mote in method's Javadoc about behaviour enhancement since 9.31(2), people can stop writing attribute preserving code, if they read javadoc :)



##########
platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java:
##########
@@ -832,10 +846,22 @@ public static File toFile(FileObject fo) {
         assert assertNormalized(retVal, BaseUtilities.isMac()); // #240180
         return retVal;
     }
+    
+    /** Finds appropriate java.nio.file.Path to FileObject if possible.
+     * If not possible then null is returned.
+     * This is the inverse operation of {@link #toFileObject}.
+     * @param fo FileObject whose corresponding Path will be looked for
+     * @return java.nio.file.Path or null if no corresponding File exists.
+     * @since 9.30

Review Comment:
   9.31 if apichanges is corrected.



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1372079926

   @lkishalmi any thoughts on progressing this one?  It's getting close to missing the NB17 cut too.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lkishalmi commented on pull request #4654: Made FileUtil to copy POSIX permissions

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4654:
URL: https://github.com/apache/netbeans/pull/4654#issuecomment-1381349643

   BTW. This PR marks all checks passed as it was missing the `Platform` label.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists