[Mono-bugs] [Bug 51808][Cri] Changed - path is changed/corrupted when creating an XmlTextReader

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 7 Dec 2003 04:26:47 -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 jeroen@xs4all.nl.

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

--- shadow/51808	2003-12-06 13:26:11.000000000 -0500
+++ shadow/51808.tmp.13640	2003-12-07 04:26:47.000000000 -0500
@@ -129,6 +129,42 @@
 "home" get's concatenated in this part of the trace.
 
 ------- Additional Comments From Jeroen@xs4all.nl  2003-12-06 13:26 -------
 Created an attachment (id=6131)
 trace output
 
+
+------- Additional Comments From Jeroen@xs4all.nl  2003-12-07 04:26 -------
+OK, i've pinned this down:
+
+When creating an XmlTextReader, an XmlInputStream is created (of the
+Mono native flavor), which creates an XmlUrlResolver. ResolveUri() is
+called on that object with a baseUri object of "./a" (which maps to
+"/home/jeroen/Projects/scaffold/a" here). The other parameter is a
+relativeUri by the name of
+"/home/jeroen/built/lib/scaffold/plugins/browser.plugin".
+
+These two parameters are used when creating a new System.Uri object in
+the ResolveUri() method. Here is where things go wrong: In the public
+Uri (Uri baseUri, string relativeUri, bool dontEscape) constructor,
+the baseUri is basically copied. It then starts to look for special
+characters (:, #, ?) in relativeUri. But the relativeUri doesn't have
+any of those. Immediately after the last check ('?'), it checks
+whether relativeUri starts with a "/" (which it does) and proceeds to
+use the entire relativeUri as the AbsolutePath:
+
+	if (relativeUri.Length > 0 && relativeUri [0] == '/') {
+		path = relativeUri;
+		if (!userEscaped)
+			path = EscapeString (path);
+		return;
+	}
+
+Normally, the upper-most directory is removed from the AbsolutePath
+and set in the Host property (Host="home",
+AbsolutePath="/jeroen/built/lib/scaffold/browser.plugin"). 
+
+When the LocalPath property is queried, it prepends the Home property
+to the AbsolutePath and you end up with a duplicate directory:
+"/home/home/jeroen/built/lib/scaffold/browser.plugin".
+
+So much for the analysis. Now how to fix it...