News for hackers. Stuff that matters.
Re:Deprecating scp by sevensor on Friday November 06, 2020 @09:47AM (#25007922)
At least 9 times out of 10, I end up typing scp instead of rsync, and then regretting it. Rsync makes an effort not to move bytes it doesn't have to and generally saves me a bunch of time. If I'm actually thinking about what I'm doing, I use rsync. Using scp is just muscle memory. I wouldn't miss it.
Re:Deprecating scp by stjohnswarts on Friday November 06, 2020 @09:57AM (#25007996)
rsync with the weird / logic is annoying. I prefer scp. I'll use rcp and dig around for the weird incantations if I have something that I need to sync regularly though.
Re:Deprecating scp by dylan604 on Friday November 06, 2020 @11:18AM (#25008722)
are you referring to the differing behavior if there is a trailing slash or not? it only takes a couple of times for that mistake to be learned, and then becomes quite the convenient tool when used correctly. it shouldn't be the one thing that prevents you from using a tool on a regular basis though.
Re:Deprecating scp by sfink on Friday November 06, 2020 @11:39AM (#25008922)
The trailing slash behavior totally makes sense. It only took me a couple of times for me to learn it.

Unfortunately, it took only one more time for it to be forgotten, then another few times to be re-learned, then forgotten again, then half-remembered the wrong way, then....

I pretty much have it down now, though. The secret to my success: remembering that the differing behavior applies to the source side only. Trying to work out the matrix of possibilities between source, source/, dest, and dest/ is where I usually got lost, until I finally got it through my head that the destination syntax is irrelevant.

Now it makes sense: "foo/bar/" is the directory named "bar"; "foo/bar" is the directory entry within foo/ named "bar". Copying a directory puts its contents on the destination side. Copying a named thing, whether the name refers to a file or directory, puts that name on the destination side.

Re:Deprecating scp by perennialmind on Friday November 06, 2020 @05:36PM (#25011799)
Lately I've taken to avoiding that fine point. I find it easier to internalize `foo/bar/.`. Using the self-referential dot this way doesn't carry the same semantics, but the effect is the same and it's a pattern that applies to many tools.

rather than consult the manpage yet again. When I want those semantics, I tack on the self-referential dot. `rsync foo/bar/. baz`

Re:Deprecating scp by recursive on Friday November 06, 2020 @11:54AM (#25009044)
I've never used rcp or rsync, but your final explanation provides no illumination for me. "foo/bar/" and "foo/bar" are both directories named "bar". Copying a thing puts that thing on the destination side. It still doesn't sound like there's a difference.
Re:Deprecating scp by hanche on Friday November 06, 2020 @02:24PM (#25010329)
I think it makes more sense to say that, for rsync, "foo/bar/" names the contents of the directory, while "foo/bar" names the directory itself. You could perhaps think of "foo/bar/" as a shortcut for "foo/bar/*", except that it matches hidden files as well.
Re:Deprecating scp by dcassett on Friday November 06, 2020 @12:40PM (#25009443)
foo/bar/ and foo/bar are not the same if bar is a symbolic link. You can see the difference using 'ls -l'
Re:Deprecating scp by hanche on Friday November 06, 2020 @02:25PM (#25010347)
My understanding is that "foo/bar/" is considered a short form of "foo/bar/.". Interpreting that forces following the symlink.
Re:Deprecating scp by dylan604 on Friday November 06, 2020 @12:40PM (#25009449)
Yeah, that happens to me on anything that gets used, put back up on the shelf, and then pulled back down again after some period of not being used. However, rsync has become the go to tool for getting local content to/from a server.
Re:Deprecating scp by b0afc375b5 on Saturday November 07, 2020 @04:40AM (#25014096)
Thanks for the explanation, I've also struggled with this in the past. Hopefully I remember it This Time™.
Re:Deprecating scp by zootboy on Friday November 06, 2020 @01:41PM (#25010020)
I'm constantly annoyed that normal cp _doesn't_ support the trailing slash distinction. It's so useful.
Re:Deprecating scp by elihu on Friday November 06, 2020 @02:15PM (#25010274)
I just wish that cp and scp were the same; one less inconsistency to have to remember.
Re:Deprecating scp by marcosdumay on Friday November 06, 2020 @11:56AM (#25009063)
On the other hand, rsync just assumes the network is the only slow resource, and use plenty of everything else.

What is faster depends a lot on what you are trying to do. Rsync can be several times slower at times.

Re:Deprecating scp by brians on Friday November 06, 2020 @10:01AM (#25008028)
Rsync has surprised me a few times by needing to read everything on the target side. When that includes a few TB of nonlocal disk—whoops!
Re:Deprecating scp by schoen on Friday November 06, 2020 @03:25PM (#25010789)
It's a clever protocol that optimizes for minimizing network usage. Note that it was written in the 1990s by two Australians!

Sometimes this optimization isn't the exact optimization you want. :-)