Thread overview
[Issue 10463] New: dirEntries() segfaults on paths the user does not have access to
Jun 24, 2013
Kevin L
Jun 27, 2013
Nils
Jul 03, 2013
Nils
June 24, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10463

           Summary: dirEntries() segfaults on paths the user does not have
                    access to
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: kevin.lamonte@gmail.com


--- Comment #0 from Kevin L <kevin.lamonte@gmail.com> 2013-06-24 06:36:07 PDT ---
Code to reproduce:

----
import std.stdio;
import std.file;

void main(string [] args) {
    string path = args[1];
    stdout.writefln("Iterating directory: %s", path);

    foreach (string name; dirEntries(path, SpanMode.shallow)) {
    stdout.writefln("%s", name);
    }
}
----

Good execution:

$ rdmd test.d /home
Iterating directory: /home
/home/lost+found
/home/kevinl

Bad execution:

$ rdmd test.d /home/lost+found
Iterating directory: /home/lost+found
Segmentation fault (core dumped)

gdb backtrace:

$ dmd test.d
$ gdb test
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/kevinl/code/d-tui/test...(no debugging symbols
found)...done.
(gdb) set args /home/lost+found
(gdb) ru
Starting program: /home/kevinl/code/d-tui/test /home/lost+found
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Iterating directory: /home/lost+found

Program received signal SIGSEGV, Segmentation fault.
0x0000000000465805 in
std.typecons.__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z.RefCounted.__dtor()
()
(gdb) bt
#0  0x0000000000465805 in
std.typecons.__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z.RefCounted.__dtor()
()
#1  0x00007ffff7fd38c0 in ?? ()
#2  0x00007fffffffd8f0 in ?? ()
#3  0x00000000004658ed in std.file.DirIterator.__fieldDtor() ()
#4  0x0000000000470300 in ?? ()
#5  0x00007fffffffdeb0 in ?? ()
#6  0x00000000004540b3 in D main ()
#7  0x00007fffffffda50 in ?? ()
#8  0x00007fffffffdd10 in ?? ()
#9  0x0000000000460bc2 in _d_throwc ()
#10 0x00007fffffffe020 in ?? ()
#11 0x00007fffffffe070 in ?? ()
#12 0x00000000006d8da0 in ?? ()
#13 0x00007fffffffdd10 in ?? ()
#14 0x0000000000000002 in ?? ()
#15 0x00007fffffffdeb0 in ?? ()
#16 0x0000000000454020 in D main ()
#17 0x00007fffffffd958 in ?? ()
#18 0x00007fffffffdeb0 in ?? ()
#19 0x000000000049cb30 in _TMP296 ()
#20 0x000000000069e3f0 in __dso_handle ()
#21 0x0000000000453f80 in frame_dummy ()
#22 0x0000000000000001 in ?? ()
#23 0x000000000069e400 in _HandlerTable0 ()
#24 0x000000000069e418 in _HandlerTable0 ()
#25 0x00007ffff7fd38c0 in ?? ()
#26 0x0000000000000000 in ?? ()

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


Nils <nilsbossung@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nilsbossung@googlemail.com
         Depends on|10475                       |8563


--- Comment #1 from Nils <nilsbossung@googlemail.com> 2013-06-26 19:11:54 PDT ---
Marking as depending on 8563 instead of being a duplicate, because this is a phobos bug that may be fixable by working around the dmd issue.

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


Nils <nilsbossung@googlemail.com> changed:

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


--- Comment #2 from Nils <nilsbossung@googlemail.com> 2013-07-03 07:33:37 PDT ---
Issue 8563 is fixed. The test case of this issue now throws a nice "Permission denied" exception. Closing.

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