digitalmars.D.bugs - [Issue 1635] New: DirEntry.isfile() and DirEntry.isdir() broken
- d-bugmail puremagic.com (27/27) Nov 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1635
- d-bugmail puremagic.com (13/13) Nov 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1635
- d-bugmail puremagic.com (16/16) Nov 04 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1635
- d-bugmail puremagic.com (6/6) Nov 04 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1635
- d-bugmail puremagic.com (7/7) Oct 07 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1635
- d-bugmail puremagic.com (10/10) Oct 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1635
- d-bugmail puremagic.com (11/11) Sep 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=1635
- d-bugmail puremagic.com (19/19) Sep 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=1635
http://d.puremagic.com/issues/show_bug.cgi?id=1635 Summary: DirEntry.isfile() and DirEntry.isdir() broken Product: D Version: 1.023 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: aarti interia.pl On my linux system following code gives for any filesystem point: 0 0 result. At least on linux DirEntry can not distinguish between file and directory. ----------------- import std.stdio; import std.file; void main(char[][] args) { bool callback(DirEntry* de) { writef(de.isfile, " ", de.isdir); return true; } listdir(args[1], &callback); } --
Nov 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1635 braddr puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bugzilla digitalmars.com |aarti interia.pl I can't reproduce this on my linux system. I'm going to need more information to be able to do anything with this report. I suggest copying the code from std/file.d into your test app (ie, create a standalone test case that doesn't need any (or at least fewer) imports). Add some debug code to inspect the data closer. Make sense? --
Nov 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1635 After some researching it seems that in this structure (from import std.c.linux.linux): struct dirent { uint d_ino; // this is int on some linuxes off_t d_off; ushort d_reclen; ubyte d_type; // this field isn't there on some linuxes char[256] d_name; } field d_type is not set by readdir method. In the same time isdir & isfile free functions works properly. I have fresh installation of Ubuntu Gutsy 7.10. --
Nov 04 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1635 Created an attachment (id=201) --> (http://d.puremagic.com/issues/attachment.cgi?id=201&action=view) test file with only few functions from std.file --
Nov 04 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1635 Same problem here. The readdir docs say that the dirent.d_type field is a bsd extension, not part of the posix standard. The standalone isdir() and isfile() functions use stat, so they are fine (but more costly.) This also breaks DirEntries in 2.0 and functions depending on it. --
Oct 07 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1635 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|aarti interia.pl |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1635 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |WORKSFORME 17:39:04 PDT --- Can't reproduce. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1635 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com PDT --- to set its file type, and if you'll look at the man page for readdir, it specifically says that d_type is not supported by all file system types. DirEntry really should be using stat if d_type wasn't set properly. My patch in was set correctly, it uses stat instead of d_type if d_type is DT_UNKNOWN. The only place that I'm sure that I've run into this problem (and consistently) is with /usr/share/zoneinfo, but I think that it's very nature makes it so that it's only going to fail under certain types of situations or on certain types of systems. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2010