www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11392] New: dirEntries segfaults (fails in 2.064 beta 4, works in 2.063.2)

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

           Summary: dirEntries segfaults (fails in 2.064 beta 4, works in
                    2.063.2)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: thelastmammoth gmail.com


--- Comment #0 from thelastmammoth gmail.com 2013-10-30 17:57:09 PDT ---
Note: only tried on OSX

2.064 beta 4:
dmd -run main.d
--- killed by signal 11



2.063.2:works

---
import std.file;
void main(){
  auto dFiles = dirEntries(".",SpanMode.shallow);
  foreach(d; dFiles){}
}

---

running under lldb:
* thread #1: tid = 0x1c03, 0x000000010002b1d5 test2
D3std4file15DirIteratorImpl4nextMFZb + 297, stop reason = EXC_BAD_ACCESS
(code=1, address=0x0)
    frame #0: 0x000000010002b1d5 test2 D3std4file15DirIteratorImpl4nextMFZb +
297
    frame #1: 0x000000010002b08b test2
D3std4file15DirIteratorImpl6stepInMFAyaZb + 159
    frame #2: 0x000000010002b3b3 test2
D3std4file15DirIteratorImpl6__ctorMFNcAyaE3std4file8SpanModebZS3std4file15DirIteratorImpl
+ 127
    frame #3: 0x000000010002198e test2
D3std4conv66__T7emplaceTS3std4file15DirIteratorImplTAyaTE3std4file8SpanModeTbZ7emplaceFPS3std4file15DirIteratorImplKAyaKE3std4file8SpanModeKbZPS3std4file15DirIteratorImpl
+ 70
    frame #4: 0x00000001000390dc test2
D3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted15RefCountedStore42__T10initializeTAyaTE3std4file8SpanModeTbZ10initializeMFKAyaKE3std4file8SpanModeKbZv
+ 128
    frame #5: 0x0000000100039051 test2
D3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted37__T6__ctorTAyaTE3std4file8SpanModeTbZ6__ctorMFNcKAyaKE3std4file8SpanModeKbZS3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted
+ 17
    frame #6: 0x000000010002c3e6 test2
D3std4file11DirIterator6__ctorMFNcAyaE3std4file8SpanModebZS3std4file11DirIterator
+ 50
    frame #7: 0x000000010002c825 test2
D3std4file10dirEntriesFAyaE3std4file8SpanModebZS3std4file11DirIterator + 57

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


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com


--- Comment #1 from monarchdodra gmail.com 2013-10-31 02:00:09 PDT ---
I was not able to reproduce on linux64, on any of beta 1, 3 or 4.

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



--- Comment #2 from monarchdodra gmail.com 2013-10-31 02:09:43 PDT ---
I was not able to reproduce on win32 either.

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



--- Comment #3 from thelastmammoth gmail.com 2013-10-31 02:39:47 PDT ---
well that would explain why it would've gone un-noticed...
can anyone verify on OSX?

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


safety0ff.bugz <safety0ff.bugz gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz gmail.com


--- Comment #4 from safety0ff.bugz <safety0ff.bugz gmail.com> 2013-10-31
03:31:28 PDT ---
Maybe my PR https://github.com/D-Programming-Language/phobos/pull/1657 changed
the test that might have caught it.
I looked at the reports which lead to those tests and the directory string did
not look relevant.

In retrospect, I should have used something like:
auto cwd = getcwd();
chdir(testdir);
scope(exit) chdir(cwd);

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
           Platform|All                         |x86_64
         OS/Version|All                         |Mac OS X


--- Comment #5 from Walter Bright <bugzilla digitalmars.com> 2013-10-31
22:36:59 PDT ---
I can confirm this seg faults on OSX, 64 bits only.

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



--- Comment #6 from thelastmammoth gmail.com 2013-11-01 01:37:47 PDT ---
(In reply to comment #5)
 I can confirm this seg faults on OSX, 64 bits only.
how come this kind of obvious bug (not due to any obscure usage condition, just on plain function usage) can go through the autotester unnoticed ? is that due to https://github.com/D-Programming-Language/phobos/pull/1657 ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11392



--- Comment #7 from monarchdodra gmail.com 2013-11-01 03:59:42 PDT ---
(In reply to comment #6)
 (In reply to comment #5)
 I can confirm this seg faults on OSX, 64 bits only.
how come this kind of obvious bug (not due to any obscure usage condition, just on plain function usage) can go through the autotester unnoticed ? is that due to https://github.com/D-Programming-Language/phobos/pull/1657 ?
Only one way to find out: https://github.com/D-Programming-Language/phobos/pull/1677 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11392



--- Comment #8 from safety0ff.bugz <safety0ff.bugz gmail.com> 2013-11-01
04:40:09 PDT ---
(In reply to comment #7)
 Only one way to find out:
 https://github.com/D-Programming-Language/phobos/pull/1677
I just did the same, both test show that it would not have been caught with or without the changes to the test. Anyways, as I stated before, in retrospect, I should have used: auto cwd = getcwd(); chdir(testdir); scope(exit) chdir(cwd); and left the actual tests alone. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11392



--- Comment #9 from Walter Bright <bugzilla digitalmars.com> 2013-11-01
23:57:47 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2704

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



--- Comment #10 from Walter Bright <bugzilla digitalmars.com> 2013-11-02
00:05:19 PDT ---
https://github.com/D-Programming-Language/phobos/pull/1680

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



--- Comment #11 from github-bugzilla puremagic.com 2013-11-03 06:37:12 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/fe9a3537ea2d208f3d5e37f6a2ea6e50f00aadd2
fix Issue 11392 - dirEntries segfaults

https://github.com/D-Programming-Language/phobos/commit/2a0d3d63954ed31d585708a41394e46115f9007d
Merge pull request #1680 from WalterBright/fix11392

fix Issue 11392 - dirEntries segfaults

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



--- Comment #12 from github-bugzilla puremagic.com 2013-11-03 11:16:39 PST ---
Commit pushed to 2.064 at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/3fe0703932d7b2486ec838045dd76322f1b54026
Merge pull request #1680 from WalterBright/fix11392

fix Issue 11392 - dirEntries segfaults

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #13 from Walter Bright <bugzilla digitalmars.com> 2013-11-03
11:18:40 PST ---
This was fixed by:

https://github.com/D-Programming-Language/dmd/pull/2701

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