OpenBSD Journal

t2k19 Hackathon Report: Putting the hack(6) in hackathon, and other stories

Contributed by Anthony J. Bentley on from the hack the hack(6) dept.

Fresh from the t2k19 hackathon comes a report from Anthony J. Bentley (bentley@), who writes:

Seeing an Asia hackathon coming up was pretty exciting; I’d never been there before. I spent a month or so preparing by getting through the more mundane things in my backlog, mostly new ports and updates. That left my time in Taipei open to focus on fixing some bugs and broken things.


The first target I aimed my keyboard toward was the retroarch package. A few weeks after an otherwise unremarkable update of the port in February, I noticed that it no longer responded to any keys or buttons. This was confusing — I was certain I’d tested the update beforehand! Indeed I had, but while any version of retroarch I compiled from my desktop worked fine, installing from the mirrors with pkg_add(1) resulted in a broken package.

The difference in behavior between my system and the OpenBSD project’s package build machines resulted from that plague of ports developers, hidden dependencies. It turned out that if another package, pkgconf, was installed before building retroarch (as was the case on my machine), retroarch wouldn't be subject to the broken input.

pkgconf is designed to be a drop-in replacement for pkg-config(1) (which on OpenBSD is itself a drop-in replacement for FreeDesktop's pkgconfig). But pkgconf didn't behave exactly the same: it didn't search all the directories that pkg-config does. Making it do so led to a consistent retroarch package, no matter what packages are installed during build.

Unfortunately, “consistent” here meant consistently broken! Investigating that took a little more effort, but I narrowed it down to a specific upstream commit. Reverting it is sufficient as a temporary measure to fix our package, but the next step is to find out why exactly the commit was wrong. Ports development doesn’t just involve contributing to OpenBSD; it often involves significant detective work with external projects, and extensive followup to ensure that things get fixed once and for all.


Speaking of followup… the next project I’d had in the back of my mind was to fix hack(6), that classic text-based game of yore. As one of the classic BSD games included in OpenBSD, it remains one of the oldest and least-touched parts of the tree, and it also didn’t work.

Back in the day, it was common for games on BSD systems to save high scores to a systemwide leaderboard. To keep individual players from cheating, editing the scores was restricted to a “games” group, and games like hack were allowed to elevate themselves to that group even when run by normal users.

But that kind of privilege escalation doesn’t fit OpenBSD’s security model of consistent privilege dropping and privilege separation. hack’s special permissions had to go. That meant the game would no longer work at all, since it would simply refuse to start if it couldn’t save high scores.

Almost exactly a year ago, someone going by “tonypony76” contributed patches to fix that problem (and a few more besides). But nobody ever followed up, myself included. OpenBSD is a volunteer project, but it’s a shame to let useful contributions go by the wayside like that. I thought, though, “better late than never,” and tested both that the patches work and that they survive a full system rebuild and install. They did! As a result, I committed the fixes. Thanks, Tony, whoever you are, and sorry it took so long.


Performing that full system build to test hack took several hours, especially since I fat‐fingered it a couple times. My to‐do list was getting kind of thin, so I needed another task to fill the time, preferably something that didn’t require lots of compiling. And something came to mind…

Shortly before I left the States for the hackathon, I had proposed deleting upsd, an older port meant for interacting with APC UPSes. My reasoning was threefold: its code hadn’t been touched in 20 years (rarely a marker for quality), due to restrictive licensing it wasn’t available through pkg_add (meaning it had to be compiled by hand), and it seemed to be completely obviated by sysutils/apcupsd. At the hackathon, kevlo@ — the one who added upsd to OpenBSD 20 years ago — gave me the ok, and I removed it.

Deleting old ports is pretty cathartic. More than that, though, keeping bad code in ports isn’t free. Old code tends to break when we make major changes to the compiler or other parts of the system. Historically, the result has been that people making these changes or other ports devs have to spend time digging through unmaintained twenty‐year‐old code to make it work again. If said ports aren’t available as packages, people rarely use them, meaning patching crufty old programs is a lot of tedious work for little gain. With the encouragement of kn@ and naddy@, I started sweeping the tree of similar ports — ones with ancient code, poor licensing, and little (or no) utility — and removing them. Twentythree ports later, the tree was a bit lighter.


As the time to go home drew near, I managed to squeeze in one more bugfix. When X starts, it detects the wscons(4) keyboard layout and sets the X keyboard layout to match. But Diogo Galvo reported that the check was wrong, and resulted in a number of languages (including Brazilian Portuguese) changing to French once X started. I finished testing a fix just as the hackroom was closing, sent it out from the hotel, then prepared to catch my flight the next morning.

It was a phenomenal week. Interspersed with the development work was a lot of street food, boba tea, beef noodle (牛肉麵), sashimi, hot pot, and time spent wandering in night markets; riding trains, scooters, gondolas, and fast elevators; and otherwise having a thoroughly enjoyable time. Taipei was a great place to host a hackathon, and kevlo@ an excellent host! And I’m grateful both to users who report bugs and submit fixes, and to the project and the OpenBSD Foundation, for making my work at t2k19 possible.

(Comments are closed)


Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]