digitalmars.D.bugs - [Issue 3862] New: std.copy does not have the same behavior as cp
- d-bugmail puremagic.com (39/39) Feb 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3862
- d-bugmail puremagic.com (10/10) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3862
- d-bugmail puremagic.com (13/13) Aug 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3862
- d-bugmail puremagic.com (9/9) Aug 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3862
- d-bugmail puremagic.com (6/6) Feb 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3862
- d-bugmail puremagic.com (6/7) Feb 26 2013 Fine with me. I'd forgotten about this, and it really should be taken ca...
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: nobody puremagic.com
ReportedBy: jmdavisProg gmail.com
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: -------
Feb 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3862
Andrei Alexandrescu <andrei metalanguage.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |andrei metalanguage.com
AssignedTo|nobody puremagic.com |andrei metalanguage.com
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3862
David Simcha <dsimcha yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dsimcha yahoo.com
IMHO it's **much** more important for Phobos to be consistent across operating
systems than to be consistent with the native file copying command on each OS.
Obviously they don't always conflict but where they do I think the former
should be favored.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3862 14:41:36 PDT --- I think there's value in this insofar as we frame it as "std.file.copy doesn't obey the principle of least astonishment". Taking a peek at cp as an example is fine as long as we're in the business of having a robust file copy routine and not in the business of emulating everything cp does. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3862 PST --- Jonathan, OK to assign this to you? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3862 PST ---Jonathan, OK to assign this to you?Fine with me. I'd forgotten about this, and it really should be taken care of. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2013









d-bugmail puremagic.com 