[Mono-bugs] [Bug 81087][Nor] New - Filename resolution inconsistent between Path.GetFullPath and File.Exists
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Mar 8 19:21:40 EST 2007
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 dsilva at ccs.neu.edu.
http://bugzilla.ximian.com/show_bug.cgi?id=81087
--- shadow/81087 2007-03-08 19:21:40.000000000 -0500
+++ shadow/81087.tmp.4571 2007-03-08 19:21:40.000000000 -0500
@@ -0,0 +1,116 @@
+Bug#: 81087
+Product: Mono: Class Libraries
+Version: 1.2
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: dsilva at ccs.neu.edu
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Filename resolution inconsistent between Path.GetFullPath and File.Exists
+
+Path.GetFullPath is not consistent with File.Exists. I believe File.Exists
+gives the right answer here, as it follows symlink semantics. Regardless,
+they should not differ.
+
+$ uname -a
+Linux ds 2.6.18-4-686 #1 SMP Wed Feb 21 16:06:54 UTC 2007 i686 GNU/Linux
+$ mcs --version
+Mono C# compiler version 1.2.2.1
+$ mono --version
+Mono JIT compiler version 1.2.2.1, (C) 2002-2006 Novell, Inc and
+Contributors. www.mono-project.com
+ TLS: normal
+ GC: Included Boehm (with typed GC)
+ SIGSEGV: normal
+ Disabled: none
+
+$ ls -l /usr/X11R6/
+total 4
+lrwxrwxrwx 1 root root 6 2007-03-01 17:02 bin -> ../bin
+lrwxrwxrwx 1 root root 14 2006-07-16 05:41 lib -> /usr/lib/xorg/
+$ ls /usr/X11R6/bin/../lib/pkgconfig/ORBit-2.0.pc
+/usr/X11R6/bin/../lib/pkgconfig/ORBit-2.0.pc
+$ realpath /usr/X11R6/bin/../lib/pkgconfig/ORBit-2.0.pc
+/usr/lib/pkgconfig/ORBit-2.0.pc
+
+
+Test program:
+
+
+using System;
+using System.IO;
+
+public class Test {
+
+ public static void Main(string[] argv) {
+ string pcdir = "/usr/X11R6/bin/../lib/pkgconfig";
+ string pc = "ORBit-2.0.pc";
+ string pcfile = pcdir + "/" + pc;
+
+ Console.WriteLine("pcdir: " + pcdir);
+ Console.WriteLine("pcfile: " + pcfile);
+
+ Console.WriteLine("pcdir exists? " + Directory.Exists(pcdir));
+ Console.WriteLine("pcfile exists? " + File.Exists(pcfile));
+
+ string fulldir = Path.GetFullPath (pcdir);
+ string fullfile = Path.GetFullPath (pcfile);
+
+ Console.WriteLine("fulldir: " + fulldir);
+ Console.WriteLine("fullfile: " + fullfile);
+
+ Console.WriteLine("fulldir exists? " + Directory.Exists(fulldir));
+ Console.WriteLine("fullfile exists? " + File.Exists(fullfile));
+ }
+}
+
+$ mcs Test.cs && mono Test.exe
+pcdir exists? True
+pcfile exists? True
+fulldir exists? False
+fullfile exists? False
+dsilva at ds:/tmp$ mcs Test.cs && mono Test.exe
+pcdir: /usr/X11R6/bin/../lib/pkgconfig
+pcfile: /usr/X11R6/bin/../lib/pkgconfig/ORBit-2.0.pc
+pcdir exists? True
+pcfile exists? True
+fulldir: /usr/X11R6/lib/pkgconfig
+fullfile: /usr/X11R6/lib/pkgconfig/ORBit-2.0.pc
+fulldir exists? False
+fullfile exists? False
+
+
+
+This problem affects the FileStream constructor, which affects
+File.OpenRead, which affects StreamReader, which affects MonoDevelop's
+initialization:
+
+$ monodevelop
+
+Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a
+part of the path "/usr/X11R6/lib/pkgconfig".
+ at System.IO.FileStream..ctor (System.String name, FileMode mode,
+FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous,
+FileOptions options) [0x00000]
+ at System.IO.FileStream..ctor (System.String name, FileMode mode,
+FileAccess access, FileShare share) [0x00000]
+ at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor
+(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
+ at System.IO.File.OpenRead (System.String path) [0x00000]
+ at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding
+encoding, Boolean detect_encoding_from_bytemarks, Int32 buffer_size) [0x00000]
+ at System.IO.StreamReader..ctor (System.String path) [0x00000]
+ at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
+ at MonoDevelop.Core.SystemAssemblyService.ParsePCFile (System.String
+pcfile) [0x00000]
+ at MonoDevelop.Core.SystemAssemblyService.RunInitialization () [0x00000]
+ at MonoDevelop.Core.SystemAssemblyService.BackgroundInitialize () [0x00000]
+ at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()
More information about the mono-bugs
mailing list