March 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6329



--- Comment #10 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-03-03 20:26:02 PST ---
(In reply to comment #9)
> The range error is 'entry' is a string, and you are slicing it beyond it's end. This is not a bug in the compiler or runtime, it's in your code.

You have misunderstood the bug report. The problem is that, to the user, the exception was silently discarded 2.054.

In reality, the range exception results in an uncaught SEH exception. On most machines, it will cause the standard "Program has stopped working" dialog, however Andrej has those dialogs disabled.

With DMD 2.058, it causes a barrage of Access Violation errors. This is a bug, as the correct behavior is to print the stack trace of a RangeError and exit.

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



--- Comment #11 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-04-07 13:41:00 PDT ---
I've run into this issue yet again. And I've noticed something: If I compile with '-g' then I get the exception thrown. Otherwise nothing is thrown and I get back an exit code: -1073741819

Here's an example with Vladimir's AE library:

Use this test.xml file:
<Class file="somefile"></Class>

And this script:

import ae.utils.xml;
import std.path;
import std.file;
import std.stream;
import std.stdio;

void main()
{
    foreach (string entry; dirEntries(".", SpanMode.shallow))
    {
        if (entry.extension == ".xml")
        {
            Stream stream = new BufferedFile(entry);
            XmlNode document = new XmlDocument(stream);
            auto node = document.children[0];

            writeln(node.attributes["file"]);
            writeln(node.attributes["none"]);
        }
    }
}

Notice that "file" will exist but "none" does not, and this should throw a RangeError.

So if I run 'rdmd -g test.d', I get:
core.exception.RangeError@test(20): Range violation
and a stack trace.

But if I run 'rdmd test.d' (without -g) I get the exit code '-1073741819'. I can't even catch the error by using Throwable, it simply exits the app altogether.

As it stands using dirEntries is completely unreliable for me, and this issue keeps shooting me in the foot because I keep forgetting about it as I innocently use the foreach loop without thinking.

And here's a way to force the range error without using -g:

import ae.utils.xml;
import std.path;
import std.file;
import std.stream;
import std.stdio;

void main()
{
    string[] entries;
    foreach (string entry; dirEntries(".", SpanMode.shallow))
    {
        if (entry.extension == ".xml")
        {
            entries ~= entry;
        }
    }

    foreach (entry; entries)
    {
        Stream stream = new BufferedFile(entry);
        XmlNode document = new XmlDocument(stream);
        auto node = document.children[0];

        writeln(node.attributes["file"]);
        writeln(node.attributes["nonexistent_key"]);
    }
}

So basically the only safe way of using dirEntries is to save a list of files and then do another foreach loop to process it.

I really hope we get this fixed. :/

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


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de


--- Comment #12 from Rainer Schuetze <r.sagitario@gmx.de> 2012-04-13 05:18:24 PDT ---
Did you notice that the return code -1073741819 is 0xC0000005, which usually means "Access Violation"?

I guess this is happening in the stack trace generation code that is executed when an exception is thrown. This code is expensive, has to deal with non-existing or buggy debug information and is unsafe itself. I recommend disabling it by default.

I usually run this early from a shared static module constructor to disable it (including always loading dbghelp.dll and debug symbols at startup):

extern extern(C) __gshared ModuleInfo
D4core3sys7windows10stacktrace12__ModuleInfoZ;

void disableStacktrace()
{
    ModuleInfo* info = &D4core3sys7windows10stacktrace12__ModuleInfoZ;
    *cast(typeof(info.o.ctor)*)(cast(void*)info + 8) = null;
}

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


SomeDude <lovelydear@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear@mailmetrash.com


--- Comment #13 from SomeDude <lovelydear@mailmetrash.com> 2012-05-04 15:01:42 PDT ---
The problem seems solved with 2.059 Win32.
I can see the errors with or without -g.

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



--- Comment #14 from SomeDude <lovelydear@mailmetrash.com> 2012-06-06 02:43:34 PDT ---
On 2.059 Windows and Linux 32 bit, the problem seems solved. However the (No error) message is uninformative.

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



--- Comment #15 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-06-06 04:21:49 PDT ---
(In reply to comment #13)
> The problem seems solved with 2.059 Win32.
> I can see the errors with or without -g.

I don't think it's solved, the dirEntries function was changed between releases so now it doesn't trigger the bug.

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


Alex Rønne Petersen <alex@lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |alex@lycus.org
         Resolution|                            |WORKSFORME


--- Comment #16 from Alex Rønne Petersen <alex@lycus.org> 2012-07-09 06:55:08 CEST ---
It may not be solved, but I think that keeping a bug open with no up to date repro is pointless. By all means, let's reopen the bug if a repro is found again, but until then, I think it's reasonable to close this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6329


Josh <moonburntm@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |moonburntm@gmail.com
         Resolution|WORKSFORME                  |


--- Comment #17 from Josh <moonburntm@gmail.com> 2013-08-11 22:57:28 PDT ---
See http://forum.dlang.org/thread/xcveobmbnfhzjzfoygpz@forum.dlang.org

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »