The perils of transition to 64-bit time_t

(please note that there’s a correction at the bottom)

In the Overview of cross-architecture portability problems, I have dedicated a section to the problems resulting from use of 32-bit time_t type. This design decision, still affecting Gentoo systems using glibc, means that 32-bit applications will suddenly start failing in horrible ways in 2038: they will be getting -1 error instead of the current time, they won’t be able to stat() files. In one word: complete mayhem will emerge.

There is a general agreement that the way forward is to change time_t to a 64-bit type. Musl has already switched to that, glibc supports it as an option. A number of other distributions such as Debian have taken the leap and switched. Unfortunately, source-based distributions such as Gentoo don’t have it that easy. So we are still debating the issue and experimenting, trying to figure out a maximally safe upgrade path for our users.

Unfortunately, that’s nowhere near trivial. Above all, we are talking about a breaking ABI change. It’s all-or-nothing. If a library uses time_t in its API, everything linking to it needs to use the same type width. In this post, I’d like to explore the issue in detail — why is it so bad, and what we can do to make it safer.
Continue reading “The perils of transition to 64-bit time_t”

Overview of cross-architecture portability problems

Ideally, you’d want your program to work everywhere. Unfortunately, that’s not that simple, even if you’re using high-level “portable” languages such as Python. In this blog post, I’d like to focus on some aspects of cross-architecture problems I’ve seen or heard about during my time in Gentoo. Please note that I don’t mean this to be a comprehensive list of problems — instead, I’m aiming for an interesting read.
Continue reading “Overview of cross-architecture portability problems”

X-alpha hexadecimal notation

The most common way to represent hexadecimal (or any other base > 10) numbers is to use the first letters of alphabet for the extra digits. However, this doesn’t work well for my brain that insists that since A is the first letter, B is the second letter… then A = 10 + 1, B = 10 + 2… so I keep having to remember to shift this by one, and judging by the responses to my toot about it, it seems that I’m not alone.

I don’t think that I’ve made any useless invention that people would randomly find and say “oh, hey, what a nice unrealistic idea”. It’s time to make one! I present to you: the X-alpha hexadecimal notation!
Continue reading “X-alpha hexadecimal notation”

Naming standards compliance of PEP517 backends

PyPA maintains two standards regarding packaging artifact filenames:

I have decided to give a few popular PEP 517 backends a go and see whether they follow the standards.

Continue reading “Naming standards compliance of PEP517 backends”

How Debuggers Work: Getting and Setting x86 Registers, Part 2: XSAVE

In the previous part of this article, I have described the basic methods of getting and setting the baseline registers of 32-bit and 64-bit x86 CPUs. I have covered General Purpose Registers, baseline Floating-Point Registers and Debug Registers along with their ptrace(2) interface.

In the second part, I would like to discuss the XSAVE family of instructions. I will describe the different variants of this instruction as well as explain the differences between them and their limitations. Afterwards, I will compare the ptrace(2) API used to access its data on Linux, FreeBSD and NetBSD. Other systems such as OpenBSD or DragonFly BSD do not provide requests to retrieve or set extended registers, so the comparison may help them design their own APIs.

Continue reading