Debian packages may seem simple to generate using the many bundling tools out there, but it is much more involved than that. There are policies and procedures in place before stuff can get into Debian, including how the package is made, what it must include, and more. This article aims to cover the stuff prospective contributors to Debian should know that other resources miss.When I started, I didn't know a lot of this and had to learn a lot along the way. Hopefully what I've put together here will make it easier for the next person that comes along.
Find the right thing to work onPackages are the bread and butter of Debian, so it may be the first place you look at. There are two ways to go: adopting or helping out with an existing package, or introducing a new package.Outside of packaging, contributing to Debian's infrastructure is also very much welcomed and appreciated, especially as a lot of it is decades old. Some examples include Lintian (Debian package linter), DAK (archive software), and distro-tracker (package info tracker), and there are many, many other projects in need of help.If you are a native speaker of any non-English languages, you may want to also consider helping translate stuff. Everything from the installer to mentors.debian.net to package descriptions needs volunteers to translate.This article mainly focuses on the packaging side of things.
Working on an existing packagewnpp.debian.net lists packages that need help with maintenance.The most useful thing you can do as someone interested in packaging is to help with an existing package. You can either:
Help other maintainers on an existing package. Maintainers will publish Request for Help (RFH) bugs asking for assistance to maintain a package. Some packages are so unruly that help is welcome even when not asked (e.g. Docker).
Adopt an orphaned package. An orphaned package is one where the previous maintainer could not continue maintaining it for whatever reason, and so it needs a new maintainer (or deletion). These are indicated by Orphaned (O) bugs. Request for Adoption (RFA) bugs are similar, as they mean the maintainer is about to orphan the package.Some orphaned packages are effectively abandoned, being both unmaintained upstream and having no users in Debian, but many maintainers will choose to orphan these packages rather than remove them. Keep this in mind when looking through the list.
By the way, this is how I started contributing to Debian! With the help of a Debian Developer, I adopted kitty, and to this day I continue to maintain it.
Introducing a new packageMany people opt to start their Debian contribution journey through producing a new package for the Debian archive. Unfortunately, many people do not do this properly or try to use Debian as a dumping ground for their own software, so here is a general checklist to see if something belongs in Debian:Repology shows an overview of a package across Linux distributions.
How established is the software, and is it still maintained? The longer a project has been around while continuing to be actively maintained, the more likely it is to continue to be maintained in the long-term.
How many people use the software? Hundreds? Thousands? How many people will benefit from the software being packaged and included in the Debian archive?The point of packaging something for Debian is to make it easier for the existing userbase to install the software. For instance, as a user you generally expect notable software like Firefox and Vim to be available with a single apt install, and it would be weird if you had to hunt down binary tarballs or build these from source.
Do any other Linux distributions package the software? If yes, that's a good indicator it belongs in Debian as well. You can check this on https://repology.org.
Does the software introduce new or unique functionality not found in any other software currently present in the archive? It's okay if it doesn't, but there would be a much stronger case for a new package if the answer is yes.
Does the software have generally stable releases and proper versioning? If it doesn't, it's going to be a whole lot harder to create and maintain a package for it, considering Debian is a distribution that releases snapshots of software every 1-2 years with nothing but security updates for stable.
You also need to keep in mind that you should be prepared to maintain the software throughout the lifetime of the next Debian stable. Debian is not a rolling release distro. You cannot upload new versions of software to stable. The only thing you can upload to stable are fixes that meet the stable release team's criteria, and security fixes via the security archive, which you sometimes have to cherry-pick and backport if upstream does not provide them. And Debian packaging is not a one-off task; you should be ready to look after the package long-term, which consists mostly of updating the package in unstable for new upstream releases and fixing bugs.Many people miss the memo. They bring their "revolutionary" app that they threw together (often vibe-coded) in a weekend and try to get it added to Debian. Project members mostly won't upload such packages; as a result, more useful packages may be drowned out. At the time of writing, I estimate around half of the open Request for Sponsorship (RFS) bugs is this kind of toy software with little to no real users.If you've made something, great! Feel free to package it, but distribute it in your own external repo. Not everything belongs in Debian, and no Debian Developer has an obligation to sponsor and upload your package. Services like GitLab, and Forgejo (Codeberg) also have built-in repository features that let you easily create an external apt repository.When looking at software that could potentially be packaged, also consider the amount of effort you may have to spend investigating licensing status and compiling copyright information. This is covered a bit later in this article.
Become familiar with Debian packagingNow, you probably don't need read the Debian Policy and Debian Developer's Reference from cover to cover, but you should familiarise yourself with Debian packaging and the key infrastructure involved. Look at the important bits in the Policy and Developer's Reference.Check out this list of packaging manuals and this introduction to packaging on mentors.debian.net for some additional material. There are also some great manual pages like deb-control(5), deb-src-control(5) (from dpkg-dev), debian-watch(5) (from devscripts), and dh(1) (from debhelper) describing some of the packaging files in detail. You can read these with the man program or at https://manpages.debian.org.Look at other similar packages and pay attention to how they were made. Ask questions when you're unsure, people are always willing to answer on the debian-mentors mailing list and IRC channel.Once you get a rough idea of how a Debian package works, it will feel natural working through packaging files.By the way, you can read a lot of these documents offline: manpages can obviously be installed and read on your own machine, but the debian-policy and developers-reference packages (from unstable) will allow you to read the policy and reference offline as HTML in their respective directories under /usr/share/doc/.
Git-based packagingPeople have many opinions on how to create a package, but by far the most popular is the GBP format for packaging in a git repo.GBP stands for git-buildpackage, the tool behind this workflow, based[2] loosely on the DEP-14 proposal. Here, the upstream code is placed in an "upstream" branch (this is what goes in the .orig.tar.xz tarball), and the Debian-specific packaging work is placed in a "debian" branch (this is what goes in the .debian.tar.xz tarball).Many people have different ideas of what these branches should be called: upstream vs upstream/latest, debian/latest vs debian/unstable vs debian/sid. It generally doesn't matter though as the end result will be the same either way.Using a git repo for your packaging rather than just a DSC makes it easy to see and review the changes you've made, and allows others to easily get the package source with full history and contribute (when located in a permissive group on Salsa like debian/ or one of the many teams).It goes without saying that you should maintain proper commit hygiene by separating changes into multiple commits, having meaningful commit messages, and avoiding force pushing whenever you can.Commit messages do not need to have explanations like other projects may expect, but feel free to add one if you think it will help whoever is looking at your changes understand what's going on.Keep in mind that you can and should use the gbp-dch-style meta tags, which are Gbp-Dch, Thanks, and Closes, documented in the gbp-dch(1) manpage:
Gbp-Dch: ignore will not include your commit in the generated debian/changelog when gbp dch is executed.
Gbp-Dch: full will include the extended description of your commit as well in the generated debian/changelog when gbp dch is executed.
Thanks: John Doe will add a thankyou to the person named in the generated debian/changelog when gbp dch is executed. Useful when a commit is related to a bug report, patch or other useful contribution from someone else.
Closes: #123456 will add the relevant (Closes: #123456) in the generated debian/changelog when gbp dch is executed, to close one or more (comma-separated) bugs in the Debian Bug Tracker when the package is uploaded.This is the most important one, and should always be used even when not using GBP in an alternative workflow. Most groups on Salsa, including debian/, have webhooks that will send an email to bug reports and tag them as pending if a commit using this meta tag is pushed, which is great for notifying people that a fix is ready and about to be uploaded.Note: Don't bother trying to add Closes: to your "Initial packaging" commit description; there is no need and debian/changelog should already close it in your initial packaging work.
Team maintenanceMore and more packages are being moved into "team" maintenance with weak package ownership, over the traditional single-maintainer model with strong ownership. This allows everyone to help maintain a package through team uploads, rather than relying on the same people to remain active.When it makes sense, you should try to maintain your package in a team, especially as it will have other contributors familiar with the topic or language that may be able to spot issues in your package others may miss.Most packaging teams fit into two categories:
Language teams - these are teams that package software exclusively written in a specific programming language, and usually also maintain the toolchain for that language as well. Examples include the Go team, Python team, and Rust team. Many of these teams also have their own tooling to make packaging easier for these languages, like dh-make-golang and debcargo.
Topic teams - these are teams that package software related to a certain topic or project, usually by contributors very interested in that topic. Examples include the Med Team, the Electronics Packaging Team, and the Debian Vim Maintainers.
Language-specific libraries like golang-*-dev packages should almost always be maintained in a language team, and packages centered around a project like Vim or Treesitter should be put in the related team if it exists. For all other cases, it is completely up to you. It usually does not matter which team you put it in, as long as you put it in a team, as you get the same benefits. Keep in mind, many teams have certain policies and guidelines for how packages within them should be maintained, so make sure to check that.If you're maintaining stuff outside of a team, you should consider adding yourself to the LowThresholdNmu list to indicate that you are happy for people to follow a relaxed non-maintainer upload process when it comes to these packages.
Compiling copyright information Upstream sometimes adds files taken from other projects, which must be documented in debian/copyright.Every Debian package must include copyright information. In the packaging source, this is in debian/copyright, and this ends up being installed under /usr/share/doc/<package>/copyright on Debian systems.This is important for a variety of reasons, some of which are:
It establishes that the software is compliant with the Debian Free Software Guidelines (when in main).
In the case of packages in the contrib and non-free archive areas, it helps people running mirrors or creating installation media (like install USBs) determine which software they are allowed to redistribute.
It helps people working in enterprise settings produce a Software Bill of Materials (SBOM).
It provides a consistent source of licensing information for software installed on your system so that you, as the end user, don't have to hunt down this information yourself.
All new packages should follow the machine-readable debian/copyright specification to produce a consistent, complete copyright file that covers every file in the source package.As a result, this can mean a lot of work hunting down copyright and license information, especially for large software projects. In fact, you will often spend more time on the debian/copyright file than the rest of the package combined when working on Debian packaging.There are a range of copyright review tools to make your life easier when doing this work. Some of the highlights are:
licensecheck - tool to try to detect the license of files passed to it
licenserecon - uses licensecheck to compare detected licenses against those in debian/copyright and shows you the differences
scan-copyrights - generate a preliminary copyright file using licensecheck, useful for finding stuff that got missed
When the licensing status of a file is unclear, you may have to ask the upstream author to clarify. Note that if something has no license (e.g. upstream does not specify a license at all for their project), it is considered "all rights reserved" and cannot be distributed in Debian.Some projects will have vendored copies of some or all of their dependencies. When this is the case, you need to remove as much as possible and make the package use the libraries provided in Debian instead, as this is a Debian policy requirement (more info on this wiki page on embedded copies). Additionally, you may need to remove non-DFSG-compliant parts of upstream's source to ensure the package is DFSG-free. Both of these are done via repacking, which involves:
Specifying the Files-Excluded field in debian/copyright, preferrably with a Comment as well on why it is being repacked.
Modifying the tarball retrieved from upstream to remove these files. Some people do this by hand, but it is better to use either mk-origtargz (from devscripts) to do this when you already have a tarball, where it will read and use Files-Excluded (refer to it's manpage), or uscan, which will download a new tarball using your debian/watch file and then run mk-origtargz on it.
Adding a +dfsg (repackaged for DFSG reasons) or +ds (repackaged to remove vendored copies or other reason) suffix to the upstream version. This will appear in the name of the repackaged tarball (e.g. foo_1.2.3+ds.orig.tar.xz), and in the upstream part of the Debian version (e.g. 1.2.3+ds-1, where 1.2.3+ds is the upstream part). If you end up repacking the same version multiple times, you can add a numeric suffix (e.g. +ds2) to indicate this.
Also make sure to check if your package source contains binary files like images and PDFs, and to figure out if they have separate copyright and licensing status. Some of these files have their copyright information embedded within them. Of course, you can ignore build artifacts, as long as they are cleaned and rebuilt during package build.
Build and check your packageYou should build your package in a clean unstable environment to ensure that your Build-Depends pull in all the required packages from the unstable repos. The best tool to do this is sbuild, which builds your package in an isolated unshare-based environment and allows easily running lintian and autopkgtest as well; this is the same tool used by the Debian build daemons (buildd) once your package is uploaded.There is a great sbuild page on the wiki containing setup instructions and many useful tips.There are many quality-checking tools available to catch common and not-so-common issues with your packaging. Using the sbuild configuration that the wiki page suggests, after each build it will automatically run:
Lintian: static Debian package checker that analyses the outputted files (.deb, .dsc, .changes)
Autopkgtest: tests your package as installed on a testbed system if your package defines them
Piuparts: checks your package cleanly installs, upgrades and removes (useful for checking custom installation and removal scripts)
You should always check the output of these tools and ensure they pass. Debian Developers use these same tools when reviewing your packaging.If you are able to and when it makes sense, you should also install the package onto your own system and check everything works correctly. Even if a package builds successfully, it may not actually work when installed.Unless your package only produces Architecture: all packages, you may want to also check that it cross-compiles correctly. You are probably either reading this on an amd64 or arm64 device, so you can easily cross-compile to the other architecture using the --host option with sbuild. Ability to cross-compile is not a policy requirement, but it will be raised as a bug against your package if it fails to do so.Adding on to that, if your package is not straightforward and it produces packages on multiple architectures (usually Architecture: any), you may want to also check that it compiles on all of Debian's release architectures (aka. official ports). You can do this using virtual machines (QEMU is probably the easiest), but if you can't do this for whatever reason (like your computer being too weak to run a VM or the long package build time), also note that Debian Developers have access to porterbox machines that can be used to check your package before upload.
Find a sponsorNew contributors cannot upload to and manipulate the Debian archive directly. Rather, they need a Debian Developer to do so on their behalf after reviewing all their work; this person is called the "sponsor".If you are planning to maintain your package within a team, check if they have their own guidelines or policy for finding a sponsor, as this will likely be quicker than the traditional RFS process outlined below. For instance, in the Go team, sending an email to the mailing list is much better, especially since usually multiple packages need to be uploaded at once.Outside teams, the usual method is to upload your package to mentors.debian.net, and then file a Request For Sponsorship (RFS) bug to ask for a sponsor. The mentors website has an overview and very clear instructions on properly filing an RFS and finding a sponsor. Properly formatted RFS bugs go a long way.When filing the RFS bug, make sure you follow the template exactly. Deviating from it or sending a misformatted email is one of the quickest ways for your RFS to be both ignored by humans and missed by automated tools, so double check that it actually has everything needed. Ensure each of these fields is filled correctly:
Package name: This is the name of the source package set in debian/control.
Version: The version of the package you want the sponsor to upload, usually the latest version in debian/changelog.
Upstream contact: The contact info you put in the Upstream-Contact field in debian/copyright. This can be a name & email or a URL (e.g. to upstream's issues tracker).
URL: The homepage of upstream's website, usually from the Homepage field in debian/control.
License: List all the licenses present in debian/copyright, comma-separated.
Vcs: The URL to your Git repo containing your packaging, which should be on salsa.debian.org and be set up accordingly in the Git-buildpackage format.
Section: The value of Section in debian/control for the source package.
Adding notes or comments to the end of the RFS message is fine, but make sure the rest of it follow the right format.Things to keep in mind include:
Do not file multiple RFS bugs, for any reason. If you have reuploaded your package or made a change, you can send a follow-up to the same bug.
If you want to change the name of your RFS (e.g. following a change in the name of the package), modify the tags or anything else, you can send commands via email to the Bug Tracking System (BTS).
Your RFS bug will only be closed if the package is uploaded or someone decides your package should not be uploaded.
Do not change the Package: field at the top of the email from sponsorship-requests, this tells the BTS that your bug report should be filed against sponsorship-requests and not some package in the archive.
The Severity: field at the top of the email should be "wishlist" for new packages, "important" for updates fixing Release-Critical (RC) bugs, and "normal" for everything else.
Skipping the bug and sending an email directly to the debian-mentors mailing list is a great way for your RFS to be ignored, especially since automated tools will not be able to pick it up.
Format the bug's title correctly. It needs to be RFS: name/version [ITP/ITA/RC/NMU] -- short description. Again, this is helpful for automated tools when they try to figure out what your RFS means. Examples include:
RFS: qiv/3.0.4-1 [ITA] -- Quick image viewer
RFS: wattsi/0.0~git20251112.d8caa36+dfsg-1 [ITP] -- Preprocessor for the HTML Standard
Now, when filed properly, an interested sponsor may come along and review your package, then either upload your package or send you feedback to iterate on before that. Ensure you watch for responses to your RFS and respond promptly.Note there is no obligation for anyone to upload your package, and that anyone can review your package but only Debian Developers can upload it for you.The Lintian output given by the Mentors website was usually right, but at the time of writing the website is using an outdated version of Lintian, so many of the hints it gives are incorrect. For the most up-to-date output, it's best to run Lintian from unstable on your own machine (which sbuild does for you).
Next stepsIf your package is new to Debian, it will head to the NEW queue for manual review. Here, the DFSG team primarily checks that the package is compliant with the Debian Free Software Guidelines and is suitable for "main", but also check for mistakes in debian/copyright and obvious/major packaging issues.Once your package is uploaded, whether new or existing, and you are named maintainer, you are in charge of looking after it, including new upstream version uploads to unstable, bug fixes, and security fixes. This mostly involves updating and cherry-picking fixes from upstream, but occasionally it gets interesting and you need to dive into the packaging to figure out what's going on and fix the issue.You should try to work towards becoming a Debian Maintainer at the very least in order to easily maintain packages long-term. As a DM, you can be granted upload permissions on a per-package basis for your existing packages so that you don't have to rely on sponsors forever. Having this goal can also appeal to sponsors.Have fun packaging!
(Opinion) What I look for in an RFSThis is not definitive, but I usually scan for these indicators:
Upstream and the packager being the same person is usually a red flag for a low-quality package. Exceptions can be made when it makes sense and this would actually be a benefit, but this is rare.
Properly formatted BTS bug, which shows ability to follow a simple guide.
The software existing in other Linux distros is a good sign.
Packaging VCS should be up-to-date, located on Debian Salsa, and follow Git-buildpackage / DEP-14 format. Deviations should only occur for a good reason. Only experienced packagers should really be experimenting with alternative Git styles like dgit-maint-merge etc.
I can understand what it does just from the package's full description, without having to go to upstream, since this helps me gauge whether I am interested in sponsoring the package. This is not always the case, since packages sometimes come through of a technical nature (usually kernel-related or maths/science packages) where I wouldn't be able to understand no matter how hard I try.
Updates to existing packages and adoptions (ITAs) are easier to sponsor than new packages since it doesn't have to go through the NEW queue and does not need to justify its addition to the archive.
Common misconceptions about Debian
Debian Developers and Debian Maintainers speak for themselves, not for the project. They are just people who happen to have some permissions in the project.The only official way to put forward the position of the Debian Project as a whole on a particular issue is through a General Resolution as per Debian's constitution. Other official sources include those maintained by the Publicity Team delegates, such as Debian News and Bits from Debian.Also note that delegates for a certain team can speak on behalf of that team. In this case, they usually get consensus within that team before making such statements.
The only formal, official "teams" in Debian are those delegated by the project leader, listed at https://www.debian.org/intro/organization.Debian does not have a "legal team", the debian-legal mailing list is for discussion about licensing.There is no "Debian Team", it's just a bunch of contributors working together to deliver a quality collection of packages. Packaging teams are informal, as they are not delegated; rather, they are people working on a certain category of packages under one roof.
Keep in mind contributors are all volunteers, with most not getting paid to work on Debian. Debian is owned by a non-profit and relies on donations, rather than a company like Ubuntu and Canonical. The Debian constitution explicitly states that no contributor is obligated to do anything.
A few years ago the kitchen of the company I worked for suddenly had no soup spoons or dessert spoons. One day there was about 40 in the drawer and the next day there was none, to the great annoyance of everyone who ate breakfast cereal, soup, and similar food at the office. Someone had stolen about 20 dessert spoons and about 20 soup spoons while apparently not stealing tea spoons, knives, or forks.
For a while I kept my own soup spoon in a locked desk drawer, but that was a hassle. After a couple of months of unsuccessfully lobbying management to buy more spoons I went to an op-shop (thrift-shop for American readers) and bought most of the soup spoons and dessert spoons they had and donated them to the office. After that everything was good for about a week until all the regular knives were stolen. They didn t steal carving knives or bread knives, just the type of knife you would use to eat dinner or make a Vegemite sandwich.
After the knife theft management agreed to buy new knives.
Not long after that the company had financial issues and I was laid off, so I don t know whether the forks ended up being stolen later on. If the cutlery thief wasn t among the people laid off then I m sure a fork heist happened sooner or later.
I remain mystified as to why someone would want to steal cutlery. The security around laptops wasn t great and walking out of the office with a laptop would look much less suspicious than walking out with a bag of spoons or knives. One would expect that stealing a laptop and selling it to buy cutlery would be a better option.
If anyone who lives in my area wondered why their local op-shop had a sudden lack of spoons, I m sorry that I don t have a satisfying answer for you, just many more questions.
The Problems
In mid 2025 I bought a Thinkpad X1 Carbon Gen 6 with 1440p display for $350 [1].
It has been working reasonably well for me, but my vision is diminishing so my current setup with the Kitty terminal emulator allows 4 terminals of 153/154 columns and 40/41 rows or 9 terminals of about 101*27. To have this much text I use the minimum font size I can see which is unreadable when I first wake up which is bad for the woken by network management system alert situations. Also 16G of RAM is a bit of a limit, the Thinkpad X1 Carbon has 4G of swap space and it s all used most of the time. While there s usually plenty of buffer/cache RAM it does sometimes get to an OOM situation.
Another issue is that the battery is approaching it s end of life. The upower -d command reports the following which might imply that the battery should last more than 80% of the time when it was new, but testing shows that the time I can use it on battery is not much more than half what it was when I bought the laptop, maybe 1/3 of the battery life when new. I used to be able to consistently run the machine on battery for 7+ hours and still have plenty of charge left, now I can t even get 5 hours.
I could buy a new battery for about $70, but there are plenty of things I can do with that laptop for which 1/3 the designed battery life is more than enough. Also I have a couple of USB-C batteries that are capable of supplying 30W+ to power a Thinkpad X1 Carbon but they are inconvenient and I d rather have external batteries and an internal battery that will last most of a day.
My Thinkpad History
Below is a table summarising most of the Thinkpads I ve owned. I really like the Trackpoint on Thinkpads and have not considered buying a laptop without one. I skipped two laptops I bought in the 2000-2002 time period, that was an expensive laptop time for me. Fortunately by 2000 ebay was getting useful so I only ever had to buy one brand new Thinkpad.
So I ve spent $2675.70 on Thinkpads that I used from 2010 until now (not counting the one I just bought), so that s $160 per annum for the past 16 years and 9 months.
When I convert that to 2025/2026 dollars that s $3,221 for 16 years 9 months or $198 per annum. So I just need to make this T14 last for 2 years to be spending less than usual.
Some Generic Laptop Advice
A while ago I was asked for advice on buying a laptop for an architect to use. I can give good advice for laptops used by programmers and for home use and students but I really don t know what an architect does and even a description wouldn t do it justice.
The advice I gave was to buy or borrow a relatively low end laptop, something that costs $400 new or $300 second hand and give it a go. Using it will reveal that it doesn t do what is desired in some ways, whether it s screen resolution, RAM, CPU power, storage capacity, physical size/weight, or some combination of them is something you won t know until you try it. Then after having used a cheap laptop they could buy a laptop for $1500+ (for serious work use by people outside the IT industry buying a new laptop is recommended) knowing what features they really need.
So I have gone through a similar process of buying different laptops and discovering the benefits which has arrived at the T14.
The New Thinkpad
Upsides
I saw a Thinkpad T14 with 4K display and 16G of RAM on Facebook Marketplace advertised for $400 and they ended up selling it to me for $300 without the SSD and without the PSU. The seller has a business of selling used enterprise gear so he was happy to keep the SSD and PSU for sale with other laptops. I don t have a need for more laptop PSUs as I have most of the laptops in my fleet charged from 200W+ PSUs that charge multiple devices and I also have a collection of spare SSDs.
$300 for a laptop with 4K display is a good deal. The T14 is significantly better than the T14s because it has one SODIMM socket while the T14s has soldered RAM, so I could expand the RAM to 48G at some future time but with current prices I bought an 8G SODIMM for $40 so 24G will have to do for now. That gives a total of $340 plus the value of a SSD.
My first tests with the 4K display I set the display scaling to 150% (previously I had 100% which was a little small for some parts of the display). For my current favourite terminal emulator Kitty I had the Terminus font set to 10.5 point and now have it set to 9.0 point. This set of changes took the amount of text displayed in terminals from about 300*80 to about 330*100 while also increasing readability. This is a very significant improvement. If I knew that 4K in a 14 display would be so good I d have got it years ago!
The T14 still fits in the pocked of my ScotteVest jacket [2]!
Neutral
The i7-10610U in my new Thinkpad scores only about 10% faster on Passmark than the i7-8550U in my previous one. That s disappointing given that Intel had another 3 years of research to develop it and it s running with faster RAM. The two CPUs have the same TDP so it s just a 10% performance gain over 3 years and no change anywhere else. If the new CPU had a lower TDP then the small performance increase would be understandable.
When I first booted the system Chrome graphics were corrupted and system performance was bad, after installing the packages firmware-nvidia-graphics and firmware-sof-signed to deal with the kernel errors about not finding firmware the graphics display was correct and the system ran a lot faster. I had forgotten about the issues related to having NVidia and Intel GPUs on the same system that I had dealt with in previous T series Thinkpads.
In the systemd-boot loader.conf file I added console-mode 0 to prevent the font being ridiculously small for the boot selection.
The battery life seems like it might be a bit less than my previous laptop was when I got it, but it s definitely better than the previous laptop gives now.
Downsides
The screen is very shiny, I prefer the screens with matt finish to avoid seeing reflections. The anti glare screens for the T14 are for FullHD and worse while the glossy screen is the only option for 4K.. Maybe I should investigate one of those hoodie jackets with a hood that s large enough to cover the screen, they are being sold as a privacy feature but can also be used to avoid reflection. As an aside if you are in an environment with hostile parties then you really shouldn t block your vision of them.
A problem I previously had with T series Thinkpads which contributed to the replacement of two of them is the screen hinges breaking. This laptop is significantly heavier and more solidly built than the X1 series I ve been using and opening and closing the screen takes a lot more force. I am now wondering if I ll be looking for a for parts condition Thinkpad on ebay in the future. It seems that cracking the screen is a much more common failure case than breaking the hinges so hopefully there will be spares available. But as my previous T series thinkpads lasted 7, 3, and 4 years this one could be expected to last until 2030 and maybe by then giving it to someone in Vietnam and buying a replacement would be the easiest option.
Future Laptops
I thought that going from 2560*1440 to 3840*2160 I would be hitting the diminishing returns range but it seems that there are still further gains to be found in screen resolution for my use, maybe the Apple people with their Retina displays are on to something. There are Thinkpad X1 Carbon models with 3840*2400 displays, so maybe that s something to move on to in a few years. The minimum model with 3840*2400 is the X1 Carbon Gen 9 and there s the X1 Yoga Gen 6 with an OLED 3840*2400. There s also the P series which has 16 3840*2400 displays which would allow more usable text with the caveat of being much less portable.
It sucks that no-one seems to be making a laptop with more than 3840*2400 resolution. 5120*2160 desktop monitors are common and affordable nowadays. I m sure that even now I could use more than 3840*2400 in a 14 laptop and when I was younger I could have benefited from more than 3840*2400 in an 11 laptop if such hardware had been available.
Debian's Cloud Images for various
public cloud platforms and VM environments are built using a tool called
debian-cloud-images,
an in-house utility developed and maintained by the Debian Cloud Team.
What?
The debian-cloud-images tooling uses FAI (Fully Automatic Installation) to create
custom VM images for public clouds like GCP, Azure, and AWS, along with the
genericcloud class. I wanted to convert this into a fully declarative, mkosi-based
image build where the entire image is described using INI-format configuration files,
with only a few post-installation scripts to handle final customizations.
Why?
I've been working with various image customization formats for a long time. In my
previous company, I used to build customized industrial PC distributions based purely
on Debian using multistrap and a bunch of shell scripts to stitch together raw image
creation, bootloader installation, etc. I've also done custom installs using
debootstrap on my own laptop with systemd-boot as the bootloader, but that was
mostly hand-crafted and not automated. Once I came across mkosi, I was impressed by
how a single utility can do everything and churn out a fully usable image without extra
glue scripts for partitioning and image creation. You still need a few scripts to
finalize some parts of the installation (via postinst hooks), but those are very
minimal.
So I decided: why not convert debian-cloud-images into mkosi's declarative format
with a few architectural changes? My requirements were:
Btrfs as the root filesystem: Partly because I like it, but primarily for the
ability to use transparent compression (zstd:1), subvolumes, and snapshots for
atomic rollbacks when things go wrong.
systemd-boot and Unified Kernel Images (UKI): Primarily because systemd-boot
is clean and minimal exactly what a modern bootloader should be. Combining it with
UKIs and UEFI Secure Boot is bliss compared to the complexity of the GRUB2 world.
Note: This intentionally drops legacy BIOS (MBR/CSM) partitioning support in
favor of pure UEFI. Modern cloud platforms (AWS Nitro, Azure Gen2, GCP) support
UEFI natively, and dropping BIOS allows shedding significant legacy bootloader
baggage though it does make these images unsuitable for older, non-UEFI hypervisors.
Implementation
Of course, the initial heavy lifting was done mostly using Antigravity (agy), along with
debugging, tuning, and cleanup from my side. I pointed agy to a local copy of
debian-cloud-images and laid out my requirements: preserve parity with the original
packages and configurations, while enabling selective builds for each cloud via modular
profiles. The resulting specification is documented here.
The repository also includes a verification script
that audits functional parity against official images produced by debian-cloud-images
(verifying packages, APT deb822 sources, and systemd services, while accounting for the
switch to Btrfs and systemd-boot). Initial verification was performed for all Trixie
profiles, and the parity report is published here.
I've also booted the genericcloud profile image under UEFI in a local VM to verify
live bootability, bootctl status, network connectivity, and APT repository setup.
This completes Phase 1 of the implementation. The remaining phases outlined in the
specification include:
Phase 2: Immutable Images with dm-verity:
Configure Verity=hash in systemd-repart's 10-root.conf. Enable mkosi auto-signing
for the verity root hash and pass the root hash into UKI kernel command lines
automatically.
Phase 3: Secure Boot & Signed UKIs:
Integrate SecureBoot=yes with custom owner keys or ShimBootloader=signed using
Microsoft Third-Party CA signed shim binaries.
Phase 4: System Extensions (systemd-sysext):
Decouple cloud vendor agents (AWS CLI, Azure waagent, GCP guest agent) into separate
.raw system extensions. Maintain a single unified, signed base OS image across all
cloud platforms.
Phase 5: Btrfs Automated Rollbacks:
Combine Btrfs @snapshots with systemd-boot snapshot boot entries for fail-safe OS
upgrades.
Another advantage of this setup is that the same tooling can build images for physical
laptops and bare-metal servers. For example, in an earlier post, I walked through live-booting
with debootstrap and manually configuring systemd-boot for a custom UEFI
installation. With mkosi, I can simply generate a customized image locally with UKIs
ready to go, live-boot the target machine, and write the image directly to the root disk.
Conclusion
This experiment is an exploration of the power of mkosi; I haven't discussed adoption
with the Debian Cloud Team yet. For now, this will continue as my pet project. While
I won't be hosting pre-built binary images, anyone interested is welcome to clone the
repository and build the images locally.
I will probably take some more time before tackling dm-verity images, as I want to
understand the nuances thoroughly before experimenting with them. Until then, happy
hacking! Please report any issues or suggestions on GitHub.
Just because most people hold AI a certain way, doesn t mean that we always must, either now or in the future.
As I noted in that piece, and my shades of gray post, I am well aware and agree with the notion that a lot of frontier AI models have disturbing ethical concerns that we shouldn t dismiss, including concentration of power and wealth, environmental concerns, unethical scraping and training, the financial bubble they seem to be creating, and more. The most poisonous of AI cheerleaders are accelerating enshittification while cutting quality all over the place. AI slop is also a real problem, which I ll discuss in a bit.
Before I dive in, I need to mention that no AI assistance was used for writing this post, and I have been using em dashes correctly for years before LLMs did. Secondly, while popular discourse seems to use AI and LLM interchangeably, the AI field is much more broad and much more old than LLMs. I will, nonetheless, adopt the common AI jargon here, but be more specific when necessary to differentiate.
In The Reverse Centaur s Guide to Life After AI by Cory Doctorow, he presented two ideas I particularly want to focus on here:
The present and future of LLMs outside of the cloud-hosted frontier models
What differentiates productive use of AI from slop
The two are related, in fact. Doctorow discussed how he never uses AI to write anything, but he sometimes uses it as an assistant to help him write. Is that contradictory? Not really. He gave this example: he remembered a quote from a podcast, which he wanted to cite and attribute correctly. But he couldn t remember which podcast or who said it. So he fired up Whisper, an open-weight model you can download and run locally, even on meagre hardware. Whisper is a speech-to-text model. Doctorow ran likely podcast episodes (from the target range and set of podcasts he listens to) through the model, and at that point it was a regular search. He found the quote, then went back and listened to the episode at that time spot to verify its accuracy.
It would have taken so much time to do this without Whisper that he simply would not have done it otherwise. His writing was better because of AI. Not because AI wrote any words for him, but because it helped him find the right ideas and attributions. He didn t even have to trust its transcription; it pointed him at the right place, and then he could transcribe with precision.
I too have used Whisper in much the same way. A little while back, I digitized many hours of old family audio recordings going back to the 1970s. Thanks to Whisper, which I ran locally primarily during hours of being fully solar-powered, I have a searchable index to these gems. A person I know recently asked me if I knew any way to transcribe some old family recordings he had. I told him I could run it through Whisper. It wouldn t have great punctuation, but most of the words would be there. This meant a lot to him and his family; what I did in 2 minutes would have taken him many days (I presume he is not a fast typist as well.)
So we can start by naming: AI isn t just chatbots, and AI can help even if it isn t writing anything.
Doctorow goes on to ask the question: what happens after the AI bubble bursts? I do believe it will, as Ed Zitron has carefully documented for us for a long time now. The environmental damage done by frontier training and inference in the last few years will, of course, be done. But as he points out, we ll be left with a plethora of surprisingly-capable open weight models, a community that has made significant strides running them on low-end devices (even phones), and a massive buildup of clean energy that hopefully will be finally able to offset some polluting energy once these heavy users drop off the grid.
So then what? Will the world just throw away the likes of Whisper and Gemma? Obviously not. Doctorow imagines, credibly, a situation in which individuals and universities tinker with locally-run models, iterating on them and improving them with the more traditional scale of resources available to individuals and universities. In other words, this future sounds a lot like the earlier days of Open Source.
As Ed Zitron has pointed out, the real costs of frontier AI have been hidden as these companies rack up fantastical losses. When the bubble bursts, the real costs of frontier AI are likely to be high enough that CEO s won t be able to ignore the poor ROI. But we ll be left with these artifacts, these open-weight starting points, that people can use.
That brings me to my central thesis: a lot of anti-AI sentiment is focused on the real downsides of the hyped uses of AI, and fails to account for the more ethical advances being made now, and likely to come in the future.
Varying quality of AI use
We are all familiar with AI slop. I ve seen it, and have an increasingly skeptical eye when I see new projects announced in even places as niche as a BBS community (where I see things like new terminal emulators announced, written in shockingly-poor nodejs, and such). I ve seen documents that take many pages to say what amounts to nothing intelligble to a human, with perfect grammar. I ve seen pull requests that have a description that amounts to several pages of slop. I ve personally seen an AI agent do things like correctly detect passing an untrusted argument to a shell, then propose a broken quoting algorithm to fix it (rather than proper sanitization and exec() or, better yet, avoiding the call altogether.)
I ve also seen AI tools very quickly and accurately identify bugs that had passed human review, even professional security reviews, for years. I ve seen them bring more joy to some people s jobs by handling the more drudgery parts of the jobs. One of my favorite podcasts, Oxide and Friends, had an episode called Engineering Rigor in the LLM age and credibly described ways in which careful use of LLMs can increase quality and safety. Yes, I said increase. (Oxide and Friends are not hype cheerleaders by any means; these are very serious people with solid technical chops, and I know some of them.)
What accounts for this disconnect?
We can point to many factors, but Doctorow asks a fundamental question: who is in charge? Is it the person or the computer? Does the AI service people, or do people service the AI?
In some of the most ridiculously AI-first companies, it is very clearly the latter. Mandates from CEOs to increase AI usage lead to perverse outcomes that sacrifice quality. The AI is in charge. I ve never seen an AI be any good at design questions, and it s no wonder than all these vibe-coded apps have the same generic feeling of crappiness.
But when the AI is used pragmatically as a junior research assistant, that s a different approach. Its output is greeted skeptically, its actions distrusted, and it s never asked to design something. These are the cases where I ve seen it make a meaningful difference.
It s not black-and-white
All this adds up to why I was opposed to the Debian proposals that would have banned LLM use. Those votes are hard to change. They would have left Debian in a vulnerable position of being unable to react to accurate security findings if they originated with an LLM, or left Debian unable to adopt ethical use of models.
It would be akin to saying you should never buy a PC because Windows 11 is terrible. I agree Windows 11 is terrible, but saying something like that is so dismissive of all those that have invested decades of their time in building something better.
So, I find AI hype to be uncredible and dangerous. I also find knee-jerk reactions to AI to be the same. They are actually a form of capitulation: they let the AI megacorps dictate the terms of the conversation to revolve around them.
Case study: Debian s DFSG scanner
For a long time, my two biggest annoyances with Debian have been the difficulty of packaging Rust and Go packages with their long dependency trees, and how long it takes a new package to get reviewed. About a year ago, the latter process was set on a path to reform, and it has gotten dramatically better. It also cuts off a potential connection with someone that hasn t yet heard of Linux. Some people may not jump from Windows 11 (or the ChatGPTs of the world) immediately, but pretending that it s ChatGPT or nothing does a disservice to all those that are trying to do research etchically.
We should state at the outset that Debian takes compliance with the Debian Free Software Guidelines (DFSG) extremely seriously. Every new package gets a review, and these reviews often catch things that upstream repos and other distros don t. One common example would be a package that has a stated copyright and license, but then includes files that bear a different copyright and license.
You can imagine reviewing packages at this level of detail isn t a fun task for people, and it s hard to find volunteers to do it. Perhaps the answer to this should be Debian should stop caring so much more than everyone else , and perhaps you re right (and perhaps you aren t).
In any case, the DFSG team that reviews this added what amounts to an LLM-backed license linter. Its job is to produce an initial assessment that the license statements documented in debian/copyright are correct, thorough, and in compliance with DFSG. This report was not taken to be authoritative, but was designed to help with some initial assessments.
There were some predictable reactions. People were angry that the DFSG team had added this tool without any communication about it (justifiably so, I d say). Many were angry just because of LLM. People made assumptions about what kind of model it used, what kind of quality it would produce, how definitive it would be in the project.
It is worth noting here that Debian is uniquely decentralized. There is a central policy, but maintainers are free to maintain their packages how they like. They don t have to use a standard location for a Git repo, or even use Git.
One person said essentially, it s fine for others to use whatever tool they want, but I shouldn t have to be exposed to LLM slop. The other perspective boiled down to, why should they keep the reports secret? If you want to proactively fix things, or flag false positives, why not?
As Andreas Tille wrote, I have read the LLM reviews carefully, and in many cases their findings inspired additional commits to improve my packaging. In some cases, they even helped me catch mistakes that led me to reject an upload myself before human inspection.
Joey Hess raises an interesting risk: that LLMs will remove the incentive for Debian to actually fix its cumbersome processes, by letting an LLM paper them over. I have seen this tendency in other contexts, both at work and at home, as well. It s a real risk, especially if Debian doesn t tackle the packaging problem for Rust and Go.
The Mastodon post that prompted me to write this began a chain of events that started with Uploaders will be forced to address LLMs issues without human inspection. I don t believe that will be the case; it goes too far against the Debian ethos.
I encourage everyone to take a deep breath. We are all getting used to a shifting landscape. We will all make missteps, myself included. The issues are complicated, the picture isn t black and white, and there is incredible hype around the ecosystem that can make finding nuance difficult.
Let s be kind to each other, fellow humans.
But, I do not care if you are kind to Claude.
Orphaned usbguard with version 1.1.4+ds-5 and usbguard-notifier with version
0.1.0-4
The orphaning of usbguard and usbguard-notifier is because I don t use those
packages anymore. I rather spend my time on FOSS projects in areas I get
something out of. This is also due to a growing frustration with the Debian
community. The discussions on the mailing lists in the recent months lacked any
sense of social etiquette. The delusional conviction that certain tools improve
the work environment for EVERYONE took on religious overtones.
This is all the more troubling now that even central infrastructure is being
drawn into this forced blessing. And it seems there is absolutely no
awareness here of the boundary violations that are being normalized. Reminds
me a bit of christian missionaries.
DH Related Work
In the APIS project I finally merged the search app I wrote a couple of months
ago. Based on the proof of concept for the HTMX autocomplete, I implemented
an autocomplete that uses the search app for the results, therefore allowing
to list search results of multiple content types. I released 0.68, 0.69, 0.70,
0.71 and 0.72 of the APIS framework. The 0.68 release changed the way we list
the Django content types, leading to less database hits. In the 0.71 release I
refactored the detail & edit views for generic models.
40C3
I was torn about whether I should go to this years congress, but in the end I
decided to go again. I guess it will be something about the 20th time I m
attending.
The Current Situation
Before the US and Israel started attacking Iran at the end of February the petrol prices in Australia were around $1.70/L, which for American readers is roughly equivalent to $US4.64/Gal. By the 11th of March the prices were around $2.19/L. Over the same time period Diesel went from around $1.77/L to $2.40/L. The 11th of March prices weren t necessarily unreasonable prices. In mid March it was reasonable to expect that the US would stop doing such ridiculously stupid things and make a deal with Iran to allow oil to be transported.
But every time you think there s a limit to Trump s stupidity (and the incompetence of people around him who don t point him in the right direction) they do something worse. So now we have the Strait of Hormuz almost entirely closed cutting off oil from Kuwait, Qatar, and UAE. The Bab al-Mandab Strait is closed to Saudi linked ships and the Saudi East-West pipeline is closed so once the Yanbu storage tanks are empty there won t be much if any oil from Saudi Arabia for some time. So world oil supplies will be significantly reduced for a long time.
Currently the petrol prices in Melbourne are around $2.30/L and Diesel prices around $2.70/L, not much more expensive than it was in March in spite of all the extra problems both militarily and diplomatically since then. Those prices have been steady for over a month.
The blockade of the Strait of Hormuz could be ended fairly quickly and there are reports that a lot of the oil that used to go through it is being re-routed. The damaged infrastructure throughout the middle east can t be fixed in a hurry. The Bab al-Mandab Strait probably can t be opened quickly as the Houthis probably don t have a centralised command structure that allows someone to order a ceasefire and have it stick. So we can expect a massive reduction in world oil supplies for a while, which given the way the US is going could be at least until after the mid-term elections (November this year) and possibly until after the 2028 elections. After that oil production will be reduced for another year or two to rebuild infrastructure.
The Problem
When supply can t meet demand there are three options. Supply can be rationed, demand can be decreased by increasing the prices, or it can be used up and we run out. Running out of fuel is a really bad option as fuel is needed for producing and transporting food and for most things that are important to a society.
Governments of first world countries seem unable to deal with the situation properly. Dealing with it properly requires either rationing or increasing the prices. Instead governments have been more interested in artificially keeping the prices down.
Currently in Australia and most countries a significant portion of public transport depends on Diesel fuel. Diesel is needed for most buses and for long distance trains. Most taxis run on petrol. As far as I know all emergency service vehicles run on Diesel or petrol as well as most military vehicles. So things will get really bad quickly if fuel runs out entirely. It s not just personal cars that are affected.
We aren t going to get the majority of tractors converted to electric power any time soon. Google search results suggest that tractors last an average of about 25 years but casual observation of working equipment on farms suggests a longer life than that is common. Some tractors could be retrofitted to be electric but many will end up being scrapped as part of a conversion while farmers are already having financial problems. It would probably be optimistic to expect that half the tractor use could be done with electric tractors in 10 years time unless there are significant government subsidies. To get the farming and food production industries adapted for electric operation in a few years would be possible but it would take a level of national mobilisation that only happens during wartime.
What We Need
As a long term solution we need to have more electric vehicles in every category. We need electricity for all train lines to replace Diesel locomotives. We need better trains between cities to reduce the need for aeroplanes, electric aeroplanes are being developed but we aren t there yet. We need all essential services to be run with electric vehicles including farming, food transport, emergency services, and everything related to the medical system (including personal cars for healthcare workers). We also need mining vehicles powered by electricity so we can have the entire industrial system running without fuel. None of this is going to happen in time for this crisis.
Electric buses are being introduced in Australia and many taxis are electric. The recent significant increase in the use of electric cars probably includes a reasonable portion of healthcare workers and other essential workers. This gives us the potential to survive fairly severe reductions in the fuel supply without everything collapsing. But we have a significant lack in electric police cars and in electric trucks for food delivery.
In the short term we need to significantly reduce the use of fuels, there is no other way to keep the food supply and other essential parts of society working. We could try rationing but I think that should be a last resort. The news reports of a de-facto petrol rationing system in Crimea and parts of Russia are not positive, significant resources are wasted in long queues for petrol and there is public disorder caused by disputes about position in the queues. The level of sanity in the population seems to have dropped significantly since the fuel crisis of 1979, any fuel rationing that is implemented now would get the same sort of opposition from Qanon types as Covid vaccines and lockdowns did in recent times.
So the best viable option seems to be to reduce demand by increasing prices. $2.30/L as a common price with occasional spikes of $2.50/L isn t sufficient to do that. If the price increased to $3.50/L, twice what it used to be (equivalent to $9.50/gallon for Americans) then it would provide a real incentive for people to reduce fuel use. That would have to be combined with the type of remote work allowances that were in place when Covid19 was first spreading. But I think that all politicians are too weak to do such things. The media have demonstrated that nowadays the best we can expect is that they will treat both sides as equal even when facts clearly support one side, so we can t expect the media to report on impending fuel shortages and demand policy changes to address them.
We should have higher taxes on fuel that will continue past the resolution of the current crisis caused by the attacks on Iran to provide incentives for the purchase of electric cars and for manufacturers to make more fuel efficient cars. Currently people are basing car ownership decisions on the expectation that petrol will go back to something under $2/L and we need to have a government guarantee that it won t happen.
People always complain about poor people who can t afford to drive if petrol is expensive but that could be addressed by increasing the minimum wage and social security payments. But a large portion of the people who complain about the hardship poor people may face when fuel prices are discussed are against increasing the minimum wage so I don t think they are being honest.
Another common complaint is about the difficulty driving long distances in rural Australia when there isn t sufficient charging infrastructure for electric cars and therefore rural people including farmers getting hit by high prices of fuel. There could be a rebate scheme for farmers etc, government subsidies for farmers is nothing new.
What Will Happen
I expect the governments of most first world countries to try to keep fuel prices low and do very little to try and decrease demand. China will probably do some things to reduce fuel use and being the world s largest oil importer this will make a difference, but not as much as we need.
A related problem is that a lot of fertiliser is produced from petrochemicals and closing the strait of Hormuz cut off a significant portion of the world fertiliser supply. First world countries will outbid developing countries for fertiliser and fuel. Starvation in developing countries probably won t get much news coverage until it leads to war.
This is not going to go well, it could be addressed if we had braver politicians and more honest media companies but that s not the way things are going.
A new release 0.4.29 of RQuantLib
arrived on CRAN this evening,
had already been built for r2u as well as on r-universe and
has just been uploaded to Debian.
QuantLib is a rather
comprehensice free/open-source library for quantitative
finance. RQuantLib
connects (some parts of) it to the R environment and language, and has
been part of CRAN for
twenty-three years (!!) as it was one of the first packages I uploaded
to CRAN.
This release of RQuantLib
brings two new calendars (Malaysia, Philippines), updates to a number of
other calendars as well to other files, and two deprecations we are
reflecting in this release. It also benefits from a number of careful
and attentive pull requests by Maximilian Muecke cleaning up an
(astonishing !!) number of likely rather old little bugs. Full details
from the NEWS file follow as usual.
Changes in RQuantLib version 0.4.29 (2026-10-13)
Configure check for outdated QuantLib version updated,
Adjust two instantiations on macOS x86_64 with old
compilers
Correct Euribor2W and Euribor3W tenors setters (Maximilian Muecke
in #196)
Accect Euribor1W as alias for EuriborSW tenor (Maximilian Muecke
in #197)
Correct default handling of the payFixed parameter (Maximilian
Muecke in #198)
Assign missing S3 class to American option implied volatitly
return (Maximilian Muecke in #199)
Correct spelling in manual pages and R code (Maximilian Muecke in
#202,
#203)
Support additional Polish settlements (Maximilian Muecke in #204)
Check for curve parameters in FittedBondCurve (Dirk in #205
fixing #201)
Reflect two deprecations in QuantLib 1.44 and adjust code in two
spot (Dirk in #206)
As a casual user of Gmail, I find its ability to recognize when I ve received
tickets, invoices, and flight confirmations, and to display this
information in a structured way, very useful. Flights appear directly in Google
Calendar, parcel delivery statuses are tracked, and reservations are easy to
find at a glance.
However, my main email address is not Gmail, and I don t want to migrate
to Gmail for a number of reasons (privacy, data sovereignty, vendor lock-in).
At the same time, I missed having that automatic extraction: having flight and
train bookings appear in my calendar without manual copy-pasting, keeping track
of incoming parcels, and having invoices neatly organized.
JSON-LD and schema.org
There is an established standard format for structured data called
JSON-LD, which is used by Google and other search
engines to extract structured data from web pages. JSON-LD represents linked
data using JSON, and it can be embedded directly in HTML documents.
Email messages can also contain structured data in the form of JSON-LD,
which can link the information in the email to external data sources. There are
standardized schemas for structured data in email messages, such as the
schema.org vocabulary, which defines types and
properties for describing entities including flight reservations, train trips,
hotel bookings, parcel deliveries, and invoices.
For example, an email containing a flight reservation might embed the following
JSON-LD snippet:
1 2 3 4 5 6 7 8 91011121314151617181920212223
"@context":"https://schema.org","@type":"FlightReservation","reservationNumber":"ABC123","underName":"@type":"Person","name":"John Doe" ,"reservationFor":"@type":"Flight","flightNumber":"AA123","departureAirport":"@type":"Airport","name":"John F. Kennedy International Airport" ,"arrivalAirport":"@type":"Airport","name":"Los Angeles International Airport" ,"departureTime":"2026-11-01T10:00:00-05:00","arrivalTime":"2026-11-01T13:00:00-08:00"
When this is present, reading email data is clean and straightforward. The
reality, however, is that only a fraction of vendors actually include
schema.org markup in their emails. Most airlines, train operators, couriers, and
web shops still send regular HTML or plain-text messages with arbitrary layouts
that change over time.
Mailsift
To bridge this gap on my own infrastructure, I built mailsift. Written in Rust, it is a daemon and CLI
tool that monitors incoming email, extracts structured information, and routes
it to standard files and services.
Rather than locking data into an internal database, mailsift embraces the Unix
philosophy: it delegates extraction to small, isolated programs and files the
resulting structured artifacts into standard formats and protocols:
Calendar events & reservations: Turned into iCalendar (.ics) events and
pushed directly to a CalDAV server (such as Xandikos)
or stored in a local directory.
Bills & invoices: Extracted as structured JSON records, organized by year,
and optionally synced to a personal finance manager like Firefly III.
Parcels: Extracted as delivery records keyed by tracking number, merged
across status update emails, and optionally registered with tracking APIs like 17track or Karrio.
Tickets & boarding passes: Saved as PDFs, Apple Wallet passes (.pkpass),
or images, accompanied by JSON metadata sidecars linking them to the booking.
Receipts & orders: Filed as JSON records, synced over WebDAV, or forwarded
via email.
How extractors work
Mailsift decouples the pipeline that handles emails from the logic that parses
individual vendors. It discovers extractors from a directory of manifests.
The contract between mailsift and an extractor is deliberately simple:
Input: The raw RFC822 message is fed to the extractor on stdin.
Execution: The extractor runs in a fresh, temporary working directory,
with a strict timeout (typically 10 seconds).
Output: The extractor writes zero or more named artifact files into its
working directory and exits 0.
Extractors can be written in any programming language. In practice, most are
small Python scripts that parse HTML with regexes or BeautifulSoup, using a
small helper library (mailsift_extractor) that handles Unicode normalization
and HTML body stripping.
Filtering and DKIM verification
Spawning a subprocess for every single email in an active inbox would be
wasteful. Each extractor therefore has a YAML manifest declaring prefiltering criteria:
Before running an extractor, mailsift evaluates the message headers and MIME
structure - possibly converting it to an IMAP filter. If the sender domain or
subject doesn t match, or the required MIME parts are missing, the extractor is
skipped immediately.
Crucially, the manifest can also require a valid DKIM signature via
require_dkim. Mailsift inspects the Authentication-Results: header
produced by the receiving mail server. This guarantees that an extractor only
processes messages that genuinely originated from the vendor s domain,
preventing forged emails from injecting fake calendar events or bills.
Generic vs. vendor extractors
Extractors fall into two categories:
Generic extractors: schema-ld inspects the HTML for any
<script type="application/ld+json"> blocks conforming to schema.org
reservations. Another extractor, ics-passthrough, extracts standard
iCalendar attachments.
Vendor-specific extractors: For vendors that don t include structured
markup, dedicated extractors parse the message text. For instance, the
easyjet extractor looks for booking references and flight tables,
producing a standard FlightReservation artifact:
The collection of extractors is maintained in a separate repository,
mailsift-extractors, and
currently includes nearly 60 extractors covering airlines (British Airways, KLM,
EasyJet, Transavia, Eurostar), transport (NS, SNCF Connect, FlixBus), package
carriers (Royal Mail, DPD, DHL, UPS, Evri, PostNL), online orders, and utility bills.
Handling forwarded mail
In real life, travel bookings or receipts are often forwarded by family,
friends, or colleagues. By default, forwarded mail would fail sender checks, and
DKIM signatures on inline forwards are broken by mail clients.
Mailsift handles this via a trusted_forwarders configuration. When an email
arrives from a trusted forwarder, mailsift unwraps the forwarded message:
Attachment forwards: If the original email was attached as
message/rfc822, mailsift extracts the original message and re-evaluates
the vendor s DKIM signature on the inner message.
Inline forwards: Mailsift reconstructs a synthetic RFC822 message from the
client s forwarded quotation header block and quotes, deriving a deterministic
Message-ID.
This means hotel confirmations or flight tickets forwarded by a partner still
end up in the family calendar automatically.
Running mailsift
Mailsift fits into existing email setups in several ways:
Dovecot Sieve
For local delivery, Sieve provides an elegant integration using the
sieve_extprograms plugin. Because Sieve runs during local delivery after
Dovecot has validated DKIM and added Authentication-Results:,
require_dkim checks work as expected:
12
require["vnd.dovecot.pipe"];pipe:copy"mailsift";
The :copy flag ensures the email continues to the user s inbox while a copy
is piped through mailsift.
IMAP watching
If you don t run your own mail server, or want to process mail on an existing
remote mailbox, imap-scan connects over IMAP:
With --watch, mailsift uses IMAPIDLE (RFC 2177) to wait for new messages
and process them as they arrive. It supports standard passwords, Kerberos (SASLGSSAPI), and OAuth2 (XOAUTH2) for providers like Gmail and Microsoft 365 via
an interactive mailsift imap-auth flow.
Other modes
Postfix Milter: mailsift milter runs as an MTA filter, processing
messages in real-time as they pass through Postfix.
Maildir scan: mailsift maildir-scan walks an on-disk Maildir folder,
useful for backfilling historical mail.
Replay: mailsift replay message.eml runs extractors on a single
saved message file, which is invaluable when writing or testing an extractor.
Web UI and RESTAPI
In addition to routing data to CalDAV and disk, mailsift includes an optional
read-only web dashboard (mailsift web):
$ mailsiftweb--listen127.0.0.1:8088
The dashboard provides an overview of upcoming trips, arriving packages,
unpaid bills, and recent orders. It rescans the artifact directories on request,
so it stays in sync with incoming mail without needing a separate database.
JSON endpoints (such as /api/parcels.json or /api/bills.json) are also
available for custom status scripts or home automation dashboards.
Status and getting involved
Mailsift has been running reliably on my mail server for over a year, and having
flights, hotel bookings, and train journeys seamlessly sync into my calendar
without relying on proprietary cloud services has been very satisfying.
The project is free software under the GPL-3.0:
Adding support for new vendors only requires writing a small YAML manifest and a
Python script with a couple of regexes. If you have vendors you d like to
extract data from, contributions of new extractors are very welcome!
This is a copy of an email I sent at work. I'm not sure I
should be making noise about this here, feedback welcome.
This is your bi-yearly reminder that time is changing soon! October 25th
in Europe, November 1st in North America. Less people in Canada are
changing this year, with BC, Alberta, Manitoba and Northwest
Territories getting rid of DST.
What's happening?
Some places in the world implement what is called Daylight saving time
or DST:
https://en.wikipedia.org/wiki/Daylight_saving_time
Normally, you shouldn't have to do anything: computers automatically
change time following local rules, assuming they are correctly
configured, provided recent updates have been applied in the case of a
recent change in said rules (because yes, this happens, and happened
this year, and yes, you need to upgrade your software!).
Of course, appliances like your microwave oven will likely not change
time and will need to adjusted unless they are so-called "smart", in
which case they are part of the skynet botnet and should be destroyed.
If your clock is flashing "0:00" or "12:00", you have no action to take
to adapt to this change, lucky you.
If you haven't changed time in six months, congratulations, your clock
will be accurate again!
In any case, you should still consider DST because it might affect some
of your meeting schedules, particularly if you set up a new meeting
schedule in the last 6 months and forgot to consider this change.
If your location does not have DST
Properly scheduled meetings affecting multiple time zones are set in UTC
time, which does not change. So if your location does not observer
time changes, your (local!) meeting time will not change.
But be aware that some other folks attending your meeting might have
the DST bug and their meeting times will change.
Be kind to those poor souls which might be missing meetings by a full
hour because time flies backwards for them.
If you do observe DST
If you are affected by daylight savings, your local meeting times
will change for UTC meetings. Normally, your meeting times are
scheduled to take this into account and the new hours should be
reasonable.
But now is a good time to verify that. Take a look at your schedule for
the next couple of weeks and reschedule meetings before the daylight
saving come up to avoid too much disruption. You have only a couple of
weeks to do so right now.
When do times change, how, and and where?
As regular readers will remember, the rule of thumb is:
Spring forward, fall backwards.
That is, during the season of Spring, the clocks move forward, and
during the Fall (like right now), they move backwards. That is in the
northern hemisphere, but then the southern hemisphere is often saner and
doesn't switch anyways.
So time will move backwards which means an extra hour of sleep. Unless
you have children or bad sleep, in which case your body doesn't care
about what the clock says and will wake up one hour earlier than what it
should.
And of course, this doesn't happen everywhere at once, so let's see when
it happens where.
Europe
The dance starts in Europe.
The change happens on the last Sunday in October at 01:00 UTC (not local
time!), that is October 25th. If you are in the central European
timezone, also known as Amsterdam, Berlin, or Paris time depending on
your national affiliation, that essentially means that at 2:59 local the
clocks will fall back to 2:00 instead of going to 3:00.
Concretely, set your watch back one hour before going to bed, go to bed
at the normal time, and enjoy an extra hour of sleep or leisure.
If you have kids, you might want to start getting them to bed slightly
earlier every day for a week before the change so they take time getting
used to the change. If you have trouble sleeping in the morning, find
your inner child and do that to yourself as well.
USA / Canada
Then it's the US[1] and Canada[2] joining the dance, on the First Sunday in
November at 02:00 local (not UTC!), that is, I believe, November 1st
2026.
This means that, at 1:59, the clocks will flip to 1:00, instead of 2:00.
Concretely, do like the Europeans and tweak your clock before going to
bed.
That is a little less than four weeks from now.
[1] except Arizona (except the Navajo nation), US territories, and
Hawaii
[2] except Yukon, Saskatchewan, (newly) British Columbia, (newly)
Alberta, (newly) Northwest Territories, (newly) Manitoba, one island in
Nunavut (Southampton Island), one town in Ontario (Atikokan) and small
parts of Quebec (Le Golfe-du-Saint-Laurent)
Other places with DST
This time again, I must apologize to the people of Cuba, Lebanon,
Israel, Palestine, Egypt, Chile, Australia, and New Zealand, as you fine
folks all have your own DST rules that are omitted here for brevity. I
rely on this page from Wikipedia to be updated by time nerds accurately
for this message, and it should provide you with a rough idea of what's
coming:
https://en.wikipedia.org/wiki/Daylight_saving_time_by_country
In general, changes also happen in October, but either on different
times or different days, except in the south hemisphere, where they
might happen in September (oops, sorry NZ folks, I'm late!).
Places without DST
Everyone else, enjoy, you're on the right side of history, and we thank
you for the good example you give us.
Changes since last time
There's been lots of changes since last time:
British Columbia moved to permanent -07 on 2026-03-09, that is it
will not change to normal time in November
Alberta moved to permanent -06 on 2026-06-18, similar to BC above.
Canada s Northwest Territories moved to permanent -06 on 2026-08-21,
matching Alberta.
Manitoba moves to permanent -05 on 2026-10-31.
Morocco moves to permanent +00 on 2026-09-20.
Moldova has used EU transition times since 2022, but the tz database
only noticed in 2026
This is my interpretation of the changes announced on the tzdata mailing
list here:
https://lists.iana.org/hyperkitty/list/tz-announce@iana.org/latest
If the eastward trend continues, Canada should adopt country-wide "no
daylight savings" rules by 2027, although there's actually no sign of
the other provinces (Ontario, Qu bec and so on) currently running bills
to change those rules just yet. Poor Canadians like me confused about
time in their countries can refer to this section of Wikipedia for
details:
https://en.wikipedia.org/wiki/Daylight_saving_time_in_Canada#By_province_and_territory
... and particularly the image featured there:
https://commons.wikimedia.org/wiki/File:Canada_time_zone_map-en.svg
It also seems like the US government might finally adopt a permanent
daylight saving change bill in 2026, as the "Sunshine protection act"
pass the house in July:
https://en.wikipedia.org/wiki/Sunshine_Protection_Act
True to form, this was associated with absolutely ridiculous pressure
from Donald Trump against republicans (his own party!) objecting to the
change:
On July 14, 2026, the House passed a Sunshine Protection Act bill
backed by President Trump. Nevertheless, the bill was opposed in the
Senate by Republicans, including Senator Cotton. In response, on
October 3, 2026, Trump shared a post on Truth Social urging Cotton to
approve the bill, where he revealed Cotton's personal cellphone number
and called on people to call him.
https://www.theguardian.com/us-news/2026/oct/03/trump-tom-cotton-daylight-saving-time
Given that the last time the US did a major change to the daylight
savings policy (in 2005), Canada followed suit to stay in sync, it's
quite possible Trump's mad dash might actually finish getting rid of DST
in North America:
https://en.wikipedia.org/wiki/Energy_Policy_Act_of_2005#Change_to_daylight_saving_time
With 26.10 in Feature Freeze, wore my Release team hat to:
Review and approve a bunch of Feature Freeze Exceptions, including the Go 1.27 transition, Qt 6.11.2, rust-coreutils 0.12.0, devscripts 2.6.12, kdump-tools moving to dracut, and a few GCE packages.
Point linux-entra-sso to the SRU team, as it didn t need an FFe at all, and milestone a couple of bugs for 26.10.
Continued to push for infrastructure improvements:
Made ubuntu-cdimage more resilient to Launchpad hiccups (MP).
Taught generate-freeze-block in ubuntu-archive-tools a couple of new options (--skip-update and --series) and better error handling (MP).
Bumped the arm64 generic non-cloud image to 4.5G in livecd-rootfs and uploaded it as 26.10.16; also sponsored the follow-up 26.10.17 for Chlo .
Reviewed quite a lot of MPs - britney hints, meta-release, ubuntu-release-tools, ubuntu-archive-tools, ubuntu-cdimage, livecd-rootfs, ubuntu-seeds, and so on.
Did Archive Admin, DMB, and Release team duties as usual.
Debian (E)LTS
This month I have worked 33.5 hours
on Debian Long Term Support (LTS)
and on its sister Extended LTS
project and did the following things:
(A quick note that I did quite a lot of the work during my work as Frontdesk that went on till 4th Oct, so 33.50 hours include the work I did till 4th October 2026.)
Released Security Updates
node-lodash: Prototype pollution in _.unset and _.omit (plus a bypass of the initial fix for it), and code injection via the imports option of _.template.
This is the bookworm follow-up to DLA 4663-1 that I carried over from July. The update had been sitting prepared and tested on debusine, so once the upstream discussion wrapped up, it went straight out. It also carries an extra patch to the lodash-cli dependency map - without it, the regenerated lodash.template module throws assignWith is not defined at runtime, which node-gulp-util s autopkgtest caught.
libpng1.6: Use-after-free of zlib input in png_read_end() after incomplete zTXt, iTXt, or iCCP decompression, which could result in denial of service.
I picked this one up whilst on front desk; the upstream fix that went into trixie via DSA 6537-1 applied to 1.6.39 as-is.
Work in Progress
libpng1.6: The same CVE-2026-46675.
[ELTS]: Claimed in ela-needed; the same upstream fix applies to all three ELTS suites, so this should go out shortly.
Other Activities
[E/LTS] Did my front-desk week from 28-09 to 04-10.
Over the week I did roughly:
Triage of 524 unique CVEs across 192 source packages and all four suites. And 1 automated ELTS end-of-life sweep.
Additional data is now part of the front-desk job too, so 75 commits record it for 179 CVEs across 71 packages.
Newly queued 22 source packages - 13 in dla-needed (apache2, chromium, firefox-esr, libnet-idn-encode-perl, libpng1.6, node-shell-quote, nvidia-graphics-drivers, openssl, pcre2, php-mongodb, php8.2, social-auth-core, and wpa) and 16 in ela-needed (apache2, firefox-esr, gegl, lemonldap-ng, libnet-idn-encode-perl, libpng1.6, libwebsockets, nsd, nvidia-graphics-drivers, pcre2, php7.0, php7.3, php7.4, rar, unrar-nonfree, and wpa), 7 of them in both. Also widened 3 ELTS entries to bullseye - antiword, ocaml, and openvswitch.
Most of the interesting work was again in the <not-affected> verdicts: 217 of 263 (83%, across 57 packages) rest on showing that the vulnerable code or feature isn t in the source we ship. Another 17 cover incomplete upstream fixes that we either never shipped or shipped with the follow-up already in (expat, libxml2, node-tar, and pyjwt). 15 come from bundled components we don t ship - node-ajv again, which uses uri-js and not fast-uri, and nvidia-open, which doesn t ship the NGX updater. And 13 are vendor- or platform-specific - openssh s CVE-2026-55654 lives only in a Red Hat GSSAPI patch, and the netdata and PHP ones only affect Windows.
Did 4 rounds of newly supported bullseye packages (33 packages overall), plus libmail-mboxparser-perl for buster - 34 in all. The existing CVE data mostly held up; the real finds were discovery gaps. One interesting gotcha: sid renamed stunnel4 to stunnel, and two new CVEs were associated only with the new name, so they never showed up for trixie, bookworm, or any ELTS suite. I also sorted the 180 Triage needed entries (57 packages) from elts-eol by where each was already handled, and triaged for ELTS the 100 that trixie or bookworm had already decided; the rest come next. And I imported 79 package-level lines for the older source names ELTS still ships (tomcat8, php7.0/7.3/7.4, netty-3.9, openssl1.0, python2.7/3.5/3.7, and pypy).
Caught some inconsistencies in released advisories: DLA 4801-1 (swift) was missing a CVE, ELA 1831-1 (redis) listed the wrong one, and DLA 4808-1 (network-manager-l2tp) listed CVE-2026-75883 - an ID that was renamed and then reassigned to an unrelated ppp issue. I fixed all three in the tracker s advisory lists.
Made the Security team and the uploaders aware of regressions from our own updates:
libde265: the CVE-2026-49337 fix in DLA 4789-1/ELA 1828-1 (and DSA 6413-1) misses upstream s follow-up commit.
libxml2 CVE-2026-76781 and policykit-1 CVE-2026-85498 were introduced by our own back-ports; the policykit-1 one is harmless.
expat: the CVE-2025-59375 backport in DLA 4807-1 is compiled out, because XML_GE is never defined.
xen: DLA 4818-1 s XSA-491 fix makes XSA-510 reachable.
gegl: the CVE-2026-2049/2050 back-port in ELA 1650-1 rejects valid RLE .hdr files.
log4cxx: DLA 4322-1 broke UTF-8 in JSONLayout output. That one is functional, not security.
Helped correct a set of triages and let the Debian Security team know:
ruby-json CVE-2026-71847: the vulnerable code was never in a released Debian version.
openssh CVE-2026-55654: only affects a Red Hat-specific GSSAPI patch.
three libxml2 issues that don t affect trixie either.
the stunnel4 rename above.
trixie <no-dsa> lines on jsch, node-qs, and ruby-loofah, where trixie s version doesn t have the vulnerable feature at all.
Independently found a security issue in rclone and reported it privately upstream through a GitHub security advisory. Upstream already had a report for the same issue, so they folded mine into the existing advisory and credited me as a co-reporter.
Also found some bugs in the additional-data tooling, e.g. cve-ad --package P --severity tbd wipes the CVE-level severity, and the schema doesn t validate package-level entries at all.
[E/LTS] Monitored discussions on mailing lists, IRC, and all the documentation updates.
netip.Addr features an Unmap()
method returning the unwrapped IPv4 contained in an IPv4-mapped IPv6
address: from ::ffff:203.0.113.10 or ::ffff:cb00:710a, it returns
203.0.113.10.1 There is no Map() or To6() method for the reverse
direction. Such a method is trivial to implement, but Go maintainers have
rejected it on the grounds that users should write
netip.AddrFrom16(ip.As16()) and let the compiler optimize it.2 Today,
this pattern is eight times slower than a native method. How can we teach the
compiler to optimize this sequence?
The alternatives
Let s explore three ways to implement the map semantics for netip.Addr. My
favorite is to add it to the Go standard library. Go maintainers prefer a small
external helper chaining netip.AddrFrom16() and netip.Addr.As16(), hoping
the compiler eventually optimizes it. The unsafe package
opens a third path, with the same performance as the first solution.
Modifying the Go standard library
Internally, netip.Addr stores any IP address as a
128-bit value with an extra field z to encode the family and the zone:
typeAddrstructaddruint128zunique.Handle[addrDetail]typeaddrDetailstructisV6bool// IPv4 is false, IPv6 is true.zoneV6string// != "" only if IsV6 is true.var(z0unique.Handle[addrDetail]z4=unique.Make(addrDetail )z6noz=unique.Make(addrDetailisV6:true ))
AddrFrom4() encodes an IPv4 address as an
IPv4-mapped IPv6 address and sets z to the unique value z4:
// AddrFrom4 returns the address of the IPv4 address given by the bytes in addr.funcAddrFrom4(addr[4]byte)AddrreturnAddraddr:uint1280,0xffff00000000uint64(addr[0])<<24uint64(addr[1])<<16uint64(addr[2])<<8uint64(addr[3]) ,z:z4,
Unmap() turns an IPv4-mapped IPv6 address into an
IPv4 address by setting the z field to z4:
Implementing the reverse direction inside the Go standard library is trivial: we
set the z field to z6noz if the address is IPv4.
// To6 maps an IPv4 address to an IPv4-mapped IPv6 address. It returns an// IPv6 address unmodified.func(ipAddr)To6()Addrifip.Is4()ip.z=z6nozreturnip
As a helper
We can t access the z field from outside the net/netip package. Instead, we
build a small helper around the netip.AddrFrom16(ip.As16()) pattern:
// AddrTo6 maps an IPv4 address to an IPv4-mapped IPv6 address. It returns an// IPv6 address unmodified.funcAddrTo6(ipnetip.Addr)netip.Addrifip.Is4()ip=netip.AddrFrom16(ip.As16())returnip
As an unsafe function
Another solution uses the unsafe package to alter the Addr struct through
a proxy with the same memory layout:3
// addrProxy has the same memory layout as netip.Addr.typeaddrProxystructaddr[2]uint64// netip.uint128zunsafe.Pointer// unique.Handle[netip.addrDetail]var(anyIPv6=netip.IPv6Unspecified()netipZ6noz=(*addrProxy)(unsafe.Pointer(&anyIPv6)).z)// AddrTo6 maps an IPv4 address to an IPv4-mapped IPv6 address. It returns an// IPv6 address unmodified.funcAddrTo6(ipnetip.Addr)netip.Addrif!ip.Is4()returnip(*addrProxy)(unsafe.Pointer(&ip)).z=netipZ6nozreturnip
Benchmarks
On my computer, with Go 1.27.1, the standard library solution costs 0.88 ns per
operation, while the solution favored by Go maintainers costs 7.14 ns. The
unsafe solution matches the performance of the first one.
Assembly code
Let s check the assembly code the compiler generates for each solution.4
The one built into the standard library looks like this:5
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnet/netip z6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
Go s assembly language is not a direct representation of the underlying
machine language: it operates on a semi-abstract instruction set derived from
Plan 9 s assembler. It has four pseudo-registers: FP (frame pointer
for function arguments), PC (program counter), SB (static base pointer for
global symbols), and SP (stack pointer). It also has architecture-specific
registers like AX, CX, DX, BX, SI, DI, and R8 to R15.
Instructions storing data use their last argument as the destination.
Instructions can carry an explicit size suffix: MOVB moves a byte, MOVW 16
bits, MOVL 32 bits, and MOVQ 64 bits. In the example above, the first
instruction compares the 64-bit value z4 with the CX register.
The unsafe solution looks almost the same:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnetipZ6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
The helper solution has far more instructions. To understand why, let s look at
the code for As16() and
AddrFrom16(). They are short enough for the compiler
to inline them.
We can already guess the pattern to optimize: the code packs the IP address into
an array, copies it, then unpacks it. If we inline the Go code by hand, we get:
Unfortunately, as of Go 1.26.8, the compiler is not smart enough to do the same:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.z; Push the stack (32 bytes):; 0(SP) addr netip.uint128; 16(SP) a16 [16]bytePUSHQBPMOVQSP,BPSUBQ$32,SPCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop here; Pack: byteorder.BEPutUint64(a16[:8], input.addr.hi); byteorder.BEPutUint64(a16[8:], input.addr.lo)MOVBEQAX,net/netip a16+16(SP)MOVBEQBX,net/netip a16+24(SP); addr = a16, 16 bytes at once through the vector register X0MOVUPSnet/netip a16+16(SP),X0MOVUPSX0,net/netip addr(SP); CX = netip.z6nozMOVQnet/netip z6noz(SB),CX; Unpack: output.addr.hi = byteorder.BEUint64(addr[:8]); output.addr.lo = byteorder.BEUint64(addr[8:])MOVBEQnet/netip addr(SP),AXMOVBEQnet/netip addr+8(SP),BXend:ADDQ$32,SPPOPQBPRET// return value = Addr hi: AX, lo: BX, z: CX
The compiler does a decent job on the byte shuffling: the eight byte stores of
BEPutUint64() become a single MOVBEQ, which stores a register byte-swapped.
The eight byte loads of BEUint64() become a single MOVBEQ the other way
round.6 Three groups of instructions remain: a pack, a copy, and an
unpack.
Hacking the Go compiler
The Go compiler has several phases:
The compiler converts the syntax tree and its types into its own intermediate
representation (IR). This process, called noding, goes through
a serialization format named unified IR.
This phase runs two steps: order of evaluation decomposes complex
statements into simpler ones, and desugaring transforms higher-level Go
constructs, like switch or channels, into more primitive instructions or
calls to the runtime.
The compiler rewrites the SSA form into machine-specific variants,
allocates registers, and applies more optimization passes. At the end, the
assembler turns the generated instructions into machine code.
The hammer
My first idea is to replace occurrences of netip.AddrFrom16(ip.As16()) with
netip.Addr addr: ip.addr, z: netip.z6noz as early as possible, during the
noding process. Before that, the type checking phase prevents
us from accessing unexported struct fields.
Go 1.27 introduced a convenient debug option to dump the IR of a function at
interesting points during compilation:
$ GOTOOLCHAIN=go1.27.1GOAMD64=v3gobuild-a-gcflags="-d=astdump=AddrTo6Safe".
Writing text ast output for AddrTo6Safe to AddrTo6Safe.astWriting html ast output for AddrTo6Safe to AddrTo6Safe.htmlWriting html syntax output for AddrTo6Safe to AddrTo6Safe.syntax.html
In the HTML file, the first column shows the IR as it comes out of noding:
In the body of the if statement, we spot the calls to the method
netip.Addr.As16() and to the function netip.AddrFrom16(). Our goal is to
patch them with a struct literal:
In noder s reader.go, the expr() method builds the IR tree for
an expression. At the end of the exprCall case, we add a call to a
rewriteAddrFrom16As16() function. It takes the current node and returns the
struct literal on success, or nil if the rewrite is not possible. First, we
check that we have the expected pattern: a call to the netip.AddrFrom16()
function with a call to the netip.Addr.As16() method as its only argument:
Have a look at the complete patch.7 We can test it
with the following commands:
$ cdsrc
$ ./make.bash
Building Go cmd/dist using /usr/lib/go-1.27. (go1.27.1 linux/amd64)Building Go toolchain1 and bootstrap cmd/go (go_bootstrap) using /usr/lib/go-1.27.Building Go toolchain2 using go_bootstrap and Go toolchain1.Building Go toolchain3 and commands using go_bootstrap and Go toolchain2.Checking command staleness for linux/amd64.---Installed Go for linux/amd64 in /home/bernat/code/free/goInstalled commands in /home/bernat/code/free/go/bin*** You need to add /home/bernat/code/free/go/bin to your PATH.$ exportPATH=$PWD/../bin:$PATH$ goversion
go version go1.28-devel_9834516e20 Sat Sep 12 08:23:11 2026 -0700 linux/amd64$ gotestnet/netip/...
ok net/netip 0.224s$ cd../../go-netip-addrto6
$ gotest.
ok github.com/vincentbernat/go-netip-addrto6 0.062s
The generated code for the helper is now the shortest possible version!
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnet/netip z6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
Go maintainers are unlikely to accept this change. It relies on the internal
structure of net/netip.Addr. It s an ugly hack in the noder, whose job is to
faithfully translate the type-checked AST into the IR. And it s harder to
maintain than adding a To6() method.
The screwdriver
The right place for such an optimization is the generic SSA phase. One of
the last machine-independent passes is memcombine. With the appropriate debug
flag, the compiler dumps the SSA form after this pass:8
The result of the memcombine pass follows the same structure as the assembly
code for AddrTo6Safe()we looked at earlier: two stores,
one move, and two loads we would like to optimize away.
Each line features a value identifier (v442), an operation with its type
(Bswap64 <uint64>), and its arguments (v490).9 Values are the basic
building blocks of SSA and are defined exactly once. Square brackets enclose
integer parameters ([8]) and curly braces contain auxiliary arguments
( netip.addr ). Operations writing to memory produce a new memory state. Every
memory operation takes the current state as its last argument, which keeps them
in order.
To simplify this code, we could apply three rewriting rules:
The first one adds a shortcut when loading through a move: (Load (OffPtr
[o] p) (Move p src mem)) => (Load (OffPtr [o] src) mem). This matches v174
with its arguments v415 and v286 and creates a new value v600:
The second one simplifies a load following a store: (Load p (Store p x
_)) => x. The load is forwarded: the stored value replaces it and no memory
access remains. It matches v174. It notices that v600 and v173 are the
same address and replaces v174 with a copy of v442:
To optimize it away, we also apply three rewriting rules:
The first one also adds a shortcut when loading through a move, but
without an offset: (Load p (Move p src mem)) => (Load src mem). This rewrites v416
to use arguments from v286:
The second rule forwards a value stored one step earlier, skipping over a
store to another address: (Load p (Store q _ (Store p x _))) => x. This
matches v416: x is v542, p is v22 (&a16), q is v173
(&a16[8]), and p and q do not overlap for uint64.
In practice
Most of these rules already exist in generic.rules. They use
conditions to validate their context: ssa.IsSamePtr() for the same address,
ssa.Disjoint() for addresses that do not overlap. The rule forwarding a stored
value to a load already exists with three variants looking through several other
stores. Here are the two we need:
There is no generic rule to cancel two byte swaps, but the AMD64 lowering
pass includes this rule:
(BSWAP(Q L)(BSWAP(Q L)p))=>p
After switching to Go s development branch and adding the missing
rule, the generated assembly code is worse than with Go 1.26.8,
even though our additional rule slightly improves the situation at the end:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.z; Push the stack (16 bytes):; 0(SP) a16 [16]bytePUSHQBPMOVQSP,BPSUBQ$16,SPCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop here; The four forwarded bytes: the low half of input.addr.lo is taken apart and; put back together in registersMOVQBX,DX; DX = input.addr.loSHRQ$24,BX; BX = input.addr.lo >> 24MOVQDX,SI; SI = input.addr.loSHRQ$16,DX; DX = input.addr.lo >> 16MOVQSI,DI; DI = input.addr.lo, kept for the packSHRQ$8,SI; SI = input.addr.lo >> 8MOVBLZXDIB,R8; R8 = byte(input.addr.lo)MOVBLZXSIB,SI; SI = byte(input.addr.lo >> 8)SHLQ$8,SIORQR8,SI; SI = two low bytes of input.addr.loMOVBLZXDL,DX; DX = byte(input.addr.lo >> 16)SHLQ$16,DXORQSI,DXMOVBLZXBL,BX; BX = byte(input.addr.lo >> 24)SHLQ$24,BXORQDX,BX; BX = input.addr.lo & 0xffffffff; Pack: byteorder.BEPutUint64(a16[:8], input.addr.hi); byteorder.BEPutUint64(a16[8:], input.addr.lo)MOVBEQAX,net/netip a16(SP)MOVBEQDI,net/netip a16+8(SP); The four other bytes of input.addr.lo, read one by one from a16MOVBLZXnet/netip a16+11(SP),DX; a16[11]SHLQ$32,DXORQDX,BXMOVBLZXnet/netip a16+10(SP),DX; a16[10]SHLQ$40,DXORQDX,BXMOVBLZXnet/netip a16+9(SP),DX; a16[9]SHLQ$48,DXORQDX,BXMOVBLZXnet/netip a16+8(SP),DX; a16[8]SHLQ$56,DX; output.z = netip.z6nozMOVQnet/netip z6noz(SB),CX; output.addr.hi = byteorder.BEUint64(a16[:8])MOVBEQnet/netip a16(SP),AX; output.addr.lo assembled from the previous stepsORQDX,BXend:LEAVEQRET// return value = Addr hi: AX, lo: BX, z: CX
The rule loading through a move, added in Go 1.27, introduced this regression.
Out of order
Let s not give up now! In reality, the rewriting rules run before memcombine,
notably in the late opt pass. At this point, the inlined versions of
BEPutUint64() and BEUint64() still expand to sixteen byte stores and sixteen
byte loads, matching their source code:
funcBEUint64(b[]byte)uint64_=b[7]// bounds check hint to compiler; see golang.org/issue/14808returnuint64(b[7])uint64(b[6])<<8uint64(b[5])<<16uint64(b[4])<<24uint64(b[3])<<32uint64(b[2])<<40uint64(b[1])<<48uint64(b[0])<<56
Let s follow two bytes of output.addr.lo: addr[15] and addr[11]. Here is
a simplified SSA form before late opt:
The first rule loads through the move: (Load (OffPtr [o] p) (Move p src mem))
=> (Load (OffPtr [o] src) mem). It matches both loads, which now read a16
with the memory state before the copy:
The second rule shortcuts a load following a store: (Load p (Store p x _)) =>
x. It matches v435, as v282 stores a16[15]. It does not match v481:
v235 stores a16[11] four stores earlier in the chain, while the variants of
this rule look through three stores at most.
The same happens to the other bytes: the rule forwards the four bytes stored
last, a16[12] to a16[15]. The twelve other loads now read a16 instead of
addr.
BEUint64() becomes a chain of Or64, each one adding a byte shifted into
place. memcombine is a pass written in Go, not a set of rewrite
rules. It starts from the last Or64 of the chain and collects up to eight
terms. If each term is a byte load, extended to 64 bits and shifted, and if the
eight loads read consecutive addresses from the same pointer with the same
memory state, it replaces the whole chain with a single 64-bit load and a byte
swap. Otherwise, it tries again with four, then two terms, and from each
intermediate Or64. Here is the loop checking each term in a simplified version
of combineLoads():
From v520, four of the eight terms are forwarded bytes, not loads from memory,
and memcombine can t combine them. It doesn t merge the four remaining loads
either, as they sit on top of the forwarded bytes.
Back in order
In summary, the rewriting rules run too early to be effective. A quick
workaround exists: run an earlier round of memcombine before late opt. After
this change, the generated code for the helper is back to the
shortest possible version:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnet/netip z6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
Next steps
I think Go maintainers would reject this change because of the additional
memcombine pass. Instead, I plan to publish this blog post and bring up the
subject again as a follow-up to issue #54365. Either the sheer complexity and
the Go 1.27 regression convince the maintainers that adding a To6() method is
simpler and more efficient, or they advise me on how to move forward. Either
way, digging into this subject taught me a lot about the Go compiler!
IPv4-mapped IPv6 addresses let you handle only IPv6 addresses in your code
and keep conversions at a few well-defined boundaries. I use them in
Akvorado.
This is not strictly equivalent. The zero value becomes :: while it would
make more sense to leave it untouched.
To avoid catastrophic bugs when netip.Addr s layout changes, you must add
tests to detect it. This is more dangerous if you put this code in a
package. Either ask users to run the tests themselves, or detect the change
at run time and panic. Hiding this optimization behind a build tag would
make users aware of this potential trap.
I produced the assembly code with GOTOOLCHAIN=go1.26.8 GOAMD64=v3 ./go-asm
'\.asm' from the companion repository, then edited it a bit to keep this
article from turning into an endless rabbit hole. Due to an unfortunate
sequence of events, we switch between versions: Go 1.27 introduced a
regression that blurs the point of this article.
The function is short enough for the compiler to inline it, so the assembly
code may vary depending on the surrounding code.
MOVBEQ requires GOAMD64=v3, matching the x86-64-v3
microarchitecture from 2013. Otherwise, the compiler translates
BEPutUint64() to BSWAPQ+MOVQ and BEUint64() to MOVQ+BSWAPQ.
When the call is used as a statement, a struct literal alone is invalid. The
patch then turns it into _ = netip.Addr .
The compiler can also write an HTML file with the result of each pass:
$ GOSSAFUNC=AddrTo6Safe\> GOTOOLCHAIN=go1.26.8\> GOAMD64=v3gobuild-a.
dumped SSA for AddrTo6Safe,1 to ./ssa.html
Source line numbers in parentheses follow value identifiers, but I removed
them from the examples. The SSA form also features branches, but we don t
need them to understand our optimizations.
netip.Addr features an Unmap()
method returning the unwrapped IPv4 contained in an IPv4-mapped IPv6
address: from ::ffff:203.0.113.10 or ::ffff:cb00:710a, it returns
203.0.113.10.1 There is no Map() or To6() method for the reverse
direction. Such a method is trivial to implement, but Go maintainers have
rejected it on the grounds that users should write
netip.AddrFrom16(ip.As16()) and let the compiler optimize it.2 Today,
this pattern is eight times slower than a native method. How can we teach the
compiler to optimize this sequence?
The alternatives
Let's explore three ways to implement the map semantics for netip.Addr. My
favorite is to add it to the Go standard library. Go maintainers prefer a small
external helper chaining netip.AddrFrom16() and netip.Addr.As16(), hoping
the compiler eventually optimizes it. The unsafe package
opens a third path, with the same performance as the first solution.
Modifying the Go standard library
Internally, netip.Addr stores any IP address as a
128-bit value with an extra field z to encode the family and the zone:
typeAddrstructaddruint128zunique.Handle[addrDetail]typeaddrDetailstructisV6bool// IPv4 is false, IPv6 is true.zoneV6string// != "" only if IsV6 is true.var(z0unique.Handle[addrDetail]z4=unique.Make(addrDetail )z6noz=unique.Make(addrDetailisV6:true ))
AddrFrom4() encodes an IPv4 address as an
IPv4-mapped IPv6 address and sets z to the unique value z4:
// AddrFrom4 returns the address of the IPv4 address given by the bytes in addr.funcAddrFrom4(addr[4]byte)AddrreturnAddraddr:uint1280,0xffff00000000uint64(addr[0])<<24uint64(addr[1])<<16uint64(addr[2])<<8uint64(addr[3]) ,z:z4,
Unmap() turns an IPv4-mapped IPv6 address into an
IPv4 address by setting the z field to z4:
Implementing the reverse direction inside the Go standard library is trivial: we
set the z field to z6noz if the address is IPv4.
// To6 maps an IPv4 address to an IPv4-mapped IPv6 address. It returns an// IPv6 address unmodified.func(ipAddr)To6()Addrifip.Is4()ip.z=z6nozreturnip
Update (2026-10)
Instead of patching Go, we can use the -overlay flag of go
build to hijack any package, including the standard library. In our case,
it can add To6() to net/netip. Yet it is
cumbersome:3 the flag expects a JSON file mapping absolute
paths in GOROOT to replacement files, and you need to add it to every go
command.
As a helper
We can't access the z field from outside the net/netip package. Instead, we
build a small helper around the netip.AddrFrom16(ip.As16()) pattern:
// AddrTo6 maps an IPv4 address to an IPv4-mapped IPv6 address. It returns an// IPv6 address unmodified.funcAddrTo6(ipnetip.Addr)netip.Addrifip.Is4()ip=netip.AddrFrom16(ip.As16())returnip
As an unsafe function
Another solution uses the unsafe package to alter the Addr struct through
a proxy with the same memory layout:4
// addrProxy has the same memory layout as netip.Addr.typeaddrProxystructaddr[2]uint64// netip.uint128zunsafe.Pointer// unique.Handle[netip.addrDetail]var(anyIPv6=netip.IPv6Unspecified()netipZ6noz=(*addrProxy)(unsafe.Pointer(&anyIPv6)).z)// AddrTo6 maps an IPv4 address to an IPv4-mapped IPv6 address. It returns an// IPv6 address unmodified.funcAddrTo6(ipnetip.Addr)netip.Addrif!ip.Is4()returnip(*addrProxy)(unsafe.Pointer(&ip)).z=netipZ6nozreturnip
Benchmarks
On my computer, with Go 1.27.1, the standard library solution costs 0.88 ns per
operation, while the solution favored by Go maintainers costs 7.14 ns. The
unsafe solution matches the performance of the first one.
Assembly code
Let's check the assembly code the compiler generates for each solution.5
The one built into the standard library looks like this:6
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnet/netip z6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
Go's assembly language is not a direct representation of the underlying
machine language: it operates on a semi-abstract instruction set derived from
Plan 9's assembler. It has four pseudo-registers: FP (frame pointer
for function arguments), PC (program counter), SB (static base pointer for
global symbols), and SP (stack pointer). It also has architecture-specific
registers like AX, CX, DX, BX, SI, DI, and R8 to R15.
Instructions storing data use their last argument as the destination.
Instructions can carry an explicit size suffix: MOVB moves a byte, MOVW 16
bits, MOVL 32 bits, and MOVQ 64 bits. In the example above, the first
instruction compares the 64-bit value z4 with the CX register.
The unsafe solution looks almost the same:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnetipZ6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
The helper solution has far more instructions. To understand why, let's look at
the code for As16() and
AddrFrom16(). They are short enough for the compiler
to inline them.
We can already guess the pattern to optimize: the code packs the IP address into
an array, copies it, then unpacks it. If we inline the Go code by hand, we get:
Unfortunately, as of Go 1.26.8, the compiler is not smart enough to do the same:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.z; Push the stack (32 bytes):; 0(SP) addr netip.uint128; 16(SP) a16 [16]bytePUSHQBPMOVQSP,BPSUBQ$32,SPCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop here; Pack: byteorder.BEPutUint64(a16[:8], input.addr.hi); byteorder.BEPutUint64(a16[8:], input.addr.lo)MOVBEQAX,net/netip a16+16(SP)MOVBEQBX,net/netip a16+24(SP); addr = a16, 16 bytes at once through the vector register X0MOVUPSnet/netip a16+16(SP),X0MOVUPSX0,net/netip addr(SP); CX = netip.z6nozMOVQnet/netip z6noz(SB),CX; Unpack: output.addr.hi = byteorder.BEUint64(addr[:8]); output.addr.lo = byteorder.BEUint64(addr[8:])MOVBEQnet/netip addr(SP),AXMOVBEQnet/netip addr+8(SP),BXend:ADDQ$32,SPPOPQBPRET// return value = Addr hi: AX, lo: BX, z: CX
The compiler does a decent job on the byte shuffling: the eight byte stores of
BEPutUint64() become a single MOVBEQ, which stores a register byte-swapped.
The eight byte loads of BEUint64() become a single MOVBEQ the other way
round.7 Three groups of instructions remain: a pack, a copy, and an
unpack.
Hacking the Go compiler
The Go compiler has several phases:
The compiler converts the syntax tree and its types into its own intermediate
representation (IR). This process, called "noding," goes through
a serialization format named unified IR.
This phase runs two steps: order of evaluation decomposes complex
statements into simpler ones, and desugaring transforms higher-level Go
constructs, like switch or channels, into more primitive instructions or
calls to the runtime.
The compiler rewrites the SSA form into machine-specific variants,
allocates registers, and applies more optimization passes. At the end, the
assembler turns the generated instructions into machine code.
The hammer
My first idea is to replace occurrences of netip.AddrFrom16(ip.As16()) with
netip.Addr addr: ip.addr, z: netip.z6noz as early as possible, during the
"noding" process. Before that, the type checking phase prevents
us from accessing unexported struct fields.
Go 1.27 introduced a convenient debug option to dump the IR of a function at
interesting points during compilation:
$ GOTOOLCHAIN=go1.27.1GOAMD64=v3gobuild-a-gcflags="-d=astdump=AddrTo6Safe".
Writing text ast output for AddrTo6Safe to AddrTo6Safe.astWriting html ast output for AddrTo6Safe to AddrTo6Safe.htmlWriting html syntax output for AddrTo6Safe to AddrTo6Safe.syntax.html
In the HTML file, the first column shows the IR as it comes out of noding:
In the body of the if statement, we spot the calls to the method
netip.Addr.As16() and to the function netip.AddrFrom16(). Our goal is to
patch them with a struct literal:
In noder's reader.go, the expr() method builds the IR tree for
an expression. At the end of the exprCall case, we add a call to a
rewriteAddrFrom16As16() function. It takes the current node and returns the
struct literal on success, or nil if the rewrite is not possible. First, we
check that we have the expected pattern: a call to the netip.AddrFrom16()
function with a call to the netip.Addr.As16() method as its only argument:
Have a look at the complete patch.8 We can test it
with the following commands:
$ cdsrc
$ ./make.bash
Building Go cmd/dist using /usr/lib/go-1.27. (go1.27.1 linux/amd64)Building Go toolchain1 and bootstrap cmd/go (go_bootstrap) using /usr/lib/go-1.27.Building Go toolchain2 using go_bootstrap and Go toolchain1.Building Go toolchain3 and commands using go_bootstrap and Go toolchain2.Checking command staleness for linux/amd64.---Installed Go for linux/amd64 in /home/bernat/code/free/goInstalled commands in /home/bernat/code/free/go/bin*** You need to add /home/bernat/code/free/go/bin to your PATH.$ exportPATH=$PWD/../bin:$PATH$ goversion
go version go1.28-devel_9834516e20 Sat Sep 12 08:23:11 2026 -0700 linux/amd64$ gotestnet/netip/...
ok net/netip 0.224s$ cd../../go-netip-addrto6
$ gotest.
ok github.com/vincentbernat/go-netip-addrto6 0.062s
The generated code for the helper is now the shortest possible version!
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnet/netip z6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
Go maintainers are unlikely to accept this change. It relies on the internal
structure of net/netip.Addr. It's an ugly hack in the noder, whose job is to
faithfully translate the type-checked AST into the IR. And it's harder to
maintain than adding a To6() method.
The screwdriver
The right place for such an optimization is the generic SSA phase. One of
the last machine-independent passes is memcombine. With the appropriate debug
flag, the compiler dumps the SSA form after this pass:9
The result of the memcombine pass follows the same structure as the assembly
code for AddrTo6Safe()we looked at earlier: two stores,
one move, and two loads we would like to optimize away.
Each line features a value identifier (v442), an operation with its type
(Bswap64 <uint64>), and its arguments (v490).10 Values are the basic
building blocks of SSA and are defined exactly once. Square brackets enclose
integer parameters ([8]) and curly braces contain auxiliary arguments
( netip.addr ). Operations writing to memory produce a new memory state. Every
memory operation takes the current state as its last argument, which keeps them
in order.
To simplify this code, we could apply three rewriting rules:
The first one adds a shortcut when loading through a move: (Load (OffPtr
[o] p) (Move p src mem)) => (Load (OffPtr [o] src) mem). This matches v174
with its arguments v415 and v286 and creates a new value v600:
The second one simplifies a load following a store: (Load p (Store p x
_)) => x. The load is forwarded: the stored value replaces it and no memory
access remains. It matches v174. It notices that v600 and v173 are the
same address and replaces v174 with a copy of v442:
To optimize it away, we also apply three rewriting rules:
The first one also adds a shortcut when loading through a move, but
without an offset: (Load p (Move p src mem)) => (Load src mem). This rewrites v416
to use arguments from v286:
The second rule forwards a value stored one step earlier, skipping over a
store to another address: (Load p (Store q _ (Store p x _))) => x. This
matches v416: x is v542, p is v22 (&a16), q is v173
(&a16[8]), and p and q do not overlap for uint64.
In practice
Most of these rules already exist in generic.rules. They use
conditions to validate their context: ssa.IsSamePtr() for the same address,
ssa.Disjoint() for addresses that do not overlap. The rule forwarding a stored
value to a load already exists with three variants looking through several other
stores. Here are the two we need:
There is no generic rule to cancel two byte swaps, but the AMD64 lowering
pass includes this rule:
(BSWAP(Q L)(BSWAP(Q L)p))=>p
After switching to Go's development branch and adding the missing
rule, the generated assembly code is worse than with Go 1.26.8,
even though our additional rule slightly improves the situation at the end:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.z; Push the stack (16 bytes):; 0(SP) a16 [16]bytePUSHQBPMOVQSP,BPSUBQ$16,SPCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop here; The four forwarded bytes: the low half of input.addr.lo is taken apart and; put back together in registersMOVQBX,DX; DX = input.addr.loSHRQ$24,BX; BX = input.addr.lo >> 24MOVQDX,SI; SI = input.addr.loSHRQ$16,DX; DX = input.addr.lo >> 16MOVQSI,DI; DI = input.addr.lo, kept for the packSHRQ$8,SI; SI = input.addr.lo >> 8MOVBLZXDIB,R8; R8 = byte(input.addr.lo)MOVBLZXSIB,SI; SI = byte(input.addr.lo >> 8)SHLQ$8,SIORQR8,SI; SI = two low bytes of input.addr.loMOVBLZXDL,DX; DX = byte(input.addr.lo >> 16)SHLQ$16,DXORQSI,DXMOVBLZXBL,BX; BX = byte(input.addr.lo >> 24)SHLQ$24,BXORQDX,BX; BX = input.addr.lo & 0xffffffff; Pack: byteorder.BEPutUint64(a16[:8], input.addr.hi); byteorder.BEPutUint64(a16[8:], input.addr.lo)MOVBEQAX,net/netip a16(SP)MOVBEQDI,net/netip a16+8(SP); The four other bytes of input.addr.lo, read one by one from a16MOVBLZXnet/netip a16+11(SP),DX; a16[11]SHLQ$32,DXORQDX,BXMOVBLZXnet/netip a16+10(SP),DX; a16[10]SHLQ$40,DXORQDX,BXMOVBLZXnet/netip a16+9(SP),DX; a16[9]SHLQ$48,DXORQDX,BXMOVBLZXnet/netip a16+8(SP),DX; a16[8]SHLQ$56,DX; output.z = netip.z6nozMOVQnet/netip z6noz(SB),CX; output.addr.hi = byteorder.BEUint64(a16[:8])MOVBEQnet/netip a16(SP),AX; output.addr.lo assembled from the previous stepsORQDX,BXend:LEAVEQRET// return value = Addr hi: AX, lo: BX, z: CX
The rule loading through a move, added in Go 1.27, introduced this regression.
Out of order
Let's not give up now! In reality, the rewriting rules run before memcombine,
notably in the late opt pass. At this point, the inlined versions of
BEPutUint64() and BEUint64() still expand to sixteen byte stores and sixteen
byte loads, matching their source code:
funcBEUint64(b[]byte)uint64_=b[7]// bounds check hint to compiler; see golang.org/issue/14808returnuint64(b[7])uint64(b[6])<<8uint64(b[5])<<16uint64(b[4])<<24uint64(b[3])<<32uint64(b[2])<<40uint64(b[1])<<48uint64(b[0])<<56
Let's follow two bytes of output.addr.lo: addr[15] and addr[11]. Here is
a simplified SSA form before late opt:
The first rule loads through the move: (Load (OffPtr [o] p) (Move p src mem))
=> (Load (OffPtr [o] src) mem). It matches both loads, which now read a16
with the memory state before the copy:
The second rule shortcuts a load following a store: (Load p (Store p x _)) =>
x. It matches v435, as v282 stores a16[15]. It does not match v481:
v235 stores a16[11] four stores earlier in the chain, while the variants of
this rule look through three stores at most.
The same happens to the other bytes: the rule forwards the four bytes stored
last, a16[12] to a16[15]. The twelve other loads now read a16 instead of
addr.
BEUint64() becomes a chain of Or64, each one adding a byte shifted into
place. memcombine is a pass written in Go, not a set of rewrite
rules. It starts from the last Or64 of the chain and collects up to eight
terms. If each term is a byte load, extended to 64 bits and shifted, and if the
eight loads read consecutive addresses from the same pointer with the same
memory state, it replaces the whole chain with a single 64-bit load and a byte
swap. Otherwise, it tries again with four, then two terms, and from each
intermediate Or64. Here is the loop checking each term in a simplified version
of combineLoads():
From v520, four of the eight terms are forwarded bytes, not loads from memory,
and memcombine can't combine them. It doesn't merge the four remaining loads
either, as they sit on top of the forwarded bytes.
Back in order
In summary, the rewriting rules run too early to be effective. A quick
workaround exists: run an earlier round of memcombine before late opt. After
this change, the generated code for the helper is back to the
shortest possible version:
// AX = input.addr.hi, BX = input.addr.lo, CX = input.zCMPQnet/netip z4(SB),CX; check "z" if this is an IPv4 addressJNEend; if not, stop hereMOVQnet/netip z6noz(SB),CX; CX = netip.z6nozend:RET// return value = Addr hi: AX, lo: BX, z: CX
Next steps
I think Go maintainers would reject this change because of the additional
memcombine pass. Instead, I plan to publish this blog post and bring up the
subject again as a follow-up to issue #54365. Either the sheer complexity and
the Go 1.27 regression convince the maintainers that adding a To6() method is
simpler and more efficient, or they advise me on how to move forward. Either
way, digging into this subject taught me a lot about the Go compiler!
Update (2026-10)
I opened issue #81994 to propose Addr.To6(). Give it a if you want
it in Go!
IPv4-mapped IPv6 addresses let you handle only IPv6 addresses in your code
and keep conversions at a few well-defined boundaries. I use them in
Akvorado.
This is not strictly equivalent. The zero value becomes :: while it would
make more sense to leave it untouched.
I suppose Go maintainers keep it inconvenient on purpose: they don't want
random packages to patch the standard library or other packages.
To avoid catastrophic bugs when netip.Addr's layout changes, you must add
tests to detect it. This is more dangerous if you put this code in a
package. Either ask users to run the tests themselves, or detect the change
at run time and panic. Hiding this optimization behind a build tag would
make users aware of this potential trap.
I produced the assembly code with GOTOOLCHAIN=go1.26.8 GOAMD64=v3 ./go-asm
'\.asm' from the companion repository, then edited it a bit to keep this
article from turning into an endless rabbit hole. Due to an unfortunate
sequence of events, we switch between versions: Go 1.27 introduced a
regression that blurs the point of this article.
The function is short enough for the compiler to inline it, so the assembly
code may vary depending on the surrounding code.
MOVBEQ requires GOAMD64=v3, matching the x86-64-v3
microarchitecture from 2013. Otherwise, the compiler translates
BEPutUint64() to BSWAPQ+MOVQ and BEUint64() to MOVQ+BSWAPQ.
When the call is used as a statement, a struct literal alone is invalid. The
patch then turns it into _ = netip.Addr .
The compiler can also write an HTML file with the result of each pass:
$ GOSSAFUNC=AddrTo6Safe\> GOTOOLCHAIN=go1.26.8\> GOAMD64=v3gobuild-a.
dumped SSA for AddrTo6Safe,1 to ./ssa.html
Source line numbers in parentheses follow value identifiers, but I removed
them from the examples. The SSA form also features branches, but we don't
need them to understand our optimizations.
A friend wants to proofread your work-in-progress blog post, but its preview
only runs on localhost:8080. Several tools can help. Some run as a
commercial service, like ngrok or Cloudflare Quick Tunnels. Some are
self-hostable but require a specific client, like frp or localtunnel.
Some only require a plain SSH client but rely on a specific SSH server, like
sish. Let's implement a self-hosted solution with only OpenSSH and
nginx!
$ ssh-R0:localhost:8080http-over-ssh
Allocated port 41535 for remote forward to localhost:8080https://6J3jK1WmB15c6WmjW_X-Wg--1789928654@p41535.ssh.luffy.cx/
Basic setup
First, we forward connections from a port on a remote server to your local
service:
$ ssh-N-R0:localhost:8080web02.luffy.cx
Allocated port 41535 for remote forward to localhost:8080
When you specify 0 as the remote port, the server allocates a free port.
Then, we configure nginx to proxy requests from https://p41535.ssh.luffy.cx to
http://127.0.0.1:41535:
Access control
The port is the only "secret"1 keeping the content confidential. Other
forwarding solutions add a random string to the domain name to prevent an
intruder from enumerating the possible values.
Thanks to ngx_http_secure_link_module, we can secure
this setup a bit. This module computes a hash2 over a set of values,
including a secret, and compares it with the hash from the request. The hash is
base64-encoded, so we cannot put it in the domain name, which is
case-insensitive. Instead, we put it in the URL as a username, along with its
expiration timestamp:3
https://6J3jK1WmB15c6WmjW_X-Wg--1789928654@p41535.ssh.luffy.cx/en/blog
hash expires port path
The client sends the username to the server with HTTP basic
authentication. This works with most HTTP clients, including curl.
Nginx exposes the username in the $remote_user variable. The module expects
the hash and the expiration timestamp separated by a comma. We use a map
directive to extract the two parts from $remote_user and join them with a
comma.4 We also give the module the string to hash. It contains the
expiration timestamp, the port, and a secret:
The module returns the status of the check in the $secure_link variable:
empty if the hashes do not match,
"0" if they match but the link has expired, or
"1" otherwise.
If the hash is incorrect or missing, we return a 401 error with a
WWW-Authenticate header to ask for credentials. If the link has expired, we
return a 410 error. We remove the Authorization header before forwarding the
request and add a few directives to proxy WebSocket connections.
Here is the complete configuration:5
Well, I suppose you are now saying: "Vincent, this is not very convenient! I'll stick
with ngrok if you don't mind." Okay, I hear you. Let's write a helper script.
Helper script
The main difficulty is finding the ephemeral port that OpenSSH allocates, as it
does not appear in any environment variable.6 To work around this obstacle,
we look for the ancestor sshd-session processes:7
With this solution, I only rely on OpenSSH and nginx, two pieces of software
already running on this server. One short command gives me a self-hosted tunnel
and a URL to share. To try it, grab the complete helper script, which
includes a few minor improvements. If you run NixOS, as any person of taste
would, have a look at my http-over-ssh.nix instead.
Update (2026-10)
This post was widely discussed on Hacker News.
Update (2026-10)
I have since switched to Caddy, which does not include a module to check the
validity of a URL. Instead, Caddy queries a local HTTP service written in
Go through the forward_auth directive. As a bonus, this lets me put
the token in the domain name.
Since the kernel allocates it from the local port range, its entropy is low.
Moreover, on Linux, we lose one more bit because the kernel favors odd
ports when it picks a random free port.
The module relies on MD5. Its security is weak but good enough for this
use.
We need an expiration date because a later session could reuse the port,
and we have no way to detect this case.
The username could use a comma directly instead of a double dash. But some
applications do not recognize the URL correctly, making it harder to share.
This configuration exposes any TCP port listening on 127.0.0.1 or
0.0.0.0 to anyone with the secret, bypassing most firewall rules. You
could strengthen it by limiting the server_name regex to the ephemeral
port range.
One SSH session can contain several tunnels, and the client can add or
remove them at any time. This is unlike tun device forwarding (ssh -w),
which gets its own SSH_TUNNEL environment variable.
Since OpenSSH 9.8, sshd-session is the name of the helper handling the
session. With older versions, look for sshd instead.
We need sudo because the sshd-session process dropped its privileges.
The kernel then marks it as not dumpable, and its /proc/PID/fd directory
belongs to root. Without access to this directory, ss cannot
find which process owns a socket.
In 2016, I removed Google Analytics from this blog to avoid being
complicit in feeding the biggest machine for harvesting personal data. Instead,
I relied on GoAccess to analyze my server logs.1 For the past couple
of years, the statistics have made no sense, despite my attempts to filter bots:
AI scrapers inflate the number of visitors to around 2,000 per
day. Eventually, I settled on GoatCounter, an open-source, privacy-friendly
web analytics platform. I replaced the JavaScript client to filter bots more
aggressively and added a CSS fallback. To improve reliability, I implemented a
local proxy running on each of the five web servers serving this blog. The rest
of this post details how these pieces fit together and how I deploy them on
NixOS.
Why GoatCounter?
GoatCounter does not collect personal data: instead of storing the reader s
IP address or relying on cookies, it creates a session identifier valid for 8
hours from the user agent and the IP address. Its feature set is modest but
sufficient for a blog. If you want to look at the interface, GoatCounter s
author runs a public instance for his site. A hosted
version lets you try it before running your own instance. With a single binary
and an SQLite database, GoatCounter is one of the lightest self-hosted
solutions. Privacy-friendly alternatives, in increasing order of complexity,
include Umami, Plausible, and Rybbit.
Custom JavaScript client
GoatCounter includes a small JavaScript client 2,189 bytes minified and
gzipped. It ships some features I don t use: a visitor counter, tracking clicks,
configurable settings, etc. I replace it with this function to register a hit:
If a reader has disabled JavaScript in their browser, I record the hit using a
CSS image. The :hover pseudo-class loads it only after an interaction, another
trick stolen from Bear Blog. About 2% of my visitors fit into this
bucket.3
<!DOCTYPE html><htmllang="en"class="nojs"><head><script>// The JavaScript code for this blog requires ES6if("noModule"inHTMLScriptElement.prototype)document.documentElement.classList.remove("nojs");</script></head><body><!-- ... --><style>.nojsbody:hoverborder-width:0;border-image:url('/count?p=/en/blog/2026-kpi-goodhart&t=Building...&r=NoJS&e=false');</style></body></html>
Where GoAccess reported around 2,000 visitors a day, GoatCounter counts fewer
than 200 humans.4 I assume AI scrapers use a low-effort approach: if the
content is available without barriers, as on this blog, they don t spawn a
complex mechanized browser that could trigger a page view. Even crawlers running
JavaScript, like Googlebot with its headless Chromium, do not
interact with the page and never trigger the events I listen
to. The interaction-based proof of humanity I use is likely to keep
working.5
Local proxy
Five servers across the world in Europe and in North
America serve the content of this website, but GoatCounter runs on only
one of them. To avoid losing track of visitors when GoatCounter is down, I run a
local proxy listening on the same /count endpoint. On each server, it stores
the hits in memory with a buffer large enough to survive several days of
downtime. It sends them in batches to the upstream backend using the
/api/v0/count authenticated endpoint.
Servers on a map. web02 is in Paris, web03 in Helsinki, web04 in Nuremberg,
web05 in Ashburn, web06 in Chicago.
I proposed the code for the proxy in pull request #909. GoatCounter s
maintainer declined to maintain so much code for such a niche use case. As a
fellow open-source developer, I often hold the same position for my own
projects: a one-time contributor effort may translate into a long-term
maintainer commitment.
I expose the endpoint for the proxy on the domain of this website to evade ad
blockers. This sounds like I don t respect the reader s choice, but as
GoatCounter is privacy-friendly, I find it acceptable.
Deploying on NixOS
My web servers run NixOS, a declarative Linux distribution with built-in
configuration management. I manage this small fleet with Colmena, a
stateless deployment tool for NixOS. My configuration is available on
GitHub.
Deploying applications in containers
For better isolation, each application runs inside an ephemeral lightweight
container, powered by systemd-nspawn. Each container runs a stripped-down
NixOS instance. A module wraps NixOS s containers options to
avoid repeating the same options for each application.6 The containers
share their network namespace with the host: the additional isolation is not
worth the increased complexity. For a smaller footprint, I also disable a few
non-essential services.
To configure a GoatCounter instance running in a container and listening on
127.0.0.4:8088, we import the module7 and declare the container in the
config.luffy.containers attribute set:
As the containers are ephemeral, we need to keep persistent data in directories
on the host. We add a mounts option and ask NixOS s containers to expose the
configured directories through the bindMounts option.
For example, to persist GoatCounter s database in the /var/db/goatcounter
directory on the host, we add the directory to the mounts option and alter the
service definition to tell GoatCounter where the database is.
A container may also need some secrets. Colmena can upload secrets without
storing them in the Nix store. We add a keys option to our containers. It
takes an attribute set mapping secret names to the commands to populate them.
Then, the module declares the required secrets to Colmena in the
deployment.keys option, makes the container depend on the presence of the
secrets, and exposes them to the container.
config, lib,... :letcfg= config.luffy.containers;in
options.luffy.containers= lib.mkOption type= lib.types.attrsOf (lib.types.submodule options=keys= lib.mkOption type= lib.types.attrsOf (lib.types.listOf lib.types.str);default= ;description="Secrets, as a command to run locally. They are mounted in /etc."; ; ; ); ;config=# Colmena uploads each secret in /var/keys and make them available# to the group "keys".
deployment.keys= lib.concatMapAttrs
(_: container: lib.mapAttrs
(_: keyCommand:inherit keyCommand;group="keys";permissions="0640";destDir="/var/keys"; )
container.keys)
cfg;# The container can only start if the required secrets are available.
systemd.services= lib.mapAttrs'
(name: container:letunits=map(key:"$ key-key.service")(lib.attrNames container.keys);in
lib.nameValuePair "container@$ name"requires= units;after= units; )
cfg;# Mount each secret inside the container.containers= lib.mapAttrs
(name: container:bindMounts= lib.mapAttrs'
(key: _: lib.nameValuePair "/etc/$ key"hostPath="/var/keys/$ key";isReadOnly=true; )
container.keys; )
cfg; ;
For example, GoatCounter needs credentials to download the GeoIP database. I
provide a local command to fetch the secret from my password manager and expose
it inside the container through the /etc/goatcounter.env environment file.
GoatCounter server
Nixpkgs already packages GoatCounter. By overriding the src and vendorHash
attributes, I reuse its definition for my custom version with the proxy:
I wrote a NixOS module to encapsulate GoatCounter: the
container definition, the service definition, and the secrets. The module
accepts the following options: package, serve.enable, serve.listenAddress,
serve.port, and serve.databaseFile. I already detailed the container
configuration in the previous section. In the end, I chose not to reuse the
GoatCounter module from NixOS: it s small, so it s better to insulate my module
from unexpected future changes.
config, pkgs, lib,... :letcfg= config.luffy.goatcounter;databaseDirectory=builtins.dirOf cfg.serve.databaseFile;chown="$ pkgs.coreutils/bin/chown -R";in
config.luffy.containers.goatcounter=
config.systemd.services.goatcounter=description="GoatCounter Web Analytics";wantedBy=["multi-user.target"];serviceConfig=EnvironmentFile="/etc/goatcounter.env";SupplementaryGroups=["keys"];DynamicUser=true;Restart="always";ExecStart= lib.escapeShellArgs [(lib.getExe cfg.package)"serve""-listen=$ cfg.serve.listenAddress:$ toString cfg.serve.port""-tls=none""-db=sqlite+$ cfg.serve.databaseFile""-automigrate"];# Transfer database ownership to dynamically assigned user "goatcounter".ExecStartPre="+$ chown goatcounter:goatcounter $ databaseDirectory";ReadWritePaths= databaseDirectory; ; ; ;
The following snippet configures GoatCounter to listen on 127.0.0.4:8088:
GoatCounter proxy
The same NixOS module configures the local proxy, with the
following options: proxy.enable, proxy.listenAddress, proxy.port, and
proxy.site the site receiving the batches of page views. The local proxy has
no persistent data, but it needs the API key to authenticate to the main
GoatCounter instance: its container uses the keys option but not the mounts
option.
config, pkgs, lib,... :letcfg= config.luffy.goatcounter;keyCommand= _:[" "];in
config.luffy.containers.goatcounter-proxy= keys."goatcounter-proxy.env"= keyCommand "GOATCOUNTER_API_KEY"; config.systemd.services.goatcounter=description="GoatCounter Proxy.";wantedBy=["multi-user.target"];serviceConfig=EnvironmentFile="/etc/goatcounter-proxy.env";SupplementaryGroups=["keys"];DynamicUser=true;Restart="always";ExecStart= lib.escapeShellArgs [(lib.getExe cfg.package)"proxy""-site=$ cfg.proxy.site""-listen=$ cfg.proxy.listenAddress:$ toString cfg.proxy.port""-ratelimit=10/1"# 10 requests per second per IP]; ; ; ;
For each server, I enable the local proxy with the following snippet. The
nginx configuration shown earlier exposes the /count endpoint under the same
domain as my blog.
Backup of the SQLite database with Litestream
Litestream is a streaming replication tool for SQLite databases. It
compresses the changes committed to the write-ahead log (WAL) next to the
database and sends them to a remote destination. I encapsulate its configuration
in a NixOS module, which takes an attribute set databases
mapping a name to the path of the database to back up.
Litestream also runs in a container. I mount the databases to replicate, as well
as the secrets to push the backups to a Hetzner storage box using SFTP:
We can restore the database from the backup with a few shell commands. First, we
stop the containers. Then, we move the damaged database away, invoke litestream
restore from the right environment, and restart the containers.9
Ten years after removing Google Analytics, JavaScript-based analytics is
back on this blog, but without storing cookies or IP addresses, and without
involving a third party. I still write for myself first, notably because it lets
me dig into a topic and refer back to it years later. But knowing a bit more
about my fellow human readers is a nice bonus, even the ones disabling
JavaScript.
Nginx scrambles IP addresses before storing them, thanks to the ipscrub
nginx module.
GoatCounter already filters some bots based on the user agent or the IP
address. But AI scrapers lie about their user agent and hide behind
residential proxies.
Without JavaScript, I cannot send the real referrer. I insert NoJS
instead.
I am missing the humans reading the RSS feed. I am not comfortable adding a
tracking pixel, and bots are likely to fetch it, compromising the
statistics. I ll live without counting these readers.
In February 2025, I tested another CSS-only approach without the interaction
trick: each page loaded an empty image as a background. Over a month, it
recorded up to ten times fewer page views than the nginx logs, even after
removing user agents identifying as bots. Compared to this experiment,
GoatCounter counts about three times fewer views, 18 months later. As the
time ranges differ, this is not an apples-to-apples comparison, but it gives
a hint about how efficient bot filtering is.
A NixOS module is a function receiving the configuration of the whole
system as config and returning three attributes:
imports adds other modules to import,
options declares user-configurable settings, each with a type and a default value, and
config sets values for options declared by any module, like containers from NixOS.
If a module does not need to declare options, you can return the config attribute
set directly. When a module does not require any argument, you can define it as an attribute
set instead.
Most of the time, you don t need an explicit import. NixOS automatically
imports the modules shipped with Nixpkgs. For my own
modules, some machinery also imports them automatically.
Litestream warns against using the auto-recover option as
it can cause data loss. But I don t properly monitor my servers and I prefer
uninterrupted backups to a slight chance of losing the last few records.
In my case, the process is slow: around 20 minutes for a 20 MiB database.
You can test by restoring to a copy with the -o option, but you still need
to stop the Litestream container.
It is said that those who cannot remember the past are condemned to
repeat it, a quote often attributed to the American philosopher George
Santayana. And to remember the past, records must be maintained and
kept accessible to learn from. With this in mind, it is no wonder
that archivists worldwide consider it crucial to ensure the archival
records are both complete and accurate, with a constant frustration
caused by the knowledge that the archives are neither due to
challenges in tracking down and collecting what should be
archived.
The last few days, I decided to simplify the collection of Messages
from the Mattermost chat
service, used by a few of the organisations I am involved in, to try
to improve the situation slightly. To achieve this, I had written a
dedicated extraction tool. Partly to see how hard it would be, and
partly to ensure that if one of the services were shut down or
replaced, everything in it would not be lost. Of course it is in the
nature of the use of instant messages that most of them are not fit
for permanent storage, at least not according to Norwegian law, where
there is a threshold "worthy of the archive" (arkivverdig) that should
be met, and messages like "should we go to lunch now" are below the
bar and should be filtered out. The tool can not help with this
filtering, and that will have to be done using other means after
collection.
The tools I had my bullshit generator write, under strict
supervision and many iterations, will extract every message visible to
the user whose credentials are used to log into Mattermost, and write
it out in Noark 5 extraction XML format and visualize the result. I
created the visualiser mostly to quickly be able to debug the
extracted XML, but also to make life easier for anyone interested in
testing out the tool set.
The extractor mattermost-noark5extract create a hierarchy
with arkiv/arkivdel for the Mattermost server, and then individual
mappe for each channel and direct message chat, a registrering for
each message thread, dokumentbeskrivelse for every message in the
tread, and one or more dokumentobjekt for each message and their
attachments/images. So far it is only tested on one Mattermost
installation, where around 23,000 messages is extracted in 61 seconds
and produce 295M with approximately 600 attachments and around 675,000
lines of XML in arkivstruktur.xml. You pass it the URL of the
service, a username and password, a directory path where to store the
collection and an optional channel name substring to limit the
collection to only a subset of the messages available.
The mattermost-noark5extract-browser viewer can load this
collection and visualize it similarly to Mattermost's web interface,
with the list of channels and direct messages dialogues on the left,
messages chronologically in the centre and a selected thread displayed
on the right.
I know Mattermost provide several login options. I've only had the
one used on my test server implemented so far, and know the extract
tool will have to be extended a bit for it to handle servers using one
of these options.
If you would like to examine the new toolkit,
mattermost-noark5extract
is available from gitlab. I wanted to put it on codeberg, but as
the recent rule change forbid code mostly written by a bullshit
generator there, it was not really an option. Note that some years
ago I wrote a similar tool to extract material from
the request
tracker system. The source for
request-tracker-noark5extract
is also available from codeberg. I would love to hear from you if
you test the tools.
As usual, if you use Bitcoin and wish to support my activities,
please send donations to
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.
Welcome to the August 2026 report from the Reproducible Builds project!
In our reports, we try to outline the most important things that we have been up to over the past month. As a quick recap about what problem our project intends to solve, whilst anyone may inspect the source code of free software for malicious flaws, almost all software is distributed to end users as pre-compiled binaries. The motivation behind the reproducible builds effort is to ensure no flaws have been introduced during this compilation process by promising identical results are always generated from a given source, thus allowing multiple third-parties to come to a consensus on whether a build was compromised or not.
In this month s report, we cover:
New updated SBOM specification from CISA.gov
CISA, the Cybersecurity and Infrastructure Security Agency of the U.S. government published some the joint guidance entitled Minimum Elements for a Software Bill of Materials (SBOM), which updates and supersedes the baseline 2021 version covered in previous editions of these reports.
Whilst the PDF is worth skimming, the interesting changes include that the specification now mandates standard cryptographic hashes: unlike earlier standards that allowed hash omission or manifest-only parsing, hashes must be computed from the output. This is is important for reproducible builds, as it ensures the recording of the metadata required to demonstrate the shipped software matches the build output precisely where applicable. In addition, where the top-level only dependency limitation that was present in the 2021 version has been removed in favour of complete coverage with no minimum depth. That is, SBOMs are expected to reflect all linked libraries, vendored dependencies and other build-time inclusions.
The basic idea behind bootstrappable builds is to create a system that can be built without relying on pre-built artifacts. Can we go from zero to the modern day without having to just assume the existence of these already-built-for-us artifacts? The classic recipe for yogurt requires some yogurt to start the process, which is like how we normally build a C compiler today we start with an existing C compiler binary. You might think about making sourdough bread with your grandmother s starter brought over from the old country; we re basically making C compilers with Dennis Ritchie s starter carried over from Bell Labs .
The reason I like the idea of making reproducible builds work is that I think it can be done in such a way as to not require any work on the part of the producer of a distribution (which is a technical term for sdists or wheels, i.e., the people who upload stuff to PyPI), and thus make reproducible builds very low-friction for people to opt into supporting. []
Brett goes on to outline What s missing from the specs and how reproducibility might be visible on PyPI to consumers:
Assuming all of this comes to pass and we record the where the source code is that went into a distribution and the software used to make the distribution, how do we make it useful to people? Does every person who cares about having a secure supply chain have to rebuild everything they use themselves? Is there some way for even people who don t care about this stuff to benefit? []
Distribution work
In Debian this month, 23 reviews of Debian packages were added, 28 were updated and 27 were removed this month adding to our knowledge about identified issues. A number of issue types have been updated as well, such as the addition of a new toolchain issue related to python-traitlets [], and the note for an existing issue related to texi2html was updated as well [].
Lastly, Bernhard M. Wiedemann posted another openSUSEmonthly update for their reproducibility work there.
Unreproducible builds under EROFS filesystem fixed
Martin Pitt reported on Fosstodon that they had identified an issue where the mkfs ( make filesystem ) command for the EROFS (Enhanced Read-Only File System) subsystem of the Linux kernel did not have sorted extended file attributes, leading to reproducible builds.
Thankfully, Martin also reported that they had fixed this in a commit to the kernel which order[s] each inode s xattrs by name so that images stay reproducible . []
Tool and documentation development
diffoscope is our in-depth and content-aware diff utility that can locate and diagnose reproducibility issues. This month, Chris Lamb made a number of changes, including preparing and uploading versions 327, 328 and 329 to Debian. In particular, he ensured that diffoscope did not require python3-guestfs in the autopkgtests on 32-bit architectures in order to fix Debian bug (#1144372) []. Colin Watson made an additional change, handling a potentially missing openssh-client package when running the autopkgtests [], and Jochen Sprickerhof made a similar change to cope with missing cpio and qemu-img functionality [] whilst also updating the XML comparator to be considered when comparing SVG images [].
Yet again, there were a number of improvements made to our website this month as well. For example:
Chris Lamb added draft for a Gothenburg summit-related news article. [][]
Lastly, a large number of commits were pushed comprising an interview with Reproducible Builds developer Jochen Sprickerhof to be published within the next week. [][][][][][][]
Six new scholarly papers
Jens Dietrich, Spencer Sun, Tim W. White and Behnaz Hassanshahi (the result of a collaboration between Victoria University of Wellington and Oracle Australia published a paper this month entitled No Snake Oil: Verifying Python Package Builds. Drawing on the metaphor of snake oil , that is, a fake or ineffective medicine or solution sold with exaggerated claims of curing or fixing everything, the authors write that
Two tools that are designed to automate [PyPI] rebuilds and run them at scale are macaron and oss-rebuild. We study 12,180 popular releases from PyPI and find that the byte-for-byte equivalence rate is generally low. We analyse the reasons why they produce different wheels, and find that equivalence between the original and rebuilt wheels can often still be established, preserving most of the guarantees users expect from rebuildable releases. We present and evaluate daleq4py, a tool to establish the equivalence of Python wheels through the kernel of a normalisation function that is based on provenance-preserving datalog rules. Experimental results show that daleq4py substantially expands the set of rebuilds that can be accepted as equivalent.
pose a persistent threat to opensource software. Known attempts to inject such backdoors into widely used projects through malicious commits, tampered release packages, or compromised third-party dependencies, were stopped only by luck and manual review. Existing Continuous Integration (CI) pipelines cannot detect these attacks, and downstream binary analysis tools require substantial manual effort. In this work, we present Lily, an automated approach that strengthens open-source development and release processes against backdoor injection. Lily integrates a backdoor detection mechanism into (1) CI pipelines to block malicious commits, and (2) release vetting workflows to prevent tampered releases or compromised dependencies from entering large ecosystems, such as Linux distributions.
The full PDF can be read online.
Ranindya Paramitha and Laurie Williams of North Carolina State University along with Christian K stner of Carnegie Mellon University published a paper this month with the title of The Software Supply Chain as a Market for Lemons: A Multivocal Review of Trust Signal Collapse. (A lemon in American English, is a vehicle that turns out to have several manufacturing defects .) Their abstract is as follows:
Practitioners evaluating open-source dependencies rely on cheap trust signals, e.g., stars, download counts, and contributor activity, as substitutes for direct code inspection, assuming those signals reflect genuine trustworthiness. Prior work has documented individual signal gaming, but the landscape of collapses across all dependency-adoption signals, as well as the ecosystem s response, remains unexplored. The goal of this study is to aid software practitioners in understanding the reliability of dependency adoption trust signals, such as download counts and contributor activity, by conducting a multivocal review of 252 Google Search sources and 870 Reddit threads.
Worryingly, after their review, the authors conclude that cheap trust signals collapse under three simultaneous forces: adversarial manipulation, gaming techniques indistinguishable from legitimate behavior, and non-adversarial AI-driven inflation.
The full PDF of the paper is available online.
Julien Malka, Aman Sharma, Martin Monperrus, Stefano Zacchiroli and Th o Zimmermann published a paper this month on Trusting-Trust Attack against an Entire Linux Distribution through Binary Manipulation:
Ken Thompson s trusting-trust attack, in which a compromised compiler backdoors the programs it builds and reproduces the backdoor in subsequent rebuilds of itself, is widely regarded as a threat specific to compilers. We show that it is not. We construct a complete trusting-trust attack around GNU strip, an ordinary build utility that neither inspects nor generates source code, using only manipulations of finished ELF files.
Scarily, in the authors example, a single tampered strip in the binary seed implants a payload that propagates from one generation of strip to the next and survives into the final standard environment after the seed leaves the dependency closure [ ] without failures and backdoors .
A full PDF of the paper is available for download online.
Mehdi Keshanimm, Amirhossein Rahmati, Mohammad Hossein Aref and Abbas Heydarnoori published a paper that is currently under review at Emperical Software Engineering titled AROMA+: A Study of Factors Affecting Reproducible Builds in the Maven Ecosystem. (Maven is a/the build automation tool used for Java projects.) In their paper, the authors note that
[ ] reusing external software in a project presents a security risk when the source of the component is unknown or the consistency of a component cannot be verified. The SolarWinds attack serves as a popular example in which the injection of malicious code into a library affected thousands of customers and caused a loss of billions of dollars. [ ] Our research aims to support [reproducibility] efforts in the Maven ecosystem through automation. We investigate the feasibility of automatically finding the source code of a library from its Maven release and recovering information about the original release environment. Our tool, AROMA+, can obtain this critical information from the artifact and the source repository through several heuristics and we use the results for reproduction attempts of packages on Maven Central.
[A]rtifact verification requires more than deterministic builds: a verifier must also recover the source state, build environment, dependencies, and build instructions that produced the artifact. Decentralized-build ecosystems make this difficult because artifacts are produced through heterogeneous tools, maintainer-controlled workflows, and fragmented metadata. As a result, it remains unclear how often artifacts in these ecosystems can be independently verified. This paper studies artifact verifiability across four popular decentralized-build package ecosystems. We define an independent verifier model that relies only on registry-derivable metadata and an artifact comparison model with tiered equivalence levels. We implement these models in an Artifact Verification Pipeline and use it to measure artifact verifiability across the target ecosystems.
The authors conclude that beyond build determinism, verifiability is limited by missing source and build metadata, implicit release transformations, and unconventional build practices .
A PDF of their paper can be reviewed online.
Patches
The Reproducible Builds project detects, dissects and attempts to fix as many currently-unreproducible packages as possible. We endeavour to send all of our patches upstream where applicable or possible. This month, we wrote a large number of such patches, including: