Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Catalina Merge #2782

Merged
merged 10 commits into from May 8, 2020
Merged

The Catalina Merge #2782

merged 10 commits into from May 8, 2020

Conversation

millenomi
Copy link
Contributor

This patch brings swift-corelibs-foundation closer to behavior parity with released versions of macOS Catalina and aligned Apple releases. Most of these changes are under-the-hood bug fixes or performance improvements, but a few may affect the behavior of your applications. In particular:

  • The deprecation of NSURL.parameterString is now also effective in Swift for Linux, with similar effects. This brings URL parsing in line with Catalina. Note that Swift for Linux does not support link checks, since there is no binary compatibility guarantee on Linux; this change will be effective to all application code running on Swift for Linux 5.3 or later.

  • Certain CFXML… types that have been deprecated on macOS are now removed, along with their associated implementation: CFXMLInputStream, CFXMLNode, CFXMLParser. Modern code should be using the FoundationXML module (or, on Darwin, the XMLDocument and related classes in Foundation) to parse documents.

This patch brings swift-corelibs-foundation closer to behavior parity with released versions of macOS Catalina and aligned Apple releases. Most of these changes are under-the-hood bug fixes or performance improvements, but a few may affect the behavior of your applications. In particular:

 - The deprecation of NSURL.parameterString is now also effective in Swift for Linux, with similar effects. This brings URL parsing in line with Catalina. Note that Swift for Linux does not support link checks, since there is no binary compatibility guarantee on Linux; this change will be effective to all application code running on Swift for Linux 5.3 or later.

 - Certain CFXML… types that have been deprecated on macOS are now removed, along with their associated implementation: CFXMLInputStream, CFXMLNode, CFXMLParser. Modern code should be using the FoundationXML module (or, on Darwin, the XMLDocument and related classes in Foundation) to parse documents.
@millenomi
Copy link
Contributor Author

@swift-ci please test

@compnerd
Copy link
Collaborator

compnerd commented May 6, 2020

https://dev.azure.com/compnerd/swift-build/_build/results?buildId=31292&view=results for a run on Windows

@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

@swift-ci please test

return NULL;
}
return data->value;
return (CFTypeRef)FlsGetValue(key);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (CFTypeRef)FlsGetValue(key);
return (CFTypeRef)FlsGetValue(key);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen a few like this. Especially wrt the implementation of TSDs on Windows, @compnerd, let me know if it looks bad?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mental map of The Whole Of Foundation gets a little murky around the Windows bits.

static bool warnonce = false; \
if (!warnonce) { \
warnonce = true; \
CFLog(kCFLogLevelWarning, CFSTR("*** %@: Range {%lu, %lu} out of bounds; string length %lu. This will become an exception for apps linked after 10.10 and iOS 8. Warning shown once per app execution."), __CFExceptionProem((id)self, _cmd), (unsigned long)range.location, (unsigned long)range.length, (unsigned long)len); \
} \
}
} while(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the indentation is off here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna note these down and work on them later, for internal back-and-forth merging reasons.

@millenomi
Copy link
Contributor Author

@swift-ci please test

2 similar comments
@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

@swift-ci please test

Copy link
Collaborator

@xwu xwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more nits.

CFDictionarySetValue(objects, (const void *)(uintptr_t)startOffset, *plist);
}
return (*plist) ? true : false;
if (outPlistTypeID) *outPlistTypeID = _kCFRuntimeIDCFNumber;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation appears off here and below.

CFDictionarySetValue(objects, (const void *)(uintptr_t)startOffset, *plist);
}
return (*plist) ? true : false;
if (outPlistTypeID) *outPlistTypeID = _kCFRuntimeIDCFNumber;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: likewise indentation appears off here and below, and it appears pervasively throughout the rest of the file.

}
} else {
//#warning CF: should create a no-copy data here that has a custom VM-freeing allocator, and not vm_dealloc here
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation consistency problem here also, it appears.


if (timers) CFRelease(timers);

if (timers) CFRelease(timers);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (timers) CFRelease(timers);
if (timers) CFRelease(timers);

@@ -6420,7 +6495,7 @@ reswtch:switch (ch) {
if (spec->size != CFFormatSize16) spec->size = CFFormatSize8;
return true;
case 'n': /* %n is not handled correctly; for Leopard or newer apps, we disable it further */
spec->type = 1 ? CFFormatDummyPointerType : CFFormatPointerType;
spec->type = CFFormatDummyPointerType;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
spec->type = CFFormatDummyPointerType;
spec->type = CFFormatDummyPointerType;

//
// 👩 ❤ Var_Sel 💋 👨
// ┌──────────┐│┌───────┐┌─────┐┌──────┐┌──────┐┌─────┐┌───────┐┌─────┐┌───────┐│┌──────────┐
// │ stuff... │ │ 1F469 ││ ZWJ ││ 2764 ││ FE0F ││ ZWJ ││ 1F48B ││ ZWJ ││ 1F468 │ │ stuff... │
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These diagrams are fantastic!

@@ -607,6 +607,7 @@ static const _CFEncodingConverter *__CFGetConverter(uint32_t encoding) {
#warning This case must match __defaultEncoding value defined in CFString.c
case kCFStringEncodingISOLatin1: commonConverterSlot = (const _CFEncodingConverter **)(&(commonConverters[1])); break;
#endif
case kCFStringEncodingInvalidId: return NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: space-tab mismatch here.

@@ -3756,7 +3715,7 @@ static Boolean decomposeToRFC1808(CFURLRef url, CFURLComponentsRFC1808 *componen
} else {
components->port = kCFNotFound;
}
components->parameterString = _retainedComponentString(url, HAS_PARAMETERS, false, false);
components->parameterString = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
components->parameterString = NULL;
components->parameterString = NULL;

@@ -629,7 +629,9 @@ static Boolean _CFDataURLCreateDataAndPropertiesFromResource(CFAllocatorRef allo
if (! parseDataRequestURL(url, &data, &mimeType, &textEncodingName)) {
if (errorCode)
*errorCode = kCFURLUnknownError;
*fetchedData = NULL;
if (fetchedData) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: space-tab mismatch here.

@millenomi
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

The patch passes on Linux and Mac but breaks the Windows build; there will be some iteration.

@lxbndr
Copy link
Contributor

lxbndr commented May 7, 2020

This reverts #2764. I'm afraid NotificationQueue could be affected n Windows, as well as Operation/OperationQueue.

@millenomi
Copy link
Contributor Author

Thank you for catching that. I’ll un-revert.

@xwu
Copy link
Collaborator

xwu commented May 7, 2020

For ease of reviewing, would it be possible to commit the ICU upgrade separately? It would at least make the GitHub interface slightly more usable.

@millenomi
Copy link
Contributor Author

I haven't tested the ICU upgrade with the previous version of the code, and I don't know that I want to put in the time to do that.

I understand this is a large patch, but extricating it would add more to what has been so far already ~1 work-hours-month-person of work that I need to coordinate with some expedition, and I'd rather not unless the need is really strong.

@millenomi
Copy link
Contributor Author

(The ICU parts are showing collapsed for me? I'm not sure how their presence impacts usability. While you can review them, I'm not going to modify them: this is just a straight import of the headers generated by compiling Apple ICU from https://opensource.apple.com/source/ICU/ICU-64252.0.1/.)

@millenomi
Copy link
Contributor Author

@swift-ci please test

@xwu
Copy link
Collaborator

xwu commented May 7, 2020

@millenomi Yeah, I mention this thought precisely because there is no point in reviewing the ICU parts. Having not interfaced with the library extensively myself, I don't have a sense of its forward compatibility guarantees. If it's essentially a drop-in replacement, then perhaps there's some net benefit to doing that separately. If it's much more involved than that, then there's certainly no point in extricating it.

@millenomi
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

I'm going to avoid starting tests when I'm doing Windows runs.

@millenomi
Copy link
Contributor Author

…operands because the compiler runtime may not have an implementation.
@millenomi
Copy link
Contributor Author

This one needs a test.

@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

@millenomi
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi
Copy link
Contributor Author

This is going to be merged today barring last-minute objections.

@xwu
Copy link
Collaborator

xwu commented May 8, 2020

Last minute objection: Unless I misread, I think your fix is still not quite right after the amendment. The wrapper function inverts the logic of os_mul_overflow, but on non-Win32 platforms is an alias of os_mul_overflow.

Never mind, saw the == 0 on scrolling right. Ignore me!

@millenomi
Copy link
Contributor Author

Thanks for checking!

@millenomi
Copy link
Contributor Author

Merging this.

@millenomi millenomi merged commit 42bfad4 into apple:master May 8, 2020
3405691582 added a commit to 3405691582/swift-corelibs-foundation that referenced this pull request May 11, 2020
PR apple#2782 references symbol __kCFAllocatorTypeID_CONST in CFRuntime.c but
this was removed in apple#1708. After interpreting the commit, it looks like
this symbol was renamed to _kCFRuntimeIDCFAllocator. Therefore, make
this rename again.
@finagolfin
Copy link
Contributor

Looks like this broke the linux CI, because of this line:

swift-corelibs-foundation/CoreFoundation/String.subproj/CFString.c:3552:100: error: use of undeclared identifier 'UCHAR_EMOJI_MODIFIER'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants