On Sat, Mar 05, 2016 at 01:41:32AM +0100, Timo Buhrmester wrote: > From src/bin/cp/cp.c: > > while ((ch = getopt(argc, argv, "HLNPRfailprv")) != -1) > > [...] > > case 'i': > > iflag = isatty(fileno(stdin)); > The -i in cp -i is ignored if standard input isn't a tty. > > This breaks doing something along the lines of ``yes n | cp -i [...]'' > (obviously overwriting files that weren't supposed to be overwritten, > as well was rendering the only way to stop cp from overwriting existing > files ineffective in scripts) > > Our man page also doesn't mention this twist. >
So netbsd decided to commit this diff with the following commit message: The '-i' flag should work regardless of whether the standard input is a terminal. The Open Group notes this historic behavior and correctly notes that it doesn't make much sense. Note also, that mv(1) has always respected its '-i' regardless of whether the standard input is a terminal. From Timo Buhrmester. http://cvsweb.netbsd.org/bsdweb.cgi/src/bin/cp/cp.c?rev=1.59&content-type=text/x-cvsweb-markup I can't see any downside to it and if some people were bitten by this, why not?