Archive for February 23, 2023

Thursday, February 23, 2023

“Volume contains a macOS or OS X installation which may be damaged”

I was recently setting up a High Sierra test partition, and this error popped up after the installer had rebooted the Mac to complete the installation. At first, I thought it was another variant of the “This copy of the Install OS X El Capitan application can’t be verified. It may have been corrupted or tampered with during downloading” error, which indicates an expired certificate. But setting the Mac’s clock back didn’t help, and neither did downloading a fresh copy of the installer.

I eventually figured out that the destination volume, though it looked empty, contained the remnants of something. After I erased it with Disk Utility, the installation proceeded normally. I think there used to be an option to “Erase and install,” which I surely would have chosen in a situation like this where I was trying to create a clean system for testing, but with no such option presented that possibility was not top of mind.

Previously:

Feedbro

Nodetics (via Jason Pester):

With Feedbro you can read RSS, Atom and RDF feeds and thanks to built-in integration also content from Facebook, Twitter, Instagram, VK, Telegram, Rumble, Yammer, YouTube Channels, YouTube Search, LinkedIn Groups, LinkedIn Job Search, Bitchute, Vimeo, Flickr, Pinterest, Google+, SlideShare Search, Telegram, Dribbble, eBay Search and Reddit.

Apparently, like Nitter, it can read Twitter without using the API. So it’s a potential alternative to using the Web site if Twitter does follow though on cutting off the remaining apps. It only seems to work for public accounts, though. Feedbro is implemented as extensions for Firefox and Chrome-based browsers; there’s no support for Safari.

Previously:

Wi-Fi Sync Spyware

Certo:

There is a little-known feature on all iOS devices called ‘WiFi Sync’, which essentially allows for a backup of the device to regularly be downloaded onto a nearby computer over a WiFi connection.

[…]

Unfortunately, this ease of set up and lack of maintenance makes it the perfect target for spyware providers and cyberstalkers. The solution offered by spyware providers requires the stalker to have access to their target device to set the connection up, but after that the target device will provide a full backup to a computer using the same WiFi network. An application on the computer then reads the backup and packages up all the information into a clear report for the stalker.

Nothing needs to be installed onto the phone itself, which makes it very difficult to detect. As far as the phone is concerned, it is just performing a routine backup.

[…]

Historically you could perform a simple check in the Settings app on the phone to see if WiFi Sync was enabled (and therefore if you may be a victim of this type of spyware). It would even display the name of the computer that your iOS device was set up to sync with. However, in iOS 13 and all subsequent updates, Apple has removed this information from the Settings app, making it extremely difficult to tell if it is enabled.

Via Nick Heer:

It is also not new — the vulnerabilities of Wi-Fi syncing have been known since at least 2018.

That information does little to ameliorate these abuses, however.

[…]

The only way to know if an iPhone has Wi-Fi syncing turned on is by checking in Finder on the trusted Mac, or in iTunes on a Windows PC. If Apple is not retiring this feature, it should be possible to see if an iPhone has Wi-Fi syncing enabled on the phone itself.

Previously:

macOS 13.2.x and Recovery, a Sad Tale

Robert Hammen:

Apple’s latest updates to macOS Ventura can lead to your FileVault-encrypted Mac booting into Recovery, and, potentially, prompts to enter one or more of […]

[…]

As far as what’s happening, without having intimate knowledge (and logs/bug reports), it’s difficult to say exactly, but it seems to revolve around a failure to perform something like an authenticated restart (i.e. restart and unlock the encrypted boot drive without prompting the user). When this fails, macOS falls back to boot to Recovery for authentication/disk unlock.

[…]

Apple does not make public statements about bugs/issues. Privately, they’ve indicated that they’re aware of this situation, and have asked for further details (some diagnostic steps below). For now, the recommended workaround is to:

  1. Restart your Mac
  2. Within 30 minutes of restarting, install the update(s)

I’m still having Ventura updates not show up in System Settings. I need to install them using softwareupdate --install --recommended, and with the 13.2.1 update I also needed to add --restart or the command would get stuck after downloading the update.

Previously:

Speeding Up Scanner in Swift

My first tip goes back to when I started using NSScanner in the Puma days. In short, you should never call scanCharacters(from:into:) in a loop because every time it’s called it creates an inverted copy of the character set. It then delegates to NSString.rangeOfCharacter(from:options:range:), passing that copy. The documentation contains the cryptic comment:

Using the inverse of an immutable character set is much more efficient than inverting a mutable character set.

But my experience is that it’s not fast with immutable characters sets, either. It seems like there should be an NSCharacterSet subclass that flips the membership of another object. Then each character set could store its own inverse with minimal overhead and just return the same one each time. But there’s apparently no such optimization, so I recommend calling inverted yourself, storing the result, and then using scanUpToCharacters(from:into:), which will then use the character set unchanged.

Even this is very slow when calling from Swift, though. Whenever you call scanUpToCharacters(from:into:) with a CharacterSet, it calls CharacterSet._bridgeToObjectiveC(), which calls __CFCharacterSetCreateCopy(), which again makes an expensive copy. (I have been doing a lot of profiling but somehow didn’t notice this until Ventura, so I wonder whether something changed there.) In any case, currently CharacterSet does not bridge efficiently like Data and String do.

My first try at working around this was to do the bridging up front:

let fast = characterSet as NSCharacterSet

and then pass the same NSCharacterSet, which should bridge cheaply, each time. But this didn’t help.

What did work was to create an NSCharacterSet directly:

let fast = NSCharacterSet(bitmapRepresentation: characterSet.bitmapRepresentation)

With that change, the bridging overhead goes way. Scanner is still not particularly fast, though. Maybe this will improve with the forthcoming Swifty Foundation, or I may end up writing a replacement for just the few cases that I need that works directly on Swift strings.

Previously:

Update (2023-02-24): Another point to be aware of is that the documention implies that the caseSensitive option applies to scanCharacters(from:into:), and scanCharacters(from:into:) does actually pass the option into NSString.rangeOfCharacter(from:options:range:), but NSString.rangeOfCharacter(from:options:range:) is documented to ignore that flag, and in fact it does. So caseSensitive only actually applies to the Scanner methods that take strings.

Rhys Morgan:

swift-parsing from @pointfreeco is a really good library that’s usually faster than Foundation’s Scanner!

Update (2023-03-10): Jonathan Wight:

(NS)Scanner is truly one of the most under appreciated features of Foundation. I use it whenever I need to do structured parsing of text when a simple regex isn’t appropriate (or even possible).

But why limit your Scanning to just Strings?

Here’s my CollectionScanner that can scan any collection of arbitrary elements. Useful if you need to process arrays of data that aren’t necessarily Strings.

Indeed, I’ve found it really useful to have a Data scanner.