Bug 11392 – dirEntries segfaults (fails in 2.064 beta 4, works in 2.063.2)

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2013-10-30T17:57:00Z
Last change time
2013-11-03T11:18:40Z
Assigned to
nobody
Creator
thelastmammoth

Comments

Comment #0 by thelastmammoth — 2013-10-30T17:57:09Z
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
Comment #1 by monarchdodra — 2013-10-31T02:00:09Z
I was not able to reproduce on linux64, on any of beta 1, 3 or 4.
Comment #2 by monarchdodra — 2013-10-31T02:09:43Z
I was not able to reproduce on win32 either.
Comment #3 by thelastmammoth — 2013-10-31T02:39:47Z
well that would explain why it would've gone un-noticed... can anyone verify on OSX?
Comment #4 by safety0ff.bugz — 2013-10-31T03:31:28Z
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);
Comment #5 by bugzilla — 2013-10-31T22:36:59Z
I can confirm this seg faults on OSX, 64 bits only.
Comment #6 by thelastmammoth — 2013-11-01T01:37:47Z
(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 ?
Comment #7 by monarchdodra — 2013-11-01T03:59:42Z
(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
Comment #8 by safety0ff.bugz — 2013-11-01T04:40:09Z
(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.
Comment #9 by bugzilla — 2013-11-01T23:57:47Z
Comment #10 by bugzilla — 2013-11-02T00:05:19Z
Comment #11 by github-bugzilla — 2013-11-03T06:37:12Z
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
Comment #12 by github-bugzilla — 2013-11-03T11:16:39Z
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
Comment #13 by bugzilla — 2013-11-03T11:18:40Z