Subject: Re: sftp rename not good.

From: Martin Pool <[email-masked]>
Date: Fri, 20 Jun 2003 11:41:07 +1000

On 13 May 2003, Joseph Galbraith <[email-masked]> wrote:
> Let me make sure I understand the problem:
> 
> - SSH_FXP_RENAME specifies that it is an
>   error if the new file exists.
> 
> - rename(2) specifies that if the new file
>   exists, it is always overwritten.
> 
> Therefore rename(2) can't be used to implement
> SSH_FXP_RENAME.
> 
> Is this a correct summary of the problem?

I think the fact that SSH_FXP_RENAME is impossible to reliably
implemented on Unix is a serious problem.  Secondarily it is a shame
that it prevents use of the atomic-rename Unix idiom.

I would like to suggest that the phrasing be changed to 

  The server MAY return SSH_FX_FILE_ALREADY_EXISTS if there exists a
  file with the name specified by newpath.

Clients which wish to always replace the path without knowing the
server filesystem can precede the rename operation with an attempt to
delete the destination file.  That does not seem to be an undue
burden.

Clients which know the server is Unix and which wish to take advantage
of atomic replace can do so.

-- 
Martin

---

From: Richard Whalen <[email-masked]>
Date: Fri, 20 Jun 2003 08:12:59 -0400

The suggested change sounds good.

Note that there is no method specified to determine what the server
operating system is.

-----Original Message-----
From: Martin Pool [mailto:[email-masked]]
Sent: Thursday, June 19, 2003 9:41 PM
To: Joseph Galbraith; Alfred Perlstein; [email-masked]; Markus
Friedl; [email-masked]
Subject: Re: sftp rename not good.

-- 
Martin