Crash when iterating over files with foreach and std.file.dirEntries on Windows?

Jeremy DeHaan via D.gnu d.gnu at puremagic.com
Tue Nov 17 11:35:02 PST 2015


On Tuesday, 17 November 2015 at 05:25:27 UTC, Jeremy DeHaan wrote:
> On Monday, 16 November 2015 at 22:47:27 UTC, Vincent R wrote:
>> On Monday, 16 November 2015 at 15:34:13 UTC, Jeremy DeHaan 
>> wrote:
>>> Should I file an issue in the bugzilla just in case? And if 
>>> it makes you feel better, this is the first issue I've 
>>> encountered with the MinGW builds.
>>
>> yes you should and please post the code you have used because 
>> I would be curious to reproduce it myself.
>>
>> Thanks
>
> Absolutely. I'm going to spend some time narrowing this down 
> and making sure I know what exactly is causing it before I post 
> any code though.

After minimizing my code, I am now wondering if it has something 
to do with ranges in general or if it is related to just 
dirEntries. This will cause a crash:

module test;

import std.stdio;
import std.file;


void main(string[] args)
{
	writeln("Testing");

	auto directoryEntries = dirEntries("C:\\", SpanMode.shallow);

	writeln("fails?");

}//crash on exiting the scope


And if we try to do something with the range we get a crash 
earlier.


module test;

import std.stdio;
import std.file;
import std.array;


void main(string[] args)
{
	writeln("Testing");

	auto directoryEntries = array(dirEntries("C:\\", 
SpanMode.shallow)); //crash here

	writeln("fails?");//never printed

}


More information about the D.gnu mailing list