[Mono-bugs] [Bug 73454][Min] New - mcs crashes when it doesn't have permission to write to output file.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 7 Mar 2005 23:47:10 -0500 (EST)
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 t.manki@gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=73454
--- shadow/73454 2005-03-07 23:47:10.000000000 -0500
+++ shadow/73454.tmp.17648 2005-03-07 23:47:10.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 73454
+Product: Mono: Compilers
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: t.manki@gmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mcs crashes when it doesn't have permission to write to output file.
+
+Description of Problem:
+mcs crashes when it doesn't have permission to write to output file.
+
+Steps to reproduce the problem:
+1. Create a C# program file hello.cs (It can do anything -- that's not
+important)
+
+2. Run these commands to revoke write permission to hello.exe, and then
+compile hello.cs file
+$ >hello.exe
+$ chmod 0 hello.exe
+$ mcs hello.cs
+
+
+Actual Results:
+
+Unhandled Exception: System.UnauthorizedAccessException: Access to the path
+"./hello.exe" is denied.
+in <0x00428> System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool)
+in <0x0005e> System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess)
+in <0x00077> (wrapper remoting-invoke-with-check)
+System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
+in <0x00302> System.Reflection.Emit.ModuleBuilder:Save ()
+in <0x005c8> System.Reflection.Emit.AssemblyBuilder:Save
+(string,System.Reflection.PortableExecutableKind,System.Reflection.ImageFileMachine)
+in <0x00017> System.Reflection.Emit.AssemblyBuilder:Save (string)
+in <0x00035> Mono.CSharp.CodeGen:Save (string)
+in <0x018e1> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0000f> Mono.CSharp.Driver:Main (string[])
+
+Expected Results:
+It should handle the exception and report an error message
+
+How often does this happen?
+Always
+
+Additional Information:
+The same kind of behaviour is exhibited when the output directory does not
+have write permission. For instance, try the following:
+
+$ chmod -w .
+$ mcs hello.cs
+
+This compilation also crashes (the same exception specified earlier).