https://bugzilla.mindrot.org/show_bug.cgi?id=3557
Bug ID: 3557 Summary: Multiple files force undocumented remote directory creation Product: Portable OpenSSH Version: 9.3p1 Hardware: Other OS: Linux Status: NEW Severity: enhancement Priority: P5 Component: scp Assignee: unassigned-b...@mindrot.org Reporter: jida...@jidanni.org Allow us to examine cp's behaviour, $ ls /tmp/VVVV/ ls: cannot access '/tmp/VVVV/': No such file or directory $ cp /tmp/ssd.txt /tmp/VVVV/ cp: cannot create regular file '/tmp/VVVV/': Not a directory $ cp /tmp/ssd.txt /tmp/ssd.txt /tmp/VVVV/ cp: target '/tmp/VVVV/': No such file or directory So far so good. Now let us try scp. Yes, still on the same local machine, $ scp /tmp/ssd.txt /tmp/VVVV/ cp: cannot create regular file '/tmp/VVVV/': Not a directory $ scp /tmp/ssd.txt /tmp/ssd.txt /tmp/VVVV/ /tmp/VVVV/: No such file or directory $ scp /tmp/ssd.txt /tmp/ssd.txt /tmp/VVVV/^C OK, now let us go remote, $ scp /tmp/ssd.txt jidanni.org:/tmp/MMNNOO/ scp: dest open "/tmp/MMNNOO/": Failure scp: failed to upload file /tmp/ssd.txt to /tmp/MMNNOO/ $ scp /tmp/ssd.txt /tmp/ssd.txt jidanni.org:/tmp/MMNNOO/ ssd.txt 100% 62KB 43.1KB/s 00:01 ssd.txt 100% 62KB 43.0KB/s 00:01 Holy smokes Batman, it got fooled into creating the directory! What this means is all safeguards against accidentally creating directories via typos are thrown to the winds. Yes, we are only messing up our own file system, not somebody else's, but it is still bad. If it is intentional, than do kindly document it on the scp man page. No, the multiple files needn't be the same name. They could be different. And, if it is so wonderful, than why doesn't it work locally? ssh -V OpenSSH_9.2p1 Debian-2, OpenSSL 3.0.8 7 Feb 2023 -- You are receiving this mail because: You are watching the assignee of the bug. _______________________________________________ openssh-bugs mailing list openssh-bugs@mindrot.org https://lists.mindrot.org/mailman/listinfo/openssh-bugs