Detection of identical file doesn't work for localhost:
Mark D. Baushke
mdb at juniper.net
Tue Jan 30 21:31:47 EST 2001
>Date: Tue, 30 Jan 2001 10:06:28 +0100
>From: Gert Doering <gert at greenie.muc.de>
>
>Hi,
>
>On Tue, Jan 30, 2001 at 08:27:49AM +0100, Christian Kurz wrote:
>> 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?
>
>I don't think it's reasonable. If a user want to shoot into his own foot,
>he will always be able to do this.
>
>If you trap "localhost", people will use 127.0.0.1, or the real name of
>the machine, or one of its ethernet IP addresses, etc.
>
>(Why on earth would anybody do an "scp localhost:..." in the first place?)
Why? Well, one reason would be to copy from a chroot()ed environment
back to the real host, of course... Probably not, but it is possible.
There is no guarentee that localhost:/some/directory is in the same
filesystem as /some/directory on the current machine as viewed by
the currently running scp program.
Enjoy!
-- Mark
More information about the openssh-unix-dev
mailing list