digitalmars.D.bugs - [Issue 5206] New: stat_t is not the same as struct stat
- d-bugmail puremagic.com (51/51) Nov 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (31/31) Nov 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (22/22) Dec 30 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (11/11) Jan 03 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (26/28) Jan 31 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (13/13) Jan 31 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (10/10) Feb 01 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (7/7) Feb 01 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (6/6) Apr 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (17/17) Apr 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (7/7) Jun 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (9/9) Jul 25 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (12/13) Jul 25 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (10/10) Oct 09 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (7/8) Oct 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5206
- d-bugmail puremagic.com (9/9) Oct 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5206
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Summary: stat_t is not the same as struct stat Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: Jesse.K.Phillips+D gmail.com CC: Jesse.K.Phillips+D gmail.com 21:34:53 PST --- The structure created by D for stat is not the same size as the one in C, and there appears to be no communication of data between C and D. Assigns a value to st_mode and calls a C function which prints the value and assigns its own. At which point D prints the value (the same one it assigned). Running 32bit Linux. Output: D size: 100 D Assigning 65 C Size: 88 C Found: 0 C Assign: 45 D Found 65 import core.sys.posix.sys.stat; import std.stdio; extern(C) void modStat(stat_t* data); void main() { stat_t stbuf; writeln("D size: ", stbuf.sizeof); writeln("D Assigning ", 65); stbuf.st_mode = 65; modStat(&stbuf); writeln("D Found ", stbuf.st_mode); } --------------- cstat.c #include <sys/stat.h> #include <stdio.h> void modStat(struct stat *stbuf) { struct stat rrr; printf("C Size: %d\n", sizeof(rrr)); printf("C Found: %d\n", stbuf->st_mode); printf("C Assign: %d\n", 45); stbuf->st_mode = 45; } Compiled with: gcc -g -c cstat.c && dmd -gc stat.d cstat.o -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5206 21:48:11 PST --- I did try to compare the Structures, and only one thing came out as being different (after I discovered __USE_FILE_OFFSET64 was supposed to always be set). The struct has a if(false) which seems to have the missing code that I need, and adds quite a bit. http://dsource.org/projects/druntime/browser/trunk/src/core/sys/posix/sys/stat.d?rev=300#L112 This is what stat looks like with some trimming: gcc -E -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -pthread -lfuse -lrt -ldl stat.h struct stat { __dev_t st_dev; unsigned short int __pad1; __ino_t __st_ino; __mode_t st_mode; __nlink_t st_nlink; __uid_t st_uid; __gid_t st_gid; __dev_t st_rdev; unsigned short int __pad2; __off64_t st_size; __blksize_t st_blksize; __blkcnt64_t st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; __ino64_t st_ino; }; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Iain Buclaw <ibuclaw ubuntu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw ubuntu.com This should really be set to true for all glibc systems. However, the current implementation is buggy: timespec st_atim; timespec st_mtim; timespec st_ctim; alias st_atim.tv_sec st_atime; alias st_mtim.tv_sec st_mtime; alias st_ctim.tv_sec st_ctime; The three aliases aren't actually usable, because: Error: struct core.sys.posix.sys.stat.stat_t 'tv_sec' is not a member Error: struct core.sys.posix.sys.stat.stat_t member tv_sec is not accessible Error: this for tv_sec needs to be type timespec not type stat_t Regards -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 30 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Created an attachment (id=859) patch for 5206 Patch against my tree. Updates stat_t for version(linux), adds definition of __WORDSIZE (needs review, probably better to define it on a per-architecture basis), and removes all except the alias to fstat64 in std.file. Can someone pick this up and clean/apply? :) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 03 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Sohgo Takeuchi <sohgo sohgo.dyndns.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sohgo sohgo.dyndns.org PST ---Created an attachment (id=859) [details] patch for 5206I have tested Jesse's patch on FreeBSD 8.1(i386 and amd64) and run his program. The outputs were following. 8.1(i386): D size: 96 D Assigning 65 C Size: 96 C Found: 65 C Assign; 45 D Found 45 8.1(amd64): D size: 120 D Assigning 65 C Size: 120 C Found: 65 C Assign; 45 D Found 45 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 31 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Iain Buclaw <ibuclaw ubuntu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- obsolete| | Created an attachment (id=891) patch for 5206 Note, have since updated stat_t implementation for Linux. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 31 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 00:20:31 PST --- lstat64 is not defined for FreeBSD -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 01 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5206 PST --- As walter says, since lstat64 is not defined for FreeBSD, I have reported at http://d.puremagic.com/issues/show_bug.cgi?id=5512 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 01 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5206 struct_stat64 in std.file is still present and should be removed. :o) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5206 jfanatiker gmx.at changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jfanatiker gmx.at Is someone working on this? If not, I am going to fix it. I happened to implement this struct on my own, because I relied on the online API documentation where lots of C wrappers are not documented, so I did not realized that they exist. Anyway I implemented a simple unit test for my own stat struct which compares the size of the struct in D with the size of the struct in C by means of a simple C function that returns the size of the struct in C. Would there be any problem if I did something like this in the druntime code? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 08 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Fixed. Pull request: https://github.com/D-Programming-Language/druntime/pull/257 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 30 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Commit pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/ccaa0ef2cc6a42f6d03d8072de3721fdf0252fd6 Merge branch 'mergeStat' - fix Issue 5206 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5206 dawg dawgfoto.de changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dawg dawgfoto.de There is a related issue on OSX where the inode size has changed. We currently require -D_DARWIN_NO_64_BIT_INODE when interfacing with C code on=10.6 targets.https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/stat64.2.html -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Alex Rønne Petersen <alex lycus.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alex lycus.org CEST --- Can we close this? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 09 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5206 ---Can we close this?I do believe so yes. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 10 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5206 Alex Rønne Petersen <alex lycus.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 10 2012