[Mono-bugs] [Bug 40306][Wis] New - mono_assembly_open fails under WIN32 platform

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 26 Mar 2003 05:53:02 -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 imitko@openlinksw.co.uk.

http://bugzilla.ximian.com/show_bug.cgi?id=40306

--- shadow/40306	Wed Mar 26 05:53:02 2003
+++ shadow/40306.tmp.27485	Wed Mar 26 05:53:02 2003
@@ -0,0 +1,103 @@
+Bug#: 40306
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: imitko@openlinksw.co.uk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mono_assembly_open fails under WIN32 platform 
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+When using mono under windows the mono_assembly_open fails on existing 
+files. The problem is that g_filename_from_uri do not working correctly
+with file:/ URIs as for windows filesystem. 
+
+
+Steps to reproduce the problem:
+1. try to load assembly with URL as file://c:/tmp/tmp.dll 
+2. load will fail 
+
+Actual Results:
+cannot load assembly
+
+Expected Results:
+to load assembly
+
+How often does this happen? 
+always
+
+Additional Information:
+
+simple program to demonstrate g_filename_from_uri problem under windows
+----------------------------------
+#include <stdio.h>
+#include <glib.h>
+
+void main (int argc, char ** argv)
+{
+  GError *error = NULL;
+  gchar * fname;
+
+  fname = g_filename_from_uri (argv[1], NULL, &error);
+  if (error != NULL)
+    fprintf (stderr, "error: %s\n", error->message);
+  else
+    fprintf (stderr, "%s\n", fname);
+}
+
+<<<< a result from execution
+$ a.out "file://c:/a/b/c"
+error: The hostname of the URI 'file://c:/a/b/c' is invalid
+
+<<<<<<<<<<<<<<<< a patch which makes mono to work with these URIs 
+Index: mono/metadata/appdomain.c
+===================================================================
+RCS file: /mono/mono/mono/metadata/appdomain.c,v
+retrieving revision 1.76
+diff -u -b -B -r1.76 appdomain.c
+--- mono/metadata/appdomain.c   19 Mar 2003 16:26:33 -0000      1.76
++++ mono/metadata/appdomain.c   26 Mar 2003 10:41:38 -0000
+@@ -477,7 +477,12 @@
+                        *tmp = g_filename_from_uri (*tmp, NULL, &error);
+                        if (error != NULL) {
+                                g_error_free (error);
++#ifdef PLATFORM_WIN32
++                               *tmp = g_strdup (file + 7);
++                               g_free (file);
++#else
+                                *tmp = file;
++#endif
+                        } else {
+                                g_free (file);
+                        }
+Index: mono/metadata/assembly.c
+===================================================================
+RCS file: /mono/mono/mono/metadata/assembly.c,v
+retrieving revision 1.56
+diff -u -b -B -r1.56 assembly.c
+--- mono/metadata/assembly.c    19 Mar 2003 16:26:33 -0000      1.56
++++ mono/metadata/assembly.c    26 Mar 2003 10:41:39 -0000
+@@ -341,7 +340,11 @@
+                fname = g_filename_from_uri (filename, NULL, &error);
+                if (error != NULL) {
+                        g_error_free (error);
++#ifdef PLATFORM_WIN32
++                       fname = g_strdup (filename + 7);
++#else
+                        fname = g_strdup (filename);
++#endif
+                }
+        } else {
+                fname = g_strdup (filename);