Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't rename file /C:/test/file to /C:/test/file2: Failure #491

Closed
fdefilippo opened this issue Jan 28, 2022 · 4 comments
Closed

Couldn't rename file /C:/test/file to /C:/test/file2: Failure #491

fdefilippo opened this issue Jan 28, 2022 · 4 comments

Comments

@fdefilippo
Copy link

Hi, I'v a small custom sftp server on windows, if I try to rename using the disk name in the path the rename fails. how can i solve? thank you.

@puellanivis
Copy link
Collaborator

Could you give us some more information? Sample code and the actual error messages returned can help significantly figure out what is going on.

@fdefilippo
Copy link
Author

fdefilippo commented Jan 30, 2022

Hi, by reference to Release 1.13.4, similar to what was found in the server.go file, at the moment we solved the issue by applying the following solution in the packet.go file:

`
$ diff -urN packet.go packet.go.new
--- packet.go 2022-01-30 12:53:20.571724822 +0100
+++ packet.go.new 2022-01-30 12:55:13.076428695 +0100
@@ -1242,7 +1242,7 @@
}

func (p *sshFxpExtendedPacketPosixRename) respond(s *Server) responsePacket {

  •   err := os.Rename(p.Oldpath, p.Newpath)
    
  •   err := os.Rename(toLocalPath(p.Oldpath), toLocalPath(p.Newpath))
      return statusFromError(p.ID, err)
    

}
`

@puellanivis
Copy link
Collaborator

Ack! This appears to be an actual bug. Looks like the same issue exists with sshFxpExtendedPacketHardlink as well!

@drakkan
Copy link
Collaborator

drakkan commented Feb 1, 2022

Fixed in #492

@drakkan drakkan closed this as completed Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants