The problem is sporadic mdoc test failures on Wrench/OS X:
Updating: Mono.DocTest.Widget/NestedClass/Double/Triple/Quadruple
mdoc: System.UnauthorizedAccessException: Access to the path '/var/folders/_g/y9v720_90l914yylrk7m903c0000gn/T/tmp20f71445.tmp' is denied.
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool,System.IO.FileOptions)
at System.IO.Path.GetTempFileName () [0x00000] in <filename unknown>:0
at Mono.Documentation.MdocFile.UpdateFile (System.String file, System.Action`1 creator) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDocUpdater.WriteFile (System.String filename, FileMode mode, System.Action`1 action) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDocUpdater.DoUpdateType2 (System.String message, System.Xml.XmlDocument basefile, Mono.Cecil.TypeDefinition type, System.String output, Boolean insertSince) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDocUpdater.DoUpdateType (Mono.Cecil.TypeDefinition type, System.String basepath, System.String dest) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDocUpdater.DoUpdateAssembly (Mono.Cecil.AssemblyDefinition assembly, System.Xml.XmlElement index_types, System.String source, System.String dest, System.Collections.Generic.HashSet`1 goodfiles) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDocUpdater.DoUpdateAssemblies (System.String source, System.String dest) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDocUpdater.Run (IEnumerable`1 args) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDoc.Run (System.String[] args) [0x00000] in <filename unknown>:0
at Mono.Documentation.MDoc.Main (System.String[] args) [0x00000] in <filename unknown>:0
I'm not sure why we're getting UnauthorizedAccessException exceptions,
nor do I particularly care; Path.GetTempFileName() should not be
throwing UnauthorizedAccessException; only IOException is documented:
http://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename.aspx
Update behavior to skip files that generate
UnauthorizedAccessException, and if we swallow short.MaxValue
exceptions wrap the UnauthorizedAccessException in an IOException so
that we conform to documented exceptional behavior.
The loop is happening between these calls:
https://github.com/mono/mono/blob/92d8961e0b244429d4d82176f4b33c8a4b3b064c/mcs/class/corlib/System.IO/Path.cs#L298
https://github.com/mono/mono/blob/3c39ac4586b4470703fb4af0208b5baf1de70e43/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs#L157
https://github.com/mono/mono/blob/9322e0d16b0edc054947279af34d3c7afb286c89/mcs/class/corlib/System.IO/Directory.cs#L248
Stack trace as follows:
The requested operation caused a stack overflow. at (wrapper managed-to-native) System.IO.MonoIO:GetCurrentDirectory (System.IO.MonoIOError&)
at System.IO.Directory.GetCurrentDirectory () [0x00000] in <filename unknown>:0
at System.IO.Path.WindowsDriveAdjustment (System.String path) [0x00000] in <filename unknown>:0
at System.IO.Path.InsecureGetFullPath (System.String path) [0x00000] in <filename unknown>:0
at System.Security.Permissions.FileIOPermission.AddPathInternal (FileIOPermissionAccess access, System.String path) [0x00000] in <filename unknown>:0
at System.Security.Permissions.FileIOPermission.AddPathList (FileIOPermissionAccess access, System.String path) [0x00000] in <filename unknown>:0
at System.Security.Permissions.FileIOPermission..ctor (FileIOPermissionAccess access, System.String path) [0x00000] in <filename unknown>:0
at System.IO.Directory.GetCurrentDirectory () [0x00000] in <filename unknown>:0
at System.IO.Path.WindowsDriveAdjustment (System.String path) [0x00000] in <filename unknown>:0
at System.IO.Path.InsecureGetFullPath (System.String path) [0x00000] in <filename unknown>:0
at System.Security.Permissions.FileIOPermission.AddPathInternal (FileIOPermissionAccess access, System.String path) [0x00000] in <filename unknown>:0
at System.Security.Permissions.FileIOPermission.AddPathList (FileIOPermissionAccess access, System.String path) [0x00000] in <filename unknown>:0
at System.Security.Permissions.FileIOPermission..ctor (FileIOPermissionAccess access, System.String path) [0x00000] in <filename unknown>:0
at System.IO.Directory.GetCurrentDirectory () [0x00000] in <filename unknown>:0
at System.IO.Path.WindowsDriveAdjustment (System.String path) [0x00000] in <filename unknown>:0
at System.IO.Path.InsecureGetFullPath (System.String path) [0x00000] in <filename unknown>:0
...Snip...
Refactor this method so that it only attempts alternative filenames if
the filename just attempted already exists. This way we will never end
up looping forever being unable to create the required file. Previously
if we opened the maximum allowed files and then called GetTempFileName
we'd loop forever throwing an IOException in the FileStream constructor
every time.
* FileStream.cs: when running on Windows and a path with Unix
directory separator chars is passed (including an UNC share), get
the canonical form of the path before attempting to retrieve its
directory name. Fixes bug #607502
* Path.cs: typo fix
svn path=/trunk/mcs/; revision=157650
* Path.cs: vararg overload of Combine now correctly concatenates
segments.
The 3 and 4 argument overloads of Combine check whether the passed
segments are null or not.
2010-05-08 Marek Habersack <[email protected]>
* PathTest.cs: added tests for the 4.0 Combine overloads.
svn path=/trunk/mcs/; revision=156928
* Directory.cs: Ensure elevated trust when calling on
Moonlight.
* DirectoryInfo.cs: Ensure elevated trust when calling a .ctor
on Moonlight.
* File.cs: Ensure elevated trust when calling a .ctor on
Moonlight.
* FileInfo.cs: Ensure elevated trust when calling a .ctor on
Moonlight.
* FileStream.cs: Ensure elevated trust when calling a .ctor on
Moonlight. Name property returns "[Unknown]" unless a Moonlight
application is executed with elevated trust.
* Path.cs: Ensure elevated trust when calling a GetTempPath,
GetTempFileName or GetFullPath on Moonlight. Add a shared
internal method to validate paths to reduce code duplication.
svn path=/trunk/mcs/; revision=155643
* UnmanagedMemoryStream.cs: Move the CLS attribute to the methods
that are unsafe.
* Path.cs (Combine):e Fix implementation to follow docs (we need
to reset the path if any of the combined paths is rooted), and add a
couple of overloads;
* FileStream.cs (Flush/flushToDisk): Implement.
* Stream.cs (CopyTo): Implement.
svn path=/trunk/mcs/; revision=145640
LAMESPEC comment. In GetPathRoot, throw ArgumentException if path
is whitespace-only. Throw ArgumentException in HasExtension, if path
contains invalid path characters.
* PathCas.cs: Updated method names to reflect changes in PathTest.
* PathTest.cs: Renamed tests. Use String.Empty instead of "". Added
argument check tests, and moved tests to separate methods. Avoid using
ExpectedException.
svn path=/trunk/mcs/; revision=106353
2008-05-29 Robert Jordan <[email protected]>
* Path.cs (InsecureGetFullPath): Call CanonicalizePath for
UNC paths as well.
* Path.cs (GetServerAndShare): New helper method.
* Path.cs (SameRoot, CanonicalizePath): Add UNC support.
Fixes#394681 and a bunch of TestGetFullPath unit cases.
All changes are Win32 related.
In Test/System.IO:
2008-05-29 Robert Jordan <[email protected]>
* PathTest.cs (TestGetFullPathUnix, TestGetFullPathWindows):
Factored out from the disabled TestGetFullPath test while fixing
the issues mentioned by the ERROR comment and bug #394681.
svn path=/trunk/mcs/; revision=106188
* CheckArgument.cs: Removed. Lots of unused code. The two methods
used are now inlined into Path.cs
* CheckPermission.cs: Removed. Lots of unused code.
* Path.cs: Inlined two checks.
[Found using Gendarme]
svn path=/trunk/mcs/; revision=102718
indicates whether the original path should only container the last
part of the directory. Moved logic for determining the Name and
Parent to Initialize method, to allow it to be re-used on
deserialization. Renamed argument names to fix corcompare issues.
Added missing argument checks.
* Directory.cs (CreateDirectoriesInternal): Use internal ctor for
DirectoryInfo to ensure OriginalPath only contains last part of
the directory.
* File.cs: Removed redundant checks from Create. On 2.0 profile, pass
FileOptions to FileStream. Removed redundant directory check from
Delete and modified exceptions to more closely match MS.
* FileInfo.cs: Added argument check to ctor to match MS. Added missing
deserialization ctor. Modified argument checks in MoveTo, and removed
redundant checks. Added missing argument checks in CopyTo. Code
formatting.
* FileSystemInfo.cs: Modified argument checks in CheckPath to more
closely match MS.
* MonoIO.cs: Added msg that does not disclose filename for
ERROR_FILE_EXISTS.
* Path.cs: Use String.Length instead of comparing with String.Empty.
Removed exceptions argument names to match MS.
* File.cs: Added/improved tests for Create and Move.
* DirectoryInfoTest.cs: No longer derive from deprecated Assertion
class. Improved tests for ctor, Create, Name, Parent, ...
* FileInfoTest.cs: No longer derive from deprecated Assertion class.
Improved/added tests,
* PathTest.cs: Added tests for IsPathRooted and GetFullPath.
* FileSystemInfoTest.cs: Fixed test. Now passes on both Mono and MS.
svn path=/trunk/mcs/; revision=101006
* Path.cs (GetRandomFileName): Return filenames containing only
characters from the range [a..z0..9] as MS.NET does.
svn path=/trunk/mcs/; revision=89869
* Path.cs (GetDirectoryName): The paths returned from this routine
should be canonical, not just a substring. In addition to fixing
this, it also fixes#324742.
svn path=/trunk/mcs/; revision=88708
* Path.cs: Manually call FileStream and pass the new internal
FileOptions.1 flag that means "This is a temporary file, use 600
permissions".
* FileOptions.cs: Document the new private enum value.
svn path=/trunk/mcs/; revision=73771
* Path.cs (GetPathRoot): Return just the \\server\share
part of a UNC. Fixes#78147.
2006-04-28 Robert Jordan <[email protected]>
* PathTest.cs: Added tests for bug #78147.
svn path=/trunk/mcs/; revision=60033