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:00 -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/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 errors to report, the kernel can report any of the errno
> values.)

Not true.  According to POSIX, EISDIR is reserved for the case:

[EISDIR]
    The named file is a directory and oflag includes O_WRONLY or O_RDWR.

But when target does not exist, then target/ is not a directory.


> 
> 
>>From 9d637cb3e052a529b5c7ec5e7ce70931436a3c45 Mon Sep 17 00:00:00 2001
> From: Paul Eggert <address@hidden>
> Date: Sun, 21 Nov 2010 18:50:41 -0800
> Subject: [PATCH] cp: give a better diagnostic for nonexistent dest/
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> This patch was written by Jim Meyering and myself.
> * src/copy.c (copy_reg): Turn EISDIR to ENOTDIR to improve the
> quality of diagnostics for commands like "cp a nosuch/".  Reported
> by Марк Коренберг and Alan Curry in the thread starting at:
> http://lists.gnu.org/archive/html/bug-coreutils/2010-11/msg00178.html

At any rate, turning the broken Linux kernel EISDIR into the
POSIX-mandated ENOTDIR for this scenario sounds reasonable to me.

-- 
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]