[Mono-bugs] [Bug 58301][Min] New - "file" Uri constructed with empty "location" has wrong path

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 10 May 2004 18:18:30 -0400 (EDT)


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 tekhedd@byteheaven.net.

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

--- shadow/58301	2004-05-10 18:18:30.000000000 -0400
+++ shadow/58301.tmp.10700	2004-05-10 18:18:30.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 58301
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: Gentoo 2.6.1 kernel
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: tekhedd@byteheaven.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: "file" Uri constructed with empty "location" has wrong path
+
+With a Uri object constructed with a path like this:
+
+  file:///etc/hosts
+
+Uri.AbsolutePath() == "/hosts"
+
+However, if the location is supplied:
+
+  file://localhost/etc/hosts
+
+AbsolutePath() == "/etc/hosts".
+
+Seems to be related to bug #54918 "Uri constructed with "file:///path"
+turns into a relative ur".
+
+Steps to reproduce the problem:
+      static int Main( string[] argsThatWillBeCruellyIgnored )
+      {
+         // This works--the location is not part of the absolute path
+         string path = "file://localhost/tmp/foo/bar";
+         Uri fileUri = new Uri( path );
+         Console.WriteLine( path + " becomes " + fileUri.AbsolutePath );
+
+         // Empty path == localhost, in theory
+         path = "file:///tmp/foo/bar";
+         fileUri = new Uri( path );
+         Console.WriteLine( path + " becomes " + fileUri.AbsolutePath );
+
+         return 0;              // Well, at least it doesn't crash
+      }
+
+Actual Results:
+grindstone:/tmp$ mono uri.exe 
+file://localhost/tmp/foo/bar becomes /tmp/foo/bar
+file:///tmp/foo/bar becomes /foo/bar
+
+Expected Results:
+Well, I thought I should expect /tmp/foo/bar in both cases. 
+
+How often does this happen? 
+Always.
+
+Additional Information:
+I am using gentoo's mono-0.91 release.
+
+Bug 54918 is resolved because microsoft's .NET is broken in the same way.
+If this is "correct", then Firefox is definitely broken. If MS's
+implementation is similarly broken, this becomes a moot point as I require
+portability, and please excuse me. :I