www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6790] New: buildPath using std.path.curdir segfaults

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790

           Summary: buildPath using std.path.curdir segfaults
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: jonathansternberg gmail.com


--- Comment #0 from Jonathan Sternberg <jonathansternberg gmail.com> 2011-10-07
21:37:46 PDT ---
I am using the dmd compiler and phobos library at version 2.055. This is on
Linux Mint 11 with x86 architecture. To repeat the bug is a bit weird. It seems
to only happen when using std.path.curdir, and only when not in the main
module. The following will NOT produce the error:

import std.path; import std.stdio;
int main() {
writeln(buildPath(curdir, "a.out"));
return 0;
}

This WILL produce the error:

-- main.d
static import foobar;
int main() {
foobar.crash();
return 0;
}

-- foobar.d
module foobar;
import std.path; import std.stdio;
void crash() {
writeln(buildPath(curdir, "a.out"));
}

Compiling and running this results in a segfault. No idea why.

Workaround that seems to work is to use std.path.curdir.idup instead.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 07 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790



--- Comment #1 from Jonathan Sternberg <jonathansternberg gmail.com> 2011-11-10
16:18:31 PST ---
As of dmd 2.056, this now throws "core.exception.OutOfMemoryError". No
recompilation was needed, but recompilation resulted in the same thing.

This is probably some error in druntime.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 10 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla kyllingen.net


--- Comment #2 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2011-11-28
15:14:39 PST ---
I am using the latest revisions of DMD, druntime and Phobos, and I can't
reproduce this.

curdir is a string enum, and the only thing that happens to it in buildPath is
the following:

    return cast(string)(curdir ~ dirSeparator ~ "a.out");

This should be perfectly OK, as concatenation always allocates a new string. 
Therefore, I agree with Jacob that it is/was a bug in druntime, or perhaps DMD,
but it seems to have been fixed now.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790



--- Comment #3 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2011-11-28
15:21:19 PST ---
(In reply to comment #2)
 Therefore, I agree with Jacob [...]
Why on earth did I say Jacob? :) I meant Jonathan, of course. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 28 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790



--- Comment #4 from Jonathan Sternberg <jonathansternberg gmail.com> 2011-11-28
19:53:11 PST ---
Lars, for completeness, can you give your OS/architecture? As I said, it still
happens on x86 Linux for me.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790



--- Comment #5 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2011-11-29
13:15:35 PST ---
I am on 64-bits Ubuntu Linux.  However, I have tried compiling the entire
toolchain (DMD, druntime and Phobos, all fresh from the Github repositories)
with -m32, and used it to compile your test case, and I still can't reproduce
it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 29 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790



--- Comment #6 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2012-02-01
14:41:35 PST ---
Have you tried this with DMD 2.057, and if so, are you still experiencing the
same problem?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790


SomeDude <lovelydear mailmetrash.com> changed:

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


--- Comment #7 from SomeDude <lovelydear mailmetrash.com> 2012-04-19 07:37:35
PDT ---
I think this one should be closed as "Can't reproduce". We'll reopen it if it
happens again.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6790


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

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


--- Comment #8 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2012-04-19
08:14:23 PDT ---
I agree.

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