- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 83
 
Open
Description
os.write(
  os.pwd / "folder/out.txt",
  "asdf",
  perms = os.PermSet.fromString("rw-r--r--"),
  createFolders = true
)would result in
java.nio.file.AccessDeniedException: .../folder/out.txt
  sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
  sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
  sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
  sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
  java.nio.file.Files.newByteChannel(Files.java:380)
  os.write$.write(ReadWriteOps.scala:65)
  os.write$.apply(ReadWriteOps.scala:78)
  ammonite.$sess.cmd9$.<clinit>(cmd9.sc:1)
because perms is also applied to os.makeDir.all
os-lib/os/src/ReadWriteOps.scala
Line 79 in 60d334d
| if (createFolders) makeDir.all(target / RelPath.up, perms) | 
and directories require executable permission to be accessible. Thus writing to a non-executable file with
createFolders = true like in the example doesn't work.
This affects write.outputStream, write.append, write.append.outputStream, write.over, write.over.outputStream as well.
perms should be omitted from os.makeDir.all.
Metadata
Metadata
Assignees
Labels
No labels