-
Notifications
You must be signed in to change notification settings - Fork 3
chore: use slim binary over dylib #210
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
base: ethan/xpc-validation
Are you sure you want to change the base?
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
7ef8131
to
8f00c6a
Compare
547fd97
to
6687411
Compare
8f00c6a
to
479576a
Compare
@@ -69,7 +69,7 @@ actor Receiver<RecvMsg: Message> { | |||
}, | |||
onCancel: { | |||
self.logger.debug("async stream canceled") | |||
self.dispatch.close() | |||
self.dispatch.close(flags: [.stop]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes any currently running dispatch.read
calls to supply their callback with an error which lets us actually end the read loop and cause the manager and all of it's children to be deallocated, including pipe file descriptors.
Previously we would leak pipes, but it didn't matter because the process would die each time.
private static func validateInfo(infoPlist: [String: AnyObject], expectedVersion: String) throws(ValidationError) { | ||
guard let plistIdent = infoPlist[infoIdentifierKey] as? String, plistIdent == expectedIdentifier else { | ||
throw .invalidIdentifier(identifier: infoPlist[infoIdentifierKey] as? String) | ||
} | ||
|
||
guard let plistName = infoPlist[infoNameKey] as? String, plistName == expectedName else { | ||
throw .invalidIdentifier(identifier: infoPlist[infoNameKey] as? String) | ||
} | ||
|
||
// Downloaded dylib must match the version of the server | ||
guard let dylibVersion = infoPlist[infoShortVersionKey] as? String, | ||
expectedVersion == dylibVersion | ||
else { | ||
throw .invalidVersion(version: infoPlist[infoShortVersionKey] as? String) | ||
} | ||
|
||
// Downloaded dylib must be at least the minimum Coder server version | ||
guard let dylibVersion = infoPlist[infoShortVersionKey] as? String, | ||
// x.compare(y) is .orderedDescending if x > y | ||
minimumCoderVersion.compare(dylibVersion, options: .numeric) != .orderedDescending | ||
else { | ||
throw .belowMinimumCoderVersion | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunate, but because we don't build the slim binary with an external linker (previously xcode via cgo for the dylib) we can no longer create an info.plist section in the binary with -sectcreate
. If we ever need to build the slim binary with cgo then we can add this back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add another PR to check the version by exec'ing.
6687411
to
ef370db
Compare
479576a
to
e9e15db
Compare
Closes #201.
This PR:
TunnelHandle
withTunnelDaemon
, an abstraction which runsposix_spawn
on the slim binary, and manages the spawned process.TunnelDaemon
.In a future PR: