Bugzilla – Bug 324983
IsolatedStorageFileStreams over rooted paths throw UnauthorizedAccessException
Last modified: 2007-11-06 18:37:27 UTC
---- Reported by jnmiller@cryptofreak.org 2007-08-03 17:09:30 MST ---- Description of Problem: With the latest out of SVN, IsolatedStorageFileStreams over rooted paths throw UnauthorizedAccessException. This does not happen when using the MS library. The problem is that Mono's ISFS path creator uses Path.Combine() without regard to the requested path's content. Path.Combine() in turn returns only the second argument when that argument is a rooted path. ISFS therefore attempts to create its IS file off of the root directory which is, of course, unauthorized. Steps to reproduce the problem: 1. ISFS fs = new ISFS("/rootpath", FileMode.Create); Actual Results: Unhandled Exception: System.UnauthorizedAccessException: Access to the path "rootpath" is denied. at System.IO.FileStream..ctor (System.String name, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] at System.IO.FileStream..ctor (System.String name, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile isf) [0x00000] at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor (System.String path, FileMode mode) [0x00000] at (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFileStream:.ctor (string,System.IO.FileMode) at Test.Test.Main (System.String[] args) [0x00000] Expected Results: Success. How often does this happen? Always! Additional Information: I have included a patch for ISFS.cs and a unit test to cover this minor issue. I also included a simple test program that looks the same as the unit test. ---- Additional Comments From jnmiller@cryptofreak.org 2007-08-03 17:10:17 MST ---- Created an attachment (id=172413) Test case ---- Additional Comments From jnmiller@cryptofreak.org 2007-08-03 17:11:31 MST ---- Created an attachment (id=172414) Proposed patch: remove the root characters from the path before Combine()ing (and a unit test). Imported an attachment (id=172413) Imported an attachment (id=172414) Unknown operating system unknown. Setting to default OS "Other".
Patch applied (r89015/89016) Thanks!