29 Nov 01:47
Patch for the sb-posix:stat issue on Mac OS X 10.6 Snow Leopard
Kei Suzuki <ksdevx <at> gmail.com>
2009-11-29 00:47:52 GMT
2009-11-29 00:47:52 GMT
Dear SBCL developers, Currently 421779 'sb-posix tests fail on snow leopard (mac os 10.6)' is sitting in the bug database as a new bug, and I see a similar failure when I compile 1.0.32 on my Snow Leopard and wanted to figure out why. The gist of the cause is this; from Mac 10.5 a new stat structure with the 64bit inode is introduced. A new set of stat functions - stat$INODE64, lstat$INODE64, and fstat$INODE64 - is also introduced to support the new stat structure. But the new structure is not used as 'the stat structure' by default unless you explicitly specify a flag like -D_DARWIN_USE_64_BIT_INODE. From Mac 10.6, however, it's flipped. The default arch type is now x86-64 and the new structure is used as 'the stat structure' unless you specify a flag to request the old stat, such as -D_DARWIN_NO_64_BIT_INODE. So when you want to use the old stat on 10.5 and 10.6, one way is to specify '-mmacosx-version-min=10.4' and call the old stat functions. Likewise, when you want to use the new stat, specify '-mmacosx-version-min=10.5' and '-D_DARWIN_USE_64_BIT_INODE' and then call the new stat functions. The current build scripts and the code, however, don't conform the rule; a) all of the src/runtime/Config files for Mac define '-mmacosx-version-min=10.4' only. This affects tools-for-build/grovel-headers.c and src/code/unix.lisp which defines sb-unix:unix-stat, b) in contrib/sb-grovel/def-to-lisp.lisp neither min version is specified. It affects contrib/sb-posix/constants.lisp for generating alien-stat that is used to convert C stat to Lisp stat, c) in contrib/sb-posix/interface.lisp the new stat function calls are not taken care of, and d) tools-for-build/ldso-stubs.lisp doesn't have the stub entries for the new stat functions. Eventually when SBCL is built (wether x86 or x86-64 doesn't matter), sb-unix:unix-stat works but never returns the 64bit inode, and sb-posix:stat gets wrong stat value when compiled on Snow Leopard because alien-stat then expects the new stat structure but what's returned from the C stat call is the old stat structure. The patch attached addresses these issues and fixes them so 1) sb-unix:unix-stat/lstat/fstat return the 32bit inode with x86 and the 64bit inode with x86-64, 2) sb-posix:stat/lstat/fstat get stat values using the old stat calls with x86 and the new ones with x86-64, and 3) bunch of the sb-posix stat tests that didn't pass before (and so are disabled) now do. Diff was made against the commit d8e47f8f2ccda542b1ab60b080ebed483ae14376 (version 1.0.32.37). It's tested on my Snow Leopard only. Hope this helps. Regards, -- -- Kei Suzuki
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Sbcl-devel mailing list Sbcl-devel <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sbcl-devel
RSS Feed