You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Otto Frost (JIRA)" <ji...@apache.org> on 2011/04/18 18:17:05 UTC
[jira] [Created] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
uploading and then renaming a file doesn't work (on windows)
------------------------------------------------------------
Key: SSHD-118
URL: https://issues.apache.org/jira/browse/SSHD-118
Project: MINA SSHD
Issue Type: Bug
Affects Versions: 0.5.0
Environment: windows xp professional jdk 1.5.0.22, jre 1.6
windows 2003 server SP2 jdk jre 1.5.0.22
Reporter: Otto Frost
Priority: Critical
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet closed SSHD-118.
--------------------------------
Resolution: Duplicate
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Attachments: NativeSshFile.diff
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // e.on modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> boolean bIOExcpetion = false;
> IOException ioException = null;
> if (raf != null) {
> try {
> raf.setLength(0);
> } catch (IOException e) {
> e.printStackTrace();
> ioException = e;
> bIOExcpetion = true;
> } finally {
> if (raf != null)
> raf.close();
> }
> }
> if (bIOExcpetion)
> throw ioException;
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Bobby Powers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021105#comment-13021105 ]
Bobby Powers commented on SSHD-118:
-----------------------------------
This is interesting, I think I've seen the same thing on one of our servers although I haven't had time to track it down. On first look, we seem to be trying to do the right thing, in SSH_FXP_WRITE we wrap the outputstream.write() with try finally that closes the stream. The close method is even overwritten to close the stream as well as the RandomAccessFile the stream is working on.
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
raf.close()
should be changed to
if (raf!=null)
raf.close();
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
Description:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the correction:
class NativeSshFile
public void truncate() throws IOException {
// modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
if (raf != null) {
raf.setLength(0);
raf.close();
}
}
was:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the fix:
class NativeSshFile
public void truncate() throws IOException {
// modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
if (raf != null) {
raf.setLength(0);
raf.close();
}
}
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
Description:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the fix:
class NativeSshFile
public void truncate() throws IOException {
// e.on modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
if (raf != null) {
raf.setLength(0);
raf.close();
}
}
was:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the fix:
class NativeSshFile
public void truncate() throws IOException{
RandomAccessFile raf = new RandomAccessFile(file, "rw");
raf.setLength(0);
raf.close();
}
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the fix:
> class NativeSshFile
> public void truncate() throws IOException {
> // e.on modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021164#comment-13021164 ]
Otto Frost commented on SSHD-118:
---------------------------------
Added fix for the real problem in the description
Tested with cygwin openssh sftp client, works ok.
Tested with ftptosftp bridge in mindterm 3.4 (3.1.2 not working for other reasons)
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021451#comment-13021451 ]
Otto Frost commented on SSHD-118:
---------------------------------
added exception handling
public void truncate() throws IOException {
// e.on modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
if (raf != null) {
try {
raf.setLength(0);
} catch (IOException e) {
e.printStackTrace();
} finally {
raf.close();
}
}
}
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
Attachment: NativeSshFile.diff
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Attachments: NativeSshFile.diff
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // e.on modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> boolean bIOExcpetion = false;
> IOException ioException = null;
> if (raf != null) {
> try {
> raf.setLength(0);
> } catch (IOException e) {
> e.printStackTrace();
> ioException = e;
> bIOExcpetion = true;
> } finally {
> if (raf != null)
> raf.close();
> }
> }
> if (bIOExcpetion)
> throw ioException;
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021155#comment-13021155 ]
Otto Frost commented on SSHD-118:
---------------------------------
if (raf!=null)
raf.close();
I'm rather safe than sorry. Don't know under which conditions, but in my experience it usually dumps if the file failed to open.
Added fix for the real problem in the description
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the fix:
> class NativeSshFile
> public void truncate() throws IOException {
> // e.on modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
Description:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the fix:
class NativeSshFile
public void truncate() throws IOException{
RandomAccessFile raf = new RandomAccessFile(file, "rw");
raf.setLength(0);
raf.close();
}
was:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Remaining Estimate: 1h (was: 2h)
Original Estimate: 1h (was: 2h)
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the fix:
> class NativeSshFile
> public void truncate() throws IOException{
>
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> raf.setLength(0);
> raf.close();
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
Description:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the fix:
class NativeSshFile
public void truncate() throws IOException {
// modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
if (raf != null) {
raf.setLength(0);
raf.close();
}
}
was:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the fix:
class NativeSshFile
public void truncate() throws IOException {
// e.on modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
if (raf != null) {
raf.setLength(0);
raf.close();
}
}
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the fix:
> class NativeSshFile
> public void truncate() throws IOException {
> // modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
Environment:
windows xp professional sun jdk 1.5.0.22, jre 1.6
windows 2003 server SP2 sun jdk jre 1.5.0.22
was:
windows xp professional jdk 1.5.0.22, jre 1.6
windows 2003 server SP2 jdk jre 1.5.0.22
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Bobby Powers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021112#comment-13021112 ]
Bobby Powers commented on SSHD-118:
-----------------------------------
do you mean on line 383 of NativeSshFile? Under what condition could raf be null? Does that fix the issue for you?
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021688#comment-13021688 ]
Otto Frost commented on SSHD-118:
---------------------------------
This is a duplicate of SSHD-97
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025121#comment-13025121 ]
Guillaume Nodet commented on SSHD-118:
--------------------------------------
Do you mind providing a proper patch for review ?
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // e.on modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> boolean bIOExcpetion = false;
> IOException ioException = null;
> if (raf != null) {
> try {
> raf.setLength(0);
> } catch (IOException e) {
> e.printStackTrace();
> ioException = e;
> bIOExcpetion = true;
> } finally {
> if (raf != null)
> raf.close();
> }
> }
> if (bIOExcpetion)
> throw ioException;
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022055#comment-13022055 ]
Otto Frost commented on SSHD-118:
---------------------------------
The patch solves the immediate problem, but the patch has no error handling. I think you should include the stuff I have above, and improve it. Instead of e.printStackTrace(); there should be some better logging and error handling.
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021873#comment-13021873 ]
Will Glass-Husain commented on SSHD-118:
----------------------------------------
Does the patch in SSHD-97 (which I believe is committed to trunk) solve your problem?
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> if (raf != null) {
> raf.setLength(0);
> raf.close();
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SSHD-118) uploading and then renaming a file
doesn't work (on windows)
Posted by "Otto Frost (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SSHD-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Otto Frost updated SSHD-118:
----------------------------
Description:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the correction:
class NativeSshFile
public void truncate() throws IOException {
// e.on modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
boolean bIOExcpetion = false;
IOException ioException = null;
if (raf != null) {
try {
raf.setLength(0);
} catch (IOException e) {
e.printStackTrace();
ioException = e;
bIOExcpetion = true;
} finally {
if (raf != null)
raf.close();
}
}
if (bIOExcpetion)
throw ioException;
}
was:
I logon, and then
put xx xx
rename xx yy
O1706@WKE198515 ~
$ sftp -oport=2222 a@localhost
Connecting to localhost...
a@localhost's password:
sftp> cd tmp
sftp> put xx
Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
xx 100% 1039 1.0KB/s 00:00
sftp> rename xx yy
Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
sftp>
The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
Here is the correction:
class NativeSshFile
public void truncate() throws IOException {
// modification
// permission check
// and close the raf
if (!isWritable()) {
throw new IOException("No write permission : " + file.getName());
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
if (raf != null) {
raf.setLength(0);
raf.close();
}
}
> uploading and then renaming a file doesn't work (on windows)
> ------------------------------------------------------------
>
> Key: SSHD-118
> URL: https://issues.apache.org/jira/browse/SSHD-118
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.5.0
> Environment: windows xp professional sun jdk 1.5.0.22, jre 1.6
> windows 2003 server SP2 sun jdk jre 1.5.0.22
> Reporter: Otto Frost
> Priority: Critical
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I logon, and then
> put xx xx
> rename xx yy
> O1706@WKE198515 ~
> $ sftp -oport=2222 a@localhost
> Connecting to localhost...
> a@localhost's password:
> sftp> cd tmp
> sftp> put xx
> Uploading xx to /C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx
> xx 100% 1039 1.0KB/s 00:00
> sftp> rename xx yy
> Couldn't rename file "/C:/NWDS7.1EHP1/workspace/minasshd_custom/tmp/xx" to "/C:/
> NWDS7.1EHP1/workspace/minasshd_custom/tmp/yy": Failure
> sftp>
> The problem is that the file isn't closed after uploading, SftpSubSystem.process SSH_FXP_WRITE
> NativeSshFile.createOutputStream doesn't close the file, even though the close method is called.
> I can't rename the file from the os either because mina sshd holds it locked after upload. When mina sshd is shut down I can rename the file. After restarting minasshd the file can be renamed (from mina sshd or from the os).
> Here is the correction:
> class NativeSshFile
> public void truncate() throws IOException {
> // e.on modification
> // permission check
> // and close the raf
> if (!isWritable()) {
> throw new IOException("No write permission : " + file.getName());
> }
> RandomAccessFile raf = new RandomAccessFile(file, "rw");
> boolean bIOExcpetion = false;
> IOException ioException = null;
> if (raf != null) {
> try {
> raf.setLength(0);
> } catch (IOException e) {
> e.printStackTrace();
> ioException = e;
> bIOExcpetion = true;
> } finally {
> if (raf != null)
> raf.close();
> }
> }
> if (bIOExcpetion)
> throw ioException;
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira