You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "hannibal218bc (via GitHub)" <gi...@apache.org> on 2023/05/16 12:28:15 UTC

[GitHub] [mina-sshd] hannibal218bc opened a new pull request, #372: READ (only) default mode in SftpFileSystemProvider.newFileChannel()

hannibal218bc opened a new pull request, #372:
URL: https://github.com/apache/mina-sshd/pull/372

   According to [upstream javadoc](https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html#open-java.nio.file.Path-java.util.Set-java.nio.file.attribute.FileAttribute...-), the default mode is READ (only) when there is no mode specified:
   
   > The [READ](https://docs.oracle.com/javase/8/docs/api/java/nio/file/StandardOpenOption.html#READ) and [WRITE](https://docs.oracle.com/javase/8/docs/api/java/nio/file/StandardOpenOption.html#WRITE) options determine if the file should be opened for reading and/or writing. If neither option (or the [APPEND](https://docs.oracle.com/javase/8/docs/api/java/nio/file/StandardOpenOption.html#APPEND) option) is contained in the array then the file is opened for reading
   
   SftpFileSystemProvider used `READ, WRITE` which leads to `Permission denied` errors when trying to access read-only files (see [this Stackoverflow thread](https://stackoverflow.com/questions/49235417/sshd-get-content-of-readonly-file)).
   
   This MR suggests to use a standard-complaint setting; however, this might cause regressions...


-- 
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: dev-unsubscribe@mina.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org


[GitHub] [mina-sshd] tomaswolf commented on pull request #372: READ (only) default mode in SftpFileSystemProvider.newFileChannel()

Posted by "tomaswolf (via GitHub)" <gi...@apache.org>.
tomaswolf commented on PR #372:
URL: https://github.com/apache/mina-sshd/pull/372#issuecomment-1567020018

   Created bug #383 for this.


-- 
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: dev-unsubscribe@mina.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org


[GitHub] [mina-sshd] tomaswolf commented on pull request #372: READ (only) default mode in SftpFileSystemProvider.newFileChannel()

Posted by "tomaswolf (via GitHub)" <gi...@apache.org>.
tomaswolf commented on PR #372:
URL: https://github.com/apache/mina-sshd/pull/372#issuecomment-1565697931

   Thanks for this fix. Unfortunately tests are failing.
   
   A quick fix might be to open the channel for writing in that failing test method.
   
   But it seems that the locking implementation doesn't map exceptions correctly when channels are opened for reading only (server just returns a "General Failure"); surely that could be improved. And moreover, the javadoc on `FileChannel.lock()` says a `NonWritableChannelException` should be thrown if the channel wasn't writeable. It should be possible to check that on the client side before even making any remote call.
   
   We have no tests for other combinations (read lock on a write-only channel).


-- 
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: dev-unsubscribe@mina.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org


[GitHub] [mina-sshd] tomaswolf merged pull request #372: READ (only) default mode in SftpFileSystemProvider.newFileChannel()

Posted by "tomaswolf (via GitHub)" <gi...@apache.org>.
tomaswolf merged PR #372:
URL: https://github.com/apache/mina-sshd/pull/372


-- 
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: dev-unsubscribe@mina.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org