bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eric Blake
Subject: bug#7450: cp does not check for errno=EISDIR when target is dangling link
Date: Mon, 22 Nov 2010 09:33:51 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6

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 nonexistent dst_name
>> +         ends in a slash and open fails with errno == EISDIR.  */
>> +      if (dest_desc < 0 && dest_errno == EISDIR
>> +          && *dst_name && dst_name[strlen (dst_name) - 1] == '/')
>> +        dest_errno = ENOTDIR;
> 
> I like this because it probably aligns more with other systems.
> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=a16bee4f
> 
> I wonder should the Linux kernel also change?
> I.E. should creat("nosuch/") and ftruncate("nosuch/")
> return ENOTDIR rather than EISDIR ?
> There are arguments for and against I suppose.

The strongest arguments for changing the kernel would be bringing it
into compliance with POSIX.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]