http://d.puremagic.com/issues/show_bug.cgi?id=3862

           Summary: std.copy does not have the same behavior as cp
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: jmdavisp...@gmail.com


--- Comment #0 from Jonathan M Davis <jmdavisp...@gmail.com> 2010-02-28 
02:32:10 PST ---
Created an attachment (id=575)
Matrix of cp's behavior vs std.copy (putting it directly in the bug report
would have ruined the formatting)

std.copy() does not behave the same way as cp. I'm not sure that that's
completely a bad thing, but there are some cases where I think that it's
definitely broken as is. I've attached a matrix with a list of possible
combinations of files, directories, and symlinks (I _think_ that I got all of
the possible combinations). Many work exactly like cp, others quite
differently.

The biggest problem area is when trying to copy files to themselves. std.copy
doesn't guard against it, and it generally results in the deletion of the file
(depending on whether symlinks were involved). The one area where it works
differently which we may or may not want to change is copying a file to a
directory. cp puts the file in the directory while std.copy throws an
exception. My first reaction would be that it should be the same as cp, but I
don't know what happens on Windows, and I could see an argument that both the
source and destination should be files.

Regardless of whether we want std.copy to exactly match cp in behavior, there
_are_ cases where std.copy is currently broken.

I suppose that this is tangentially related to bug 3848, but since it doesn't
check whether a file is a file or a directory, and it seems to currently work
correctly with symlinks, I don't think that bug 3848 really matters to this
one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to