emacs-bug-tracker
[Top][All Lists]
Advanced

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

[Emacs-bug-tracker] bug#7450: closed (cp does not check for errno=EISDIR


From: GNU bug Tracking System
Subject: [Emacs-bug-tracker] bug#7450: closed (cp does not check for errno=EISDIR when target is dangling link)
Date: Mon, 22 Nov 2010 09:33:01 +0000

Your message dated Mon, 22 Nov 2010 09:36:37 +0000
with message-id <address@hidden>
and subject line Re: bug#7450: cp does not check for errno=EISDIR when target   
is      dangling link
has caused the GNU bug report #7450,
regarding cp does not check for errno=EISDIR when target is dangling link
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
7450: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7450
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: cp does not check for errno=EISDIR when target is dangling link Date: Sat, 20 Nov 2010 18:39:58 +0500
How to reproduce:

$ ln -s non-exist tgt
$ cp /etc/passwd tgt
cp: not writing through dangling symlink `tgt'

As we see, cp know, that if retval EEXIST and target is symlink,
special responce given.

Now, try to add slash at the end of target:

$ cp /etc/passwd tgt/
cp: cannot create regular file `tgt/': Is a directory

Novices can not understand this message :)

cp should check if (target is symlink and error is EISDIR) and report
message like this:
cp: Trying to use dangling symlink `tgt' as a directory

-- 
Segmentation fault



--- End Message ---
--- Begin Message --- Subject: Re: bug#7450: cp does not check for errno=EISDIR when target is dangling link Date: Mon, 22 Nov 2010 09:36:37 +0000 User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
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.

Closing the bug...

cheers,
Pádraig.


--- End Message ---

reply via email to

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