www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10463] New: dirEntries() segfaults on paths the user does not have access to

reply d-bugmail puremagic.com writes:
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



---
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

std.typecons.__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z.RefCounted.__dtor()
()



























-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013
next sibling parent d-bugmail puremagic.com writes:
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



---
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: -------
Jun 26 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10463


Nils <nilsbossung googlemail.com> changed:

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



---
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: -------
Jul 03 2013