ravynsoft / ravynos

A BSD-based OS project that aims to provide source and binary compatibility with macOS® and a similar user experience.
https://www.ravynos.com
Other
5.54k stars 184 forks source link

TODO: defaults command #273

Open mszoek opened 2 years ago

mszoek commented 2 years ago

We needs it. Here's a possible source: https://github.com/ravynsoft/defaults (forked from Procursus)

eleanxr commented 1 year ago

Hello, Since this was marked as a good first issue, I decided to try working on this issue using the implementation referenced above and have been working through some of the API differences between the ravynOS Framework implementations and the Apple implementations used in the upstream repository, and I've come across a couple of things that I thought might be good to get input on:

  1. A few functions like CFStringGetTypeID appear declared in the correct headers, but I can't find an implementation anywhere, and their use produces link errors. I am an experienced C++ developer, but am new to Objective C (like this is the first time I'm trying to do anything nontrivial with it) and the various frameworks, so I may just be wrongfully applying my C++ brain here by assuming that a function declared in the header should be defined in the corresponding translation unit, but even grepping across the framework I can't find them. If I am not wrong, would the preference be to try and figure out how to add the missing implementations in CF in the ravynOS repository so it's available to this and future tools?
  2. The referenced implementation uses Apple APIs from CF to obtain preferences for sandboxed apps. It looks like this is a new capability that doesn't exist in the Apple version, but was added to this implementation by Procursus. I'm guessing in this case it's probably best to remove the additional code that handles sandboxed app containers, but wanted to check that's in line with the desired outcome before removing the container support calls from the implementation.

Sorry for the novel. Like I said, this is my first foray into objc and programming with the Step APIs, so I might be doing everything wrong here. My current WIP is at https://github.com/deleanor/defaults/tree/ravynos-port .

Thank you!

eleanxr commented 1 year ago

...Actually, I temporarily removed the code referencing the undefined symbols enough to get it to run and it looks like there are a few functions in CFPreferences that are currently unimplemented, so I think the answer to item 1 above is definitely "yes". I'll take a look at what it'll take to implement those (and some of the others I identified), unless someone knows of work already in progress for that or that doesn't make sense for this issue.

mszoek commented 1 year ago

Hey! Thanks for jumping on this! Yes, there are a lot of stubs and unimplemented routines throughout the frameworks that need to be added, and the results compared against corresponding Apple frameworks for correctness.

One thing to bear in mind here is that our CF implementation is completely wrong. It should be pure C, and not a wrapper around Foundation like it is - it should be the other way around, with Foundation leveraging CF. One way to fix this is to try and get the CF from Swift to work instead of what we have. The other way would be to adapt ours to not need Objective C runtime.

eleanxr commented 1 year ago

Thanks for your input! I didn't realize the dependency edge should be pointing the other way. It seems like getting the Swift CF to work would be better in the long run for maintenance and compatibility, so I'll check that route out first.

mszoek commented 1 year ago

Awesome - here's the original issue for that one if you want to use it: https://github.com/ravynsoft/ravynos/issues/82