Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

libsystem_c.dylib: Assertion failed: (p->val == key), function lookup_substsearch, file collate.c, line 596.

At least with macOS Sequoia 15.5 and Xcode 16.3:

$ cat test.cc
#include <locale.h>
#include <string.h>
#include <xlocale.h>
int main(void) {
    locale_t l = newlocale(LC_ALL_MASK, "el_GR.UTF-8", 0);
    strxfrm_l(NULL, "ό", 0, l);
    return 0;
}
$ c99 test.c && ./a.out
Assertion failed: (p->val == key), function lookup_substsearch, file collate.c, line 596.
Abort trap: 6
Answered by DTS Engineer in 840858022

Hmmmm, you’re tripping the assert on this line.

Honestly, I don’t know enough about the standard C library internationalisation APIs to say whether what you’re doing makes sense (most code for Apple platforms uses Foundation for internationalisation). However, I’m pretty sure this code shouldn’t be trapping, and thus I encourage you to file a bug about this.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hmmmm, you’re tripping the assert on this line.

Honestly, I don’t know enough about the standard C library internationalisation APIs to say whether what you’re doing makes sense (most code for Apple platforms uses Foundation for internationalisation). However, I’m pretty sure this code shouldn’t be trapping, and thus I encourage you to file a bug about this.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks, I filed FB17723558 now.

I work on supporting the Perl5 programming language. We've gotten reports with this failure. I can add that this bug seems to have been introduced sometime in MacOS 15. Our response has been to turn off locale collation support on any MacOS 15, and higher. That means that collation always uses the C locale built-in rules, skipping the broken Apple code.

Thanks for filing this report. I've grown cynical about Apple's commitment to fixing their bugs. The fact that when I click on the link about your ticket, and get "Feedback Not Found" only increases that cynicism.

The cynicism started with our reporting 10 years ago that /usr/share/locale/zh_CN.GB18030/LC_COLLATE is a broken link, and that report has not resulted in any fix, though the fix is trivial.

I have read the Apple libc implementation of locales. It appears to have been taken 20 years ago from FreeBSD, and not updated to include the FreeBSD fixes that have been made since. As a result, querylocale() has races, nl_langinfo() is broken, as is the POSIX 2008 LC_NUMERIC handling (See https://github.com/Perl/perl5/issues/21556). Apple's implementation of locales is the worst of any major OS. We've had to cripple our normal support for locales when running on Darwin.

libsystem_c.dylib: Assertion failed: (p-&gt;val == key), function lookup_substsearch, file collate.c, line 596.
 
 
Q