Common issues with using GnuPG over SSH from a Mac

Usually, I work directly on my Mac, but sometimes, I have to log into it from another system. By default (at least on MacPorts), the GnuPG agent will default to using the graphical pinentry. Normally, this is good, but if you need to enter your key passphrase, it’ll open on the desktop instead. Oops. To fix this part, add this line (adjusting path as needed) to ~/.gnupg/gpg-agent.conf (maybe need to restart the agent too):

pinentry-program /opt/local/bin/pinentry-curses

Remove this line to go back to using graphical passphrase entry.

Sometimes with this, you might get an error like this with the curses version of pinetry:

gpg: signing failed: Inappropriate ioctl for device

It seems GnuPG might not pick up the right TTY, so you may need to explicitly override it:

GPG_TTY=$(tty)
export GPG_TTY

Making mailing lists nicer: Writing a mail extension for macOS with MailKit

As a developer, I need to work with mailing lists a lot. Developer-focused mailing lists tend to have certain conventions most usage of email has moved on from, as have the clients. While some people who trawl mailing lists configure some terminal email client, I tend to not like those. Most of the time, I use the stock Apple mail application (Mail.app). It otherwise works well and has platform integration.

However, I do want to avoid a lot of common mailing list faux pas, like top posting and not wrapping lines. Mail.app can write plain text emails, but it doesn’t push you in the right direction for mailing lists. However, Mail.app does provide an extension API. I figured I could write an extension to make my life on mailing lists easier. Turns out it’s possible!

The extension I wrote is called MailTools (tentative until a better name is found). Feel free to build or download it yourself; this article explains the challenges I faced.

Continue reading

Accessing iPhone photos and media from Nautilus on Linux

If you plug your iPhone (or other iOS device) into your Linux system, you might see in the sidebar the virtual filesystem for app document storage, but not photo/media storage. If you don’t see the photos virtual filesystem, go to the app document virtual filesystem first. Change the :3 at the end in the afc:// URL to :1. (You may need the proper GVFS plugins for AFC and gphoto2 first.)

Is Linux collapsing under its own weight? On Rust for Linux

Recently, one of the developers of the Rust for Linux project, Wedson Almeida Filho, resigned from the project. In his parting message, he linked a video of a filesystem maintainer shouting at him. Afterward, Asahi Lina, developer of the Apple GPU drivers for Linux (which have not been upstreamed yet), posted a series of threads on Mastodon (first one), expressing sympathy for Wedson and her own frustrations with maintainers and Rust from the DRM perspective. While it’s tempting to look at this as just “Rust haters vs Rust pushers” drama, I think these signal deeper issues in Linux, both technical and cultural (which often feed into each other). In this article, I’ll summarize the issues for those unfamiliar and speculate where it could lead.

Continue reading

Notes on installing IBM i over an NFS share

I was trying to install IBM i (mostly) over the network, and ran into some difficulties setting it up. IBM provides some information on netboot, the most important being how you set up an image catalog – that is, an NFS share with a VOLUME_LIST file at its root listing the files. However, it doesn’t mention how the NFS share should be set up (assuming you’re not using IBM i to host it), and what files should be in that volume list.

Continue reading

Updating Core Data object ID URIs on store migrations

I found out recently that Core Data object IDs can change. This usually happens if you migrate a store, such during a heavyweight migration (lightweight migrations don’t count, as they mutate in place). If you were like me and persisting object IDs, then you’ll have to update those URIs, or you will have a very bad day trying to fetch objects from these IDs.

The easiest way to do this is to lean on NSMigrationManager, because it has both the source and destination model versions, and can get the destination object version from the source version. If you’re manually doing the migration for model upgrades, you easily have it already. If you want to update it from a NSEntityMigrationPolicy, then the easiest option is to stash the NSMigrationManager by overriding beginEntityMapping:manager:error:. You provide it the source NSManagedObjects, and out comes the destination version’s managed objects, as shown below, of which you can get the new object IDs to persist in the new version of the model:

var manager: NSMigrationManager!

private func destinationURIsFromSourceObjects(_ objects: [NSManagedObject]) -> [URL] {
    return manager.destinationInstances(forEntityMappingName: "TrackToTrack", sourceInstances: objects).map {
        $0.objectID.uriRepresentation()
    }
}

Note that you need to provide the entity mapping name – regardless if your entities heavily changed or not. For the Xcode mapping model generator, check the name – it’s usually something like TrackToTrack. If you need to get the managed objects from the source version’s URIs, you can use the the sourceContext property in the migration manager to get the source model version’s managed object context.

Fixing the “Not a heap block” error with networking with PCPro

I was trying to get the PC compatibility card (a Gemini II) in my Risc PC (StrongARM, running RISC OS 3.70) onto the network. However, when starting the emulated PC, I would get a “Not a heap block” error, and the emulated PC wouldn’t have its emulated network card.

It turns out this is because the program it invokes to find the most appropriate interface (this is called ScanDCI4) doesn’t actually work. This causes the script to fail, and not actually load the emulated NE2000 support module. To fix this, we’ll need to patch the script that starts the PC card networking support.

Continue reading

Formatting disks and clearing RAID config on Power systems with iprutils

I recently put some spare disks into a Power S814 server, and when I tried installing an OS, be it VIOS or Debian, it would say that there were no disks available to install onto.

It turns out that the RAID configuration on the controller and the disks didn’t match. This is par for the course with any RAID controller, even in the x86 world. It also didn’t help that some of the disks were formatted for IBM i, which uses non-512-byte block disks. We need to use the vendor utility to clear out the RAID config, and format the disks to be usable by commodity operating systems.

The two utilities IBM provides for this are either the diagnostics on the AIX Standalone Diagnostics disc, or using the iprutils set of software. Since netbooting Linux was easier as I don’t have a NIM server, I’m choosing to do the latter here.

Continue reading

Netbooting Alpine Linux on a PowerVM system

I had a need to run a utility that requires Linux (specifically, iprutils to configure a RAID card) onto a Power S814 that I had installed at a datacentre, and no remote hands to boot a CD with. However, there’s not much information documented on how to boot Linux on these systems from a network. This article aims to synthesize what I’ve found online, since information about IBM Power systems tends to be scant outside of IBM documentation..

Continue reading

Sleeping through a decade of Cocoa: Retrospective from modernizing an old Mac app

A few years ago since I started using Macs more often, one annoying thing I dealt with was using my local music library. My usual solution was to just drag files from the file manager to a music player, but this wasn’t as nice on macOS (due to i.e. SMB latency). However, I did have a Subsonic server, which provides a nice music streaming server, complete with an API for clients to use for things like phones. Why not use this on my laptop too?

Of course, if I bought a Mac, I’m not going to put up with bad cross-platform solutions that suck everywhere, when I can instead run bad native software that sucks uniquely for my platform of choice. However, there weren’t too many clients available on Mac. Mostly all of them were unmaintained and had been abandoned in the Snow Leopard era. One of them was Submariner, and it was open-source after the developer (Rafaël Warnault) had stopped working on it. Writing my own seemed a bit daunting with no background, but what if I used the Submariner codebase, and started from there?

Now I’ve been maintaining Submariner for almost two years at this point (it even has a minimal website), adding features and mostly just focusing on modernizing the codebase. It’s been an interesting experience as my first Objective-C/Mac project. A lot of the lessons of modernizing legacy code are universally applicable, but I’ve learned a lot about the specifics of Apple platforms and how they compare. This article aims to be both a retrospective on what I had to learn, what I had to do, and the lessons I took from it, including a comparison of what the development culture is like between platforms.

Continue reading