Closed gdamore closed 9 years ago
So what's weird is that POSIX is a bit different here.
-i should always be "honored" if present. (only defined for "mv" and "ln")
For mv, we should prompt if stdin is a terminal if the destination is not writeable. For ln, we never prompt, and just error if not writeable. For cp, we only prompt if -i is present, else error if we cannot write (or if -f is specified and we cannot unlink the file).
Its kind of sad how the spec differs so much for behavior between cp, mv, and ln. :-(
Also, we get the messaging output handling acl dup wrong in XPG4. We wind up issuing an error message even when we copied the ACL properly, under XPG4.
The prompting for overwriting permissions should be conditional based on the presence of either -i or stdin being a terminal. We get this wrong for xpg4, but right for bin. Weirdly, the check for isatty() needs to be different for mv vs. cp.
If -i is specified, we always want to prompt.