#include <stdio.h>
#include <sstream>
int
main(int ac, char **av)
{
std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > x;
x << "How now brown cow";
return 0;
}
If I build this on macOS 12, and try to run the binary on macOS 11, it fails because that symbol is not present in /usr/lib/libc++.1.dylib. If I compile it on macOS 11, and run on 11 or later, it works.
Is this correct behaviour? Since the dylib version didn't change, I would expect that to mean no ABI changes.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
To begin with: I know it's my code, because if I go back to our main branch and try it, I don't get this crash. But I can't figure out what it's unhappy about, so I'm not sure what changes I have to look for. (Also, this is macOS.)
The daemon tries to communicate with a Network Extension over XPC. I have a class, with a shared instance, and I have a cached NSXPCConnection connection instance variable. So my code is something like id connection = [[ExtensionCommunication shared] connection], which is created by [[NSXPCConnection alloc] initWithMachServiceName:self.redirectorMachServiceName options:0].
With my changes (whatever they are), when it does [_connection resume], it crashes:
* frame #0: 0x00007ff8191ab20e libxpc.dylib`_xpc_api_misuse + 117
frame #1: 0x00007ff8191963a1 libxpc.dylib`xpc_connection_resume + 54
This happens whether the network extension is activated or not. The crash happens the second time this is called. (Hm, one thing I need to figure out then is why my cached connection object is being set to nil. It shouldn't be. hm.)
Anyway! Any suggestions on how I can try to debug this?
If I use NWConnection for a UDP connection, is there a way to get the peer name? Since it's not a stream, data can theoretically come from anywhere; at the C level, I'd use recvfrom which would tell me the remote address.
I'm likely to be missing something obvious to everyone but me, I do have a tendency to look at problems as C problems. 😄
Coworkers are trying it and it's not working -- the google response says there was a problem with it, and not much else.
I do not have a yubikey (at least not yet 😄), and I'm really not good at the GUI stuff so I don't know as much about it as I probably should. Searching the fora here found a question and comment that didn't make a lot of sense to me, but again I admit to a lot of ignorance here.
So any pointers to where I should be look would be appreciated.
Playing with EventKit, I wanted to test requesting access. Which I did once. Yay.
Now it's stuck in System Settings... and I don't know how to reset it. (This is on Ventura.)
I just wrote code for our app to use ASWebAuthenticationSession for 3rd-party authentication (in particular, YUBIKEYS WOOHOO). Our app registers a URI scheme of x-com-kithrup for launch services events, so I used x-com-kithrup-yubi for ASWebAUthenticationSession.
Only, I didn't change the back end, so it still redirects to x-com-kithrup://success on a successful login. And... ASWebAuthenticationSession is still calling the handler when it gets a URL with the x-com-kithrup URI, instead of the x-com-kithrup-yubi URI scheme.
Is it actually usable as a fireawall in macOS? I tried (as an example) adding a rule to block port 80, and it did not seem to work. But, that's all I tried -- just added a line to /etc/pf.conf
Our project uses CMake, which generates a .xcodeproj bundle. Our project has an existing network extension (Transparent Proxy Provider); I'm trying to add a second one, which is a packet filter. Xcode is extremely unhappy:
error: Multiple commands produce '/Build/mybuild/Entitlements.plist'
note: Target 'PacketFilter' (project 'project') has write command with output /Build/mybuild/Entitlements.plist
note: Target 'ProxyProvier' (project 'project') has write command with output /Build/mybuild/Entitlements.plist
My problem is: I can't tell what is generating the Entitlements.plist file! If I build each of those two targets separately, it does get generated. But if I search for "Entitlements" in the bundle, there is nothing. So I am unable to tell what is going on.
Each of the extension targets has their own entitlements file -- each of them has their own CMakeLists.txt file, and has this setting:
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.entitlements"
but something -- and I assume it's CMake, although I can't find anything that does that -- is producing a rule somewhere that says it creates Entitlements.plist. And it's doing it outside of the project.xcodeproj bundle?
How can I track this down and/or fix it?
I looked at other posts with this problem and didn't find anything that worked.
I used Keychain Access and Certificate Assistant to create a CSR; I uploaded that on the portal. Downloaded the certificate, and I get that error whenever I try to import it. I can import it into the System one, but then it's untrusted, and I still can't export it as a p12 file.
This is one of the few times I did everything by reading the documentation as I did it, so I'm very confused.
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Signing Certificates
Developer ID
I had dealt with this in cmake, and then forgotten about it -- now trying my Xcode-only test project, and it won't work, because the profile has -systemextension as a suffix, while the one Xcode generates doesn't.
Am I missing something in how to get Xcode to deal with this?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Xcode
Network Extension
Provisioning Profiles
Now that I can build again, I'm back to experimenting, this time using Firebase. To display my items, I set up a Table, and this mostly works, barring a couple of minor, crashy details.
I've got
@State var selectedItems = Set<Item.ID>()
private var tableData: [Item] {
return self.items.sorted(using: self.sortOrder)
}
var body: some View {
Table(self.tableData, selection: self.$selectedItems, sortOrder: self.$sortOrder) {
TableColumn("Item", value: \.name)
TableColumn("Count", value: \.count) { item in
Text("\(item.count)")
}
}
Edited down a bit but that's the basics.
The two problems I've got are:
When I select a row, it flashes but does not stay highlighted
If I select the same row again, it crashes with:
Fatal error: Duplicate elements of type 'Optional<String>' were found in a Set.
This usually means either that the type violates Hashable's requirements, or
that members of such a set were mutated after insertion.
I put in a willSet for the selectedItems which was not particularly helpful.
This doesn't happen with the CoreData version, so I assume it's something wonky about Firebase. Or my limited skills.
Searching for this crash doesn't seem to show anything useful.
Why doesn't this work? (Specifically, it crashes.)
struct Item: Identifiable, Hashable, Codable {
var id = UUID()
var name: String? = nil
}
private let defaults: [Item] = [
Item(name: "Bread"),
Item(),
Item(name: "Peanut Butter"),
Item(name: "Jelly")
]
struct ContentView: View {
@State var selectedItem = Set<Item>()
@State var showSheet = false
var body: some View {
VStack {
ForEach(defaults, id: \.self) { item in
Button(item.name ?? "<unnamed>") {
self.selectedItem.removeAll()
self.selectedItem.insert(item)
print("Selected item is now \(self.selectedItem)")
self.showSheet = true
}
}
}
.sheet(isPresented: self.$showSheet) {
let _ = print("selected item \(self.selectedItem)")
RenameSheet(name: self.selectedItem.first!.name ?? "<no name>") {
self.selectedItem.removeAll()
}
}
.padding()
}
}
Based on the output from the prints, it gets set when the button is clicked, but is then empty when the sheet is presented.
If there's another version of our app on the volume, it'll relocate the installed one there. This is particularly delightful, since nothing will work if it's not in /Applications.
We use pkgbuild and productbuild to create the .pkg file.
The code I have is
if (filterManager.providerConfiguration == nil)
{
NEFilterProviderConfiguration *providerConfiguration = [[NEFilterProviderConfiguration alloc] init];
providerConfiguration.filterPackets = YES;
providerConfiguration.filterPacketProviderBundleIdentifier = filterBundle.bundleIdentifier;
filterManager.providerConfiguration = providerConfiguration;
NSString *appName = [NSBundle mainBundle].infoDictionary[@"CFBundleName"];
if (appName != nil)
{
filterManager.localizedDescription = [NSString stringWithFormat:@"%@ (packet filter)", appName];
}
}
if (filterManager.enabled)
{
NSLog(@"Packet filter already enabled, not doing so again");
return;
}
filterManager.enabled = YES;
It's claiming the filter is already enabled. But System Settings > Network shows it there, with a yellow dot. My best guess is that it's showing up as already enabled in the preferences, even though it... isn't? I also log a message in the filter's init, and I don't see that showing up.
I've got sysdiagnose from it and a working system, and I'm going over soooooooo many log lines. I don't know what might be causing this, however.
I have this code in a network extension:
private func pathForToken(token: audit_token_t) -> String? {
var tokenCopy = token
let bufferSize = UInt32(4096)
let bytes = UnsafeMutablePointer<UInt8>.allocate(capacity: Int(bufferSize))
let length = proc_pidpath_audittoken(&tokenCopy, bytes, bufferSize)
if length != 0 {
return String(cString: bytes).lowercased()
}
return nil
}
bytes appears to be leaked -- the call stack is pathForToken(token:) to specialized static UnsafeMutablePointer.allocate(capacity:)
Do I need to do something to ensure bytes is released, since it doesn't seem to be happening on its own?