emacs-devel
[Top][All Lists]
Advanced

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

Re: bug in copy-directory


From: Stefan Monnier
Subject: Re: bug in copy-directory
Date: Fri, 28 Jan 2011 13:35:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>>> Actually on 23.2.92.1, copy-directory, called interactively or not copy
>>>> the files of directory A to existing directory B instead of copying
>>>> directory A inside directory B.(as a subdirectory of B).
>>> Hmm, this is a bit problematic.
>> [...]
>>> The trouble is that Lisp callers might depend on the old behavior.
>> Couldn't/shouldn't we distinguish between interactive and
>> non-interactive calls, then?  I.e. have the interactive spec turn the
>> B into (expand-file-name (file-name-nondirectory A)) when B is an
>> existing directory.

> Wouldn't that be confusing?  "Copy directory A to directory B" really
> ought to mean the same as "cp -r a b".

It depends if you expect it to behave like `cp' even for
non-interactive uses.

I don't think there's a traditional C-level equivalent to `cp', but at
least for `mv', the C-level API (aka `rename') does not behave like
`mv', but instead signals an error if the destination is
a pre-existing directory.

As Lennart points out, the semantics of `rename' are a bit less magical,
which tends to work well when you care about race-conditions and other
fun stuff.  OTOH out `copy-file' behaves like `cp', so I guess it's OK
for copy-directory to also always behave like `cp' even for
non-interactive uses.


        Stefan



reply via email to

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