The "scp" utility's choice to treat something it doesn't understand as a file name has bit me SO many times.

I've lost count of the number of times I was browsing a folder and randomly found a file named after the FQDN of some box that I had tried to copy something to...

scp foo.bin bar.example.com should be an error, not a copy of foo.bin to a regular file called bar.example.com!

This seems like an example of what Steve Maguire, in his classic text "Writing Solid Code", calls a "candy-machine interface".

The story is of a vending machine using numeric item IDs that is infamous for people accidentally ordering item 100 because they had just put $1.00 into the machine, etc. Using alphanumeric item IDs would prevent this obvious mistake.

The developers of the utility could have predicted that someone forgetting to specify a remote path would be a common mistake and arranged for it to fail noisily in that environment. I don't think anyone intentionally launches "scp" to perform a local-to-local copy, so why does it even support it?

Follow

@azonenberg

IMO a better approach would be to require an affirmative specification that a path is local. Cutting out some specific parts of a cartesian product of features because users find them unintuitive makes for more complicated scripting.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.