Detection of identical file doesn't work for localhost:
Damien Miller
djm at mindrot.org
Tue Jan 30 20:06:46 EST 2001
On Tue, 30 Jan 2001, Christian Kurz wrote:
> Hi,
>
> I had to notice that scp is able to detect if a file is copied to itself
> if you use "scp foo /path/to/foo" or "scp foo .". If you type in "scp
> foo localhost:/path/to/foo" it will still overwrite the old version of
> foo. Is it possible to change this behaviour of scp?
>
> I only had a quick glance at scp.c and I'm also not a C coder, only
> learning C right now, so please give me some hints if I'm wrong. You use
> the function "colon" in 984 to check if you should to a remote copy or a
> local copy. I think it would be possible to add a check to it to see if
> the name of the remote host will be localhost and then also use the
> function "tolocal" for doing a local copy instead of calling "toremote".
> What do you guys think? Would you please add this feature?
This has come up before, IIRC we decided not to put such a check in
because there are so many ways to refer to the local host
(localhost, hostname(s), ip addresses, etc) that such a check would
cover a small range of the cases.
OTOH a patch to make scp write to a temp file and then rename it as the
final step may make more sense and achieve a better result.
> P.S.: Would somebody please change s/debain/debian/ in the ChangeLog to
> fix my email-address? Thanks
Done.
-d
--
| ``We've all heard that a million monkeys banging on | Damien Miller -
| a million typewriters will eventually reproduce the | <djm at mindrot.org>
| works of Shakespeare. Now, thanks to the Internet, /
| we know this is not true.'' - Robert Wilensky UCB / http://www.mindrot.org
More information about the openssh-unix-dev
mailing list