Thread overview
[Issue 8250] New: dirEntries fails to generate file list when compiled with -inline
Dec 22, 2012
Vladimir Panteleev
Dec 22, 2012
Vladimir Panteleev
June 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8250

           Summary: dirEntries fails to generate file list when compiled
                    with -inline
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: callumenator@gmail.com


--- Comment #0 from callumenator@gmail.com 2012-06-16 01:52:48 PDT ---
This code:

auto dFiles = dirEntries("testimages/","*.png",SpanMode.shallow);
foreach(d; dFiles)
  writeln(d.name);

should generate a list of four filenames, however when compiled with -inline it generates none. In release mode with -O (not using -inline) it works fine.

Windows 7 x64 using DMD32 2.059 (same thing happened with 2.058).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8250



--- Comment #1 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2012-10-25 04:25:25 PDT ---
Created an attachment (id=1156)
Imperfect test case

Imperfect test case which doesn't show the precise described behaviour, but nevertheless fails to correctly implement the required dirEntries filter, so may be useful in tracking down bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8250



--- Comment #2 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2012-10-25 04:36:21 PDT ---
Sorry, the error in the above example is from inappropriate use of takeExactly. :-(  dirEntries does indeed return an empty list, and when the correct subdir is put in place, it returns the list of files.  So, it's not a minimal example of the bug or even related.

However, I _am_ still experiencing this problem of an empty list due to a filter which _should_ return a non-empty list of files, and indeed does when compiled with ldmd2 -- but fails when compiled with latest from-GitHub dmd:

    auto fileList = dirEntries(testSetDir, "*.txt", SpanMode.shallow);
    foreach(DirEntry e; fileList)
    {
        ...
    }

If I remove the "*.txt" filter (there are only .txt files in the directory) the fileList is correctly populated.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8250



--- Comment #3 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2012-10-25 04:38:36 PDT ---
(In reply to comment #2)
> However, I _am_ still experiencing this problem of an empty list due to a filter which _should_ return a non-empty list of files, and indeed does when compiled with ldmd2 -- but fails when compiled with latest from-GitHub dmd:

To clarify: it fails when compiled with dmd -inline, but works correctly when -inline is omitted.  With ldmd2 it works with or without the -inline flag.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8250


Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com


--- Comment #4 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-12-21 21:43:20 PST ---
Full test case:

---

import std.file;

void main()
{
    mkdir("test8250");
    scope(exit) rmdirRecurse("test8250");

    write("test8250/a.txt", "test");

    bool found;
    auto dFiles = dirEntries("test8250/", "*.txt", SpanMode.shallow);
    foreach (d; dFiles)
        if (d.name == "test8250/a.txt")
            found = true;

    assert(found, "Can't find a.txt");
}

---

Succeeds with: dmd -run bug8250.d Fails    with: dmd -inline -run bug8250.d

Will attempt to reduce Phobos dependency and refile.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8250


Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #5 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-12-22 00:04:14 PST ---
*** This issue has been marked as a duplicate of issue 9193 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------