BUG: scp -r follows symlinks

Christian Vogel chris at obelix.hedonism.cx
Wed Jan 7 02:13:07 EST 2004

Hi Edward,

On Mon, Jan 05, 2004 at 09:32:59PM -0800, Edward S. Peschko wrote:
> Ok... duplicate the logic that tar has in determining what is a link. Or accept
> a patch that does this. Or build in a tar interface, so that -r is implemented
> in *terms* of tar. Or somesuch. All I know is right now, its not very user friendly,
> and its not script friendly.

*besides* *that* *specific* *symlink-problem*: There are so many
different behaviours one could expect in "cp" like commands that I would
rather make it explicit by using a well understood tool like tar (or, my
favourite, cpio).

Also not touching ssh, and also just as an example, my favourite misfeature
using cp:

	mkdir a
	touch a/b

	cp -r a c  (first time)
		-> creates dir c, file c/b

	cp -r a c  (again)
		-> creates dir c/c, file c/c/b

Should we try to mimic this kind of behaviour in scp, sftp, rcp, ...?
Should one rely on this behaviour in shell scripts (having to check via
test -d before)? Or should one just use cpio -p in these cases, which has
a well-defined behaviour, works with hardlinks, symlinks, ...


UNIX was not designed to stop you from doing stupid things, because that
would also stop you from doing clever things.  -- Doug Gwyn

More information about the openssh-unix-dev mailing list