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

[GitHub] [mina-sshd] tomaswolf opened a new issue, #384: FileChannel.lock() doesn't work for read-only channels from SftpFileSystemProvider.newFileChannel()

tomaswolf opened a new issue, #384:
URL: https://github.com/apache/mina-sshd/issues/384

   ### Version
   
   master
   
   ### Bug description
   
   The following code fails:
   ```
   SftpFileSystemProvider provider = ...;
   FileChannel channel = provider.newFileChannel(somePath, StandardOpenOptions.READ);
   FileLock lock = channel.lock(from, to, true);
   ```
   This creates a read-only file channel and tries to obtain a shared (read) lock. It fails with an Apache MINA sshd server returning a general failure.
   
   ### Actual behavior
   
   Obtaining the lock throws an exception.
   
   ### Expected behavior
   
   The lock can be obtained (if there are no conflicts).
   
   ### Relevant log output
   
   _No response_
   
   ### Other information
   
   - File locking is available only in SFTP v6. Current code doesn't check for this.
   - The client always sends zero as lock flags; it should send the appropriate read/write lock flags.
   - The server ignores flags passed, and also does not check for the SFTP version.
   - Shared read locks can obtained only if the channel was opened for reading; exclusive write locks only if the channel was opened for writing. The client could check this condition before even making any server call.


-- 
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.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 closed issue #384: FileChannel.lock() doesn't work for read-only channels from SftpFileSystemProvider.newFileChannel()

Posted by "tomaswolf (via GitHub)" <gi...@apache.org>.
tomaswolf closed issue #384: FileChannel.lock() doesn't work for read-only channels from SftpFileSystemProvider.newFileChannel()
URL: https://github.com/apache/mina-sshd/issues/384


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