You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Boris Unckel (Jira)" <ji...@apache.org> on 2021/01/15 07:00:00 UTC

[jira] [Commented] (IO-701) PathUtils.setReadOnly do not deal with LinuxDosFileAttributeView

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

Boris Unckel commented on IO-701:
---------------------------------

Integration test works. Thank you.

> PathUtils.setReadOnly do not deal with LinuxDosFileAttributeView
> ----------------------------------------------------------------
>
>                 Key: IO-701
>                 URL: https://issues.apache.org/jira/browse/IO-701
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.8.0
>         Environment: java --version
> openjdk 11.0.9.1 2020-11-04
> OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
> OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)
> cat /etc/fedora-release 
> Fedora release 33 (Thirty Three)
> uname -a
> Linux localhost.localdomain 5.9.16-200.fc33.x86_64 #1 SMP Mon Dec 21 14:08:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
> # /etc/fstab
> # Created by anaconda on Sat Aug 29 05:35:21 2020
> #
> # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
> # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
> #
> # After editing this file, run 'systemctl daemon-reload' to update systemd
> # units generated from this file.
> #
> /dev/mapper/fedora_localhost--live-root /                       ext4    defaults        1 1
> UUID=fd3a2229-bdf5-4fe5-b596-141b9d6c609f /boot                   ext4    defaults        1 2
> UUID=0C7E-FC8E          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
> /dev/mapper/fedora_localhost--live-home /home                   ext4    defaults        1 2
> /dev/mapper/fedora_localhost--live-swap none                    swap    defaults        0 0
>            Reporter: Boris Unckel
>            Priority: Critical
>             Fix For: 2.9.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> PathUtils.setReadOnly use a DosFileAttributeView first. If this fails with a Exception, a second try with PosixFileAttributeView will not be done.
> The approach is to catch a IOException (java.nio.file.FileSystemException Operation not supported), add it to a exception list. Throw the exception list if not empty.
> Please check the environment of this bug: integration tests are all run on Ubuntu. This occured on Fedora. (Maybe the difference is ext4 ?)
> Example stacktrace (Message is "Operation not supported")
> {code:java}
> java.nio.file.FileSystemException: /tmp/junit4674316189874192997/file1-test.txt: Die Operation wird nicht unterstützt
> 	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
> 	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
> 	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
> 	at java.base/sun.nio.fs.LinuxDosFileAttributeView.updateDosAttribute(LinuxDosFileAttributeView.java:278)
> 	at java.base/sun.nio.fs.LinuxDosFileAttributeView.setReadOnly(LinuxDosFileAttributeView.java:191)
> 	at org.apache.commons.io.file.PathUtils.setReadOnly(PathUtils.java:876)
> 	at org.apache.commons.io.file.PathUtils.deleteFile(PathUtils.java:486)
> 	at org.apache.commons.io.file.PathUtils.delete(PathUtils.java:393)
> 	at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1337)
> 	at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:303)
> 	at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1189)
> 	at org.apache.commons.io.FileUtilsTestCase.setUp(FileUtilsTestCase.java:299)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)