bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-22 Thread Pádraig Brady
On 22/11/10 02:54, Paul Eggert wrote: --- a/src/copy.c +++ b/src/copy.c @@ -603,6 +603,12 @@ copy_reg (char const *src_name, char const *dst_name, } } } + + /* Improve quality of diagnostic when a nonexistent dst_name + ends in a slash

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-22 Thread Eric Blake
On 11/20/2010 02:48 PM, Alan Curry wrote: strace shows this: open(tgt/, O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = -1 EISDIR (Is a directory) which I think is just bad kernel behavior. There's no errno (among the classical errno values anyway) which completely expresses you tried to

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-22 Thread Eric Blake
On 11/21/2010 07:54 PM, Paul Eggert wrote: These messages are perhaps not ideal, but they're good enough, and fit better into the existing message style. Here's a proposed patch to do that. (By the way, the kernel is entirely within its rights to generate EISDIR: when there are multiple

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-22 Thread Eric Blake
On 11/22/2010 02:36 AM, Pádraig Brady wrote: On 22/11/10 02:54, Paul Eggert wrote: --- a/src/copy.c +++ b/src/copy.c @@ -603,6 +603,12 @@ copy_reg (char const *src_name, char const *dst_name, } } } + + /* Improve quality of diagnostic when a

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-22 Thread Paul Eggert
On 11/22/10 08:33, Eric Blake wrote: The strongest arguments for changing the kernel would be bringing it into compliance with POSIX. You're right that the Linux kernel doesn't conform to POSIX here (and thank you for correcting me). However, in the past, I found that this errno value does not

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-21 Thread Jim Meyering
Alan Curry wrote: Марк Коренберг writes: How to reproduce: $ ln -s non-exist tgt [...] $ cp /etc/passwd tgt/ cp: cannot create regular file `tgt/': Is a directory Novices can not understand this message :) The same confusing error message also occurs in the simpler case where the

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-21 Thread Paul Eggert
On 11/21/2010 01:49 AM, Jim Meyering wrote: ./cp: invalid destination: `no-such/' a destination with a trailing slash must refer to an existing directory In addition to the problem with mv that Alan mentions, this diagnostic is still confusing, at least for me. Also, what's the

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-21 Thread Jim Meyering
Paul Eggert wrote: On 11/21/2010 01:49 AM, Jim Meyering wrote: ./cp: invalid destination: `no-such/' a destination with a trailing slash must refer to an existing directory In addition to the problem with mv that Alan mentions, this diagnostic is still confusing, at least for me. Also,

bug#7450: cp does not check for errno=EISDIR when target is dangling link

2010-11-20 Thread Alan Curry
=?UTF-8?Q?=D0=9C=D0=B0=D1=80=D0=BA_?= writes: How to reproduce: $ ln -s non-exist tgt [...] $ cp /etc/passwd tgt/ cp: cannot create regular file `tgt/': Is a directory Novices can not understand this message :) The same confusing error message also occurs in the simpler case where the