Bug 316914 (MONO71371) - Locking on portions of file fails.
Summary: Locking on portions of file fails.
Status: RESOLVED MOVED
Alias: MONO71371
Product: Mono: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-18 08:10 UTC by Miguel de Icaza
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:04:18 UTC


---- Reported by miguel@ximian.com 2005-01-18 01:10:53 MST ----

.NET implements file-locking behavior. from our test suite:

using System;
using System.IO;
class X {
		static void Main ()
		{
			string path = "TestLock";
                	File.Delete (path);

                	FileStream stream = new FileStream (path,
FileMode.CreateNew, FileAccess.ReadWrite);
                	                	
	               	stream.Write (new Byte [] {0,1,2,3,4,5,6,7,8,9,10}, 0,
10);                              	
                	stream.Close ();

                	stream = new FileStream (path, FileMode.Open,
FileAccess.ReadWrite);
                	
                	stream.Lock (0, 5);
                	
                	FileStream stream2 = new FileStream (path , FileMode.Open,
FileAccess.Read, FileShare.ReadWrite);
                	
                	byte [] bytes = new byte [5];
                	try {                		
                		stream2.Read (bytes, 0, 5);
				Console.WriteLine ("The read should have failed for the portion locked");
                	} catch (Exception e) {
				Console.WriteLine ("Ok");
                	}
		}
}

This program should print "ok"



---- Additional Comments From dick@ximian.com 2005-01-18 06:59:21 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO71292 ***


Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"