[Mono-bugs] [Bug 385765] New: DirectoryInfo.GetDirectories() does not return sym links that point to directories.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 1 16:31:59 EDT 2008


User russell.davies at blakemere.ca added comment

           Summary: DirectoryInfo.GetDirectories() does not return sym links
                    that point to directories.
           Product: Mono: Class Libraries
           Version: 1.2.5
          Platform: i686
               URL: http:///
        OS/Version: Linux
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: russell.davies at blakemere.ca
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Description of Problem:
When running DirectoryInfo().GetDirectories() on a directory that contains
symbolic links to other directories, those links are not included amongst the
DirectoryInfo [] returned. 

Steps to reproduce the problem:
1. Create and compile the following C# test program.

<C# "symbLinks.exe">
using System;
using System.IO;

namespace symLinks
    class Program
        public static void Main(string[] args)

            DirectoryInfo di = new DirectoryInfo(Environment.CurrentDirectory);

            DirectoryInfo [] dirs = di.GetDirectories();
            FileInfo [] files = di.GetFiles();

            Console.WriteLine("List of Directories:");
            foreach(DirectoryInfo dir in dirs)

            Console.WriteLine("\nList of Files:");
            foreach(FileInfo file in files)

2. Create a test directory on Linux, containing some directories, symbolic
links and files. e.g.

# cd
# mkdir test
# cd test
# mkdir dir1
# ln -s dir1 symLink1
# : > file1

3. Move the compiled C# program to the directory, and run it. 

Actual Results:

     List of Directories:

     List of Files:

Expected Results:

     List of Directories:
     symLink1    <--- Expected the symLink1 to appear as a directory

     List of Files:
     symLink1   <--- Not sure if symLink1 should appear as a file

How often does this happen? 
Always, when handling symbolic links on Linux.  

Additional Information:
The C# program was targeted for NET 2.0.

Interestingly, symbolic links are seen as directories when accessing those same
files from Windows via a samba share, so I guess Samba does some clever

This might be related to closed BUG #322588
(https://bugzilla.novell.com/show_bug.cgi?id=322588).  From my reading of that
discourse, the expectation of seeing the symbolic link appear as a directory is
not unreasonable, (see last comment from "Alex").  That bug was reported fixed
as far back as r67766.  Has there been a regression?

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list