netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Made FileUtil to copy POSIX permissions

Open lkishalmi opened this issue 3 years ago • 2 comments

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.

lkishalmi avatar Sep 19 '22 06:09 lkishalmi

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.

sdedic avatar Sep 19 '22 10:09 sdedic

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!

lkishalmi avatar Sep 19 '22 14:09 lkishalmi

@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?

neilcsmith-net avatar Oct 18 '22 09:10 neilcsmith-net

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.

lkishalmi avatar Oct 18 '22 16:10 lkishalmi

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

neilcsmith-net avatar Jan 05 '23 11:01 neilcsmith-net

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.

lkishalmi avatar Jan 13 '23 03:01 lkishalmi

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

lkishalmi avatar Jan 13 '23 05:01 lkishalmi

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

lkishalmi avatar Jan 13 '23 05:01 lkishalmi