[Mono-bugs] [Bug 74131][Cos] New - Error with gmcs and mcs when specified bad ouput file

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 27 Mar 2005 22:37:43 -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 albertoavila@gmail.com.


--- shadow/74131	2005-03-27 22:37:43.000000000 -0500
+++ shadow/74131.tmp.12654	2005-03-27 22:37:43.000000000 -0500
@@ -0,0 +1,107 @@
+Bug#: 74131
+Product: Mono: Compilers
+Version: 1.0
+OS Details: Ubuntu Hoary
+Status: NEW   
+Priority: Cosmetic
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: albertoavila@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Error with gmcs and mcs  when specified bad ouput file
+Description of Problem:
+When compiling any file with mcs or gmcs and a incorrect specified ouput
+file is givin, the compiler get broken and throw a stacktrace
+Steps to reproduce the problem:
+1. Create a dummy file like this:
+using System;
+class Test {
+        public static void Main(String[] args)
+        {
+                Console.WriteLine("dummy test");
+        }
+2.Compile it with a bad ouput file like:
+mcs dummy.cs -out:/home/username or gmcs dummy.cs -out:/home/username
+if a directory is given instead of a file like the above example yo get this:
+albertein@cacharro:~/contanet/ContaNet$ gmcs dummy.cs -out:bin/
+Unhandled Exception: System.ArgumentException: name cannot be empty
+Parameter name: name
+in <0x0025a> System.Reflection.Emit.AssemblyBuilder:check_name_and_filename
+in <0x00021> System.Reflection.Emit.AssemblyBuilder:DefineDynamicModule
+in <0x0001a> System.Reflection.Emit.AssemblyBuilder:DefineDynamicModule
+in <0x002a8> Mono.CSharp.CodeGen:Init (string,string,bool)
+in <0x00763> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0001f> Mono.CSharp.Driver:Main (string[])
+there are not a difference if you use mcs or gmcs
+The compiler also get broken with you specified a output file where the
+current user don't have write permission, like:
+albertein@cacharro:~/contanet/ContaNet$ mcs dummy.cs -out:/etc/dummy.exe
+Unhandled Exception: System.UnauthorizedAccessException: Access to the path
+"/etc/dummy.exe" is denied.
+in <0x0055f> System.IO.FileStream:.ctor
+in <0x0005c> System.IO.FileStream:.ctor
+in <0x0003f> (wrapper remoting-invoke-with-check)
+System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
+in <0x0028a> System.Reflection.Emit.ModuleBuilder:Save ()
+in <0x004a7> System.Reflection.Emit.AssemblyBuilder:Save
+in <0x00017> System.Reflection.Emit.AssemblyBuilder:Save (string)
+in <0x00031> Mono.CSharp.CodeGen:Save (string)
+in <0x017db> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0000f> Mono.CSharp.Driver:Main (string[])
+Once again, there aren't any difference if you use mcs or gmcs
+These were the cases that i could identify but i could be other ones.
+Actual Results:
+A stack trace
+Expected Results:
+A error message of the compiler, like Bad ouput file, or do you don;t have
+permission to write that output file
+How often does this happen? 
+Additional Information:
+i'm using the mono 1.1.4 package
+albertein@cacharro:~/contanet/ContaNet$ mcs --version
+Mono C# compiler version
+maybe this is fixed in the svn vercion, if that is the case, i offer my
+apollogies for the innesesary alarm.
+This isn't a critical bug, but it's confusing and alarming that the
+compiler just get broken and throws a stacktrace instead of giving a nice
+and friendly user message.