PathUtils.setReadOnly(Path, boolean, LinkOption...) should add READ_*
file attributes when using POSIX.
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -101,6 +101,9 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="IO-638" dev="ggregory" type="fix" due-to="Thayne McCombs, Gary Gregory">
Infinite loop in CharSequenceInputStream.read for 4-byte characters with UTF-8 and 3-byte buffer.
</action>
+ <action issue="IO-638" dev="ggregory" type="fix" due-to="Gary Gregory">
+ PathUtils.setReadOnly(Path, boolean, LinkOption...) should add READ_* file attributes when using POSIX.
+ </action>
<!-- ADD -->
<action dev="ggregory" type="add" due-to="Gary Gregory">
Add BrokenReader.INSTANCE.

MODIFY
src/main/java/org/apache/commons/io/file/PathUtils.java
src/main/java/org/apache/commons/io/file/PathUtils.java
@@ -1169,6 +1169,9 @@ public static Path setReadOnly(final Path path, final boolean readOnly, final Li
// java.lang.IllegalArgumentException: 'unix:readonly' not recognized
final PosixFileAttributes readAttributes = posixFileAttributeView.readAttributes();
final Set<PosixFilePermission> permissions = readAttributes.permissions();
+ permissions.add(PosixFilePermission.OWNER_READ);
+ permissions.add(PosixFilePermission.GROUP_READ);
+ permissions.add(PosixFilePermission.OTHERS_READ);
permissions.remove(PosixFilePermission.OWNER_WRITE);
permissions.remove(PosixFilePermission.GROUP_WRITE);
permissions.remove(PosixFilePermission.OTHERS_WRITE);

PathUtils.setReadOnly(Path, boolean, LinkOption...) should add READ_*
file attributes when using POSIX.