[Sbcl-devel] Patch for the sb-posix:stat issue on Mac OS X 10.6 Snow Leopard

21 views
Skip to first unread message

Kei Suzuki

unread,
Nov 28, 2009, 7:47:52 PM11/28/09
to sbcl-...@lists.sourceforge.net
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

sb-posix-stat.diff

Kei Suzuki

unread,
Nov 29, 2009, 3:33:51 AM11/29/09
to sbcl-...@lists.sourceforge.net
Oops. I forgot about the 10.4 x86-64 case.
Here is a new patch. Introduced a new feature keyword :inode64.

--
Kei Suzuki

sb-posix-stat.diff

Cyrus Harmon

unread,
Jan 23, 2010, 3:03:11 PM1/23/10
to Kei Suzuki, sbcl-...@lists.sourceforge.net
Hi Kei,

Thanks for sending this patch. It was applied as 1.0.34.9. Sorry for the delay in getting this in the tree.

Cyrus

> <sb-posix-stat.diff>------------------------------------------------------------------------------
> 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-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sbcl-devel


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Sbcl-devel mailing list
Sbcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel

Reply all
Reply to author
Forward
0 new messages