[Issue 3848] functions in std.file don't take symbolic links into account

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 2 23:39:08 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3848


Jonathan M Davis <jmdavisProg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #573 is|0                           |1
           obsolete|                            |


--- Comment #8 from Jonathan M Davis <jmdavisProg at gmail.com> 2010-03-02 23:39:06 PST ---
Created an attachment (id=577)
Now fixes DirIterator and listdir() as well.

I don't know anything about the whole reading from disk reading from disk cache
thing, but it's still I/O of some variety and, as I understand it, is not a
cheap operation, so it's desirable to avoid extraneous stat and lstat calls
regardless.

Also, I figured out that DirIterator and listdir() did not deal with symlinks
correctly. In particular, they always followed them, which could be very bad in
some situations. So, I'm attaching another version which fixes that problem. It
also makes DirEntry on Linux a bit better. It occurred to me that we might as
well just save the result from stat rather than copying some of its values to
member variables to be used for the properties. That way, we can make the
resulting struct available. It makes the DirEntry struct a bit larger, but it
seems useful enough to me that it should be worth it. However, I didn't add any
more of stat's properties (like inode or block size) to DirEntry since those
are likely used rarely enough that the programmer can just access the stat
struct in such cases. That and it allows DirEntry's API to be mostly the same
between platforms.

As far as I've determined, this fix works on Linux (certainly, all of the unit
tests pass, and all of the other testing that I've done looks good), but I
haven't tested the Windows code at all. Most of the changes are to the Posix
side though, so odds are that the Windows side is okay.

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


More information about the Digitalmars-d-bugs mailing list