[Mono-bugs] [Bug 74731][Nor] New - Races in System.IO argument checking
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 25 Apr 2005 23:09:08 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=74731
--- shadow/74731 2005-04-25 23:09:08.000000000 -0400
+++ shadow/74731.tmp.6337 2005-04-25 23:09:08.000000000 -0400
@@ -0,0 +1,41 @@
+Bug#: 74731
+Product: Mono: Class Libraries
+Version: 1.0
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: bmaurer@users.sf.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Races in System.IO argument checking
+
+In various places in System.IO, we do stuff like:
+
+ public FileInfo CopyTo (string path, bool overwrite) {
+
+ string dest = Path.GetFullPath (path);
+
+
+ if (overwrite && File.Exists (path))
+
+ File.Delete (path);
+
+
+
+ File.Copy (FullPath, dest);
+
+
+
+ return new FileInfo (dest);
+ }
+
+This has a race condition. For example the file `path' could be created
+again between the Delete and the Copy, causing an exception, if overrite
+was not set, a file could be created between the Exists check and the copying.