Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ci

# build (x86_64 and aarch64) -> test -> bundle -> release.
# version checker tests -> build (x86_64 and aarch64) -> test -> bundle -> release.
#
# The test suite runs against the binaries that were just compiled, so it
# cannot run before the build. Gating therefore sits on the bundle: nothing is
Expand Down Expand Up @@ -31,8 +31,17 @@ concurrency:
cancel-in-progress: true

jobs:
version-check-tests:
name: version checker tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- run: python3 tests/test_check_versions.py

build:
name: build
needs: version-check-tests
uses: ./.github/workflows/build.yml

test:
Expand Down
58 changes: 40 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ delicate, and every one of them runs against the Fil-C binary.
| Utility | Upstream suite | Result under Fil-C |
| --- | --- | --- |
| GNU tar | Autotest, 226 files | 208 pass, 36 skip |
| curl | 1664 enabled cases | 1664 pass |
| curl | 1712 enabled cases | 1712 pass |
| GNU Wget | `tests/` + `testenv/`, 136 cases | 134 pass, 2 skip |
| tmux | `regress/`, 35 cases (git only) | 35 pass |
| tmux | `regress/`, 174 cases (git only) | 174 pass |
| gzip | 34 cases | 33 pass, 1 skip |
| XZ Utils | 21 cases | 21 pass |
| Zstandard | `playTests.sh` and fuzzers | all pass |
Expand Down Expand Up @@ -432,7 +432,7 @@ also proves the terminal descriptions compiled into the binary are what let it
run where the scratch image has no terminfo on disk.

tmux's release tarball ships no tests either, but unlike nano its suite does
exist: the 35 scripts in `regress/` live only in the git tree. The build fetches
exist: the 174 scripts in `regress/` live only in the git tree. The build fetches
the same tag a second time as a source archive and takes only that directory,
which is how the unRAR build gets its fixture corpus, and runs the tests against
the binary already built. Two further checks cover what a headless suite cannot.
Expand All @@ -443,8 +443,18 @@ pane. Separately, every terminfo database on the build image is moved aside and
a session is started with none, which proves the compiled-in descriptions rather
than the builder's own database are doing the work.

Four details are easy to get wrong. curl's suite silently skips its 62 HTTPS
cases unless `stunnel4` is installed, and zstd's re-links the CLI, so it needs
tmux has three libc compatibility fixes scoped to Fil-C. Time-expanded strings
escape conversion specifications musl does not recognize, so literal tmux pane
IDs such as `%0` behave as they do with glibc instead of blanking a status line.
Plain `ctime` expansion rejects years outside musl's printable range before its
`asctime_r` abort path, while custom time formats keep working. Finally, panes
with equal sort keys use pane-list order rather than musl's unstable `qsort`
permutation. Exact upstream regressions and focused format checks cover all
three paths. The sixel-enabled build also adjusts the suite's primary device
attributes expectation to include the sixel capability it deliberately enables.

Four details are easy to get wrong. curl's suite silently skips its HTTPS cases
unless `stunnel4` is installed, and zstd's re-links the CLI, so it needs
the same flags as the build or it fails to link rather than testing anything.
Wget's HTTPS tests name their server `WgetTestingServer` and map it to
localhost through `HOSTALIASES`, a glibc feature the musl client ignores; the
Expand Down Expand Up @@ -690,21 +700,21 @@ than content-addressed image digests.
| bzip2 source | 1.0.8 | `ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269` |
| XZ Utils source | 5.8.4 | `4ce24038fd4221e0d13bc1a2de7a4db56e90b92b3bf75321f6c14be73f65de4b` |
| Zstandard source | 1.5.7 | `eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3` |
| curl source | 8.22.0 | `f7ef3ae8a22e521f289803fe93543eb64c329b58aa73a9e224dfd915a2a5f4f7` |
| curl source | 8.23.0 | `8dadd7d2536a314f982ad05a651b713f426bf7d02cc2c76cffb9796f2218e6c5` |
| GNU Wget source | 1.25.0 | `766e48423e79359ea31e41db9e5c289675947a7fcf2efdcedb726ac9d0da3784` |
| OpenSSL source (curl, git, OpenSSH) | 4.0.3 | `325b5c806167c13b40b1ffeadfe0248197c00eccc4cf123ec1e28d2d2fd216d9` |
| OpenSSL source (wget) | 3.6.5 | `a2157c2830efdec3788939b00c9b0638306d3f0bbb76dc4832ee503bb397df98` |
| zlib source | 1.3.2 | `bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16` |
| libunistring source | 1.4.2 | `5b46e74377ed7409c5b75e7a96f95377b095623b689d8522620927964a41499c` |
| libunistring source | 1.5 | `fe89007a8a414ae4790b816b86859e877d3ab135db3c37f06541ff7e85ac344b` |
| libidn2 source | 2.3.8 | `f557911bf6171621e1f72ff35f5b1825bb35b52ed45325dcdee931e5d3c0787a` |
| libpsl source | 0.23.3 | `93941f85a1e7bd593fa94f299233cb5dfc91cd144fd9a78a6ceb75001c5b03be` |
| PCRE2 source | 10.49 | `929f0b20e62879252a15886b06c89f1edef61a363cbd5826fb041080a5e557ae` |
| c-ares source | 1.34.8 | `c222b6d681096f9444d2c4863d2c1174019e27cacca0a4a5c114d36dd7d7bf78` |
| GNU nano source | 9.1 | `5f47764274cb7532349ce0aa20ec10f1e8e851a6e9fa3eb66812c43d196db042` |
| c-ares source | 1.34.9 | `9364b70a12eb59a06830fb488d9357f90100dff0d98b23ea3593a183d43e6f2f` |
| GNU nano source | 9.2 | `05ecb99247b782e8a5b3a25ed4101dd034b0236902f7449bc9795b717642f7e9` |
| ncurses source | 6.6 | `355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11` |
| file source | 5.46 | `c9cc77c7c560c543135edc555af609d5619dbef011997e988ce40a3d75d86088` |
| tmux source | 3.7c | `7c60cae9a0e25288e2e24750aafc9e8800fc7fd4555e447e1b29ee4201cfb3bf` |
| tmux tests (git tag) | 3.7c | `5e7b0f533b66e5633e2b72a9d483f9534a343ab7011eb2621b6309dfba553daa` |
| file source | 5.48 | `ed14656883b23a364b4057c05595d93252da9bc473d30106519519d0da141283` |
| tmux source | 3.8 | `e79c699c7e949dccd0a4a125e17b8d1261e311b16979dbc8eb34542f3966d82e` |
| tmux tests (git tag) | 3.8 | `f873f9379c9cf30d3d66b642a955118c4fbb0019d046d13e6012340811e5dcb7` |
| libevent source | 2.1.13 | `f7e9383b8c0baa81b687e5b5eecc01beefaf1b19b64151d95ed61647fe7a315c` |
| utf8proc source | 2.12.0 | `a393fbef160835fb315bc3e91ba8d86f7a73a7cec9e6198b6c60b848b498bfeb` |
| Git source | 2.56.0 | `26c56c296b38c0695b26fa95f475f1d01704d2d38e73465ca30b0b2f5dc789d3` |
Expand Down Expand Up @@ -879,7 +889,8 @@ recovery.
│ ├── Dockerfile
│ └── patches/
├── tmux/
│ └── Dockerfile
│ ├── Dockerfile
│ └── patches/
├── unrar/
│ ├── Dockerfile
│ └── patches/
Expand All @@ -892,6 +903,7 @@ recovery.
│ └── patches/
└── tests/
├── run-tests.sh
├── test_check_versions.py
├── lib.sh
├── make-seed.py
├── make-corpus.sh
Expand Down Expand Up @@ -969,9 +981,10 @@ curl 8.19.0 8.21.0 OUTDATED
The `COMPONENTS` table is explicit rather than discovered from Dockerfile
arguments. Every upstream has a different release source, so each registered
component uses its project's authoritative release API or listing: GitHub,
GNU, Sourceware, RARLab, or the OpenBSD CDN. A new maintained release pin needs
a table entry and an upstream-specific lookup or it will not receive freshness
reports.
Sourceware, RARLab, the OpenBSD CDN, or astron.com's `file` archive. GNU
lookups use canonical `ftp.gnu.org` first, with its mirror redirector as a
bounded fallback. A new maintained release pin needs a table entry and an
upstream-specific lookup or it will not receive freshness reports.

The check never stops at the first problem. A component whose upstream is
unreachable, or whose listing has changed shape, is reported as an error and
Expand All @@ -980,6 +993,7 @@ It runs locally the same way, where it does exit nonzero if anything is behind,
so it works as a plain command as well as a source of comment text:

```sh
python3 tests/test_check_versions.py
python3 check-versions.py
```

Expand Down Expand Up @@ -1203,6 +1217,12 @@ Fil-C tree, is dynamic and installs into a prefix that already holds ncurses
and libevent, so the static link and the terminfo question are this build's own
work rather than something inherited from it.

Three tmux source paths are patched for Fil-C's musl libc: unknown `strftime`
conversions are preserved literally, plain `ctime` rejects years its fixed
buffer cannot print, and pane sorts make equal-key list order explicit instead
of relying on libc `qsort` stability. Each patch has a focused assertion or an
upstream regression that fails without it.

OpenSSH locks Fil-C's collector and allocator threads before installing its
preauthentication seccomp filter, then allows the runtime's `sched_yield` and
`MAP_NORESERVE` use. Violations kill the whole process because leaving other
Expand All @@ -1219,8 +1239,10 @@ tests, and live default key exchange cover them.

### Updating a dependency

Run `python3 check-versions.py` to see which pins are behind; the `versions`
workflow runs the same check when a pull request is opened and comments if any
Run `python3 tests/test_check_versions.py` to verify the lookup logic, then
`python3 check-versions.py` to see which pins are behind. The `ci` workflow
runs the unit tests on every pull-request update and main push; the `versions`
workflow runs the live check when a pull request is opened and comments if any
are.

1. Change the version and checksum arguments near the top of its Dockerfile.
Expand Down
75 changes: 54 additions & 21 deletions check-versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
continues: a single unreachable host must not hide a stale pin somewhere else.
Every component is always in the table.
"""
import http.client
import json
import os
import re
Expand All @@ -25,20 +26,25 @@


# --------------------------------------------------------------------- fetching
def _get(url, headers=None):
def _get(url, headers=None, *, timeout=TIMEOUT, retries=RETRIES):
last = None
for attempt in range(RETRIES):
for attempt in range(retries):
try:
req = urllib.request.Request(url, headers={"User-Agent": UA, **(headers or {})})
with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
with urllib.request.urlopen(req, timeout=timeout) as resp:
return resp.read()
except (urllib.error.URLError, TimeoutError, OSError) as exc:
except (
urllib.error.URLError,
http.client.HTTPException,
TimeoutError,
OSError,
) as exc:
last = exc
raise RuntimeError(f"{url}: {last}")


def get_text(url, headers=None):
return _get(url, headers).decode("utf-8", "replace")
def get_text(url, headers=None, *, timeout=TIMEOUT, retries=RETRIES):
return _get(url, headers, timeout=timeout, retries=retries).decode("utf-8", "replace")


def get_json(url):
Expand Down Expand Up @@ -90,8 +96,10 @@ def newest(versions):
def github_latest(repo, strip="", underscores=False, series=None):
"""Newest non-prerelease tag for a GitHub repository.

Prefers the release marked "latest"; falls back to the tag list for
projects that publish releases without setting that flag.
Checks releases and tags together. Projects can publish a stable tag before
creating its GitHub release, so trusting only the latest-release pointer can
leave a newer tag unnoticed. Tags attached to prerelease or draft releases
are excluded even when their names look like stable numeric versions.

`series` restricts the answer to one release line, for example "3." to stay
within OpenSSL 3.x. A pin deliberately held back still needs its own line
Expand All @@ -104,33 +112,56 @@ def norm(tag):
tag = tag[len(strip):]
return tag.replace("_", ".") if underscores else tag

try:
tag = get_json(f"https://api.github.com/repos/{repo}/releases/latest")["tag_name"]
version = norm(tag)
if is_stable(version) and (series is None or version.startswith(series)):
return version
except RuntimeError:
pass # no "latest" release marked, or transient; try the tag list

tags = get_json(f"https://api.github.com/repos/{repo}/tags")
names = (norm(t["name"]) for t in tags)
releases = get_json(f"https://api.github.com/repos/{repo}/releases?per_page=100")
excluded_tags = {
release["tag_name"]
for release in releases
if release.get("draft") or release.get("prerelease")
}
versions = [
norm(release["tag_name"])
for release in releases
if release["tag_name"] not in excluded_tags
]

tags = get_json(f"https://api.github.com/repos/{repo}/tags?per_page=100")
names = (norm(t["name"]) for t in tags if t["name"] not in excluded_tags)
if series is not None:
names = (n for n in names if n.startswith(series))
return newest(names)
versions = [v for v in versions if v.startswith(series)]
versions.extend(names)
return newest(versions)


def gnu_ftp(name, directory=None):
# libidn2 releases live in the gnu/libidn/ directory alongside libidn's, so
# the listing to read and the file prefix to match are not always the same.
html = get_text(f"https://ftp.gnu.org/gnu/{directory or name}/")
return newest(re.findall(rf"{re.escape(name)}-(\d+(?:\.\d+)+)\.tar\.", html))
directory = directory or name
last = None
for url in (
f"https://ftp.gnu.org/gnu/{directory}/",
f"https://ftpmirror.gnu.org/{directory}/",
):
try:
html = get_text(url, timeout=10, retries=1)
return newest(
re.findall(rf"{re.escape(name)}-(\d+(?:\.\d+)+)\.tar\.", html)
)
except RuntimeError as exc:
last = exc
raise RuntimeError(f"GNU listings failed: {last}")


def sourceware_bzip2():
html = get_text("https://sourceware.org/pub/bzip2/")
return newest(re.findall(r"bzip2-(\d+(?:\.\d+)+)\.tar\.gz", html))


def astron_file():
html = get_text("https://astron.com/pub/file/")
return newest(re.findall(r"file-(\d+(?:\.\d+)+)\.tar\.gz", html))


def rarlab_unrar():
# rarlab has no API. The current UnRAR source is linked from the add-ons
# page and the main download page; take whichever gives the higher version.
Expand Down Expand Up @@ -203,6 +234,8 @@ def openbsd_openssh():
("libevent", "tmux/Dockerfile", "LIBEVENT_VERSION", libevent_latest),
("utf8proc", "tmux/Dockerfile", "UTF8PROC_VERSION", lambda: github_latest("JuliaStrings/utf8proc", "v")),
("ncurses", "tmux/Dockerfile", "NCURSES_VERSION", lambda: gnu_ftp("ncurses")),
("nano", "nano/Dockerfile", "NANO_VERSION", lambda: gnu_ftp("nano")),
("file", "nano/Dockerfile", "FILE_VERSION", astron_file),
("git", "git/Dockerfile", "GIT_VERSION", lambda: github_latest("git/git", "v")),
("expat", "git/Dockerfile", "EXPAT_VERSION", expat_latest),
("openssh", "openssh-server/Dockerfile", "OPENSSH_VERSION", openbsd_openssh),
Expand Down
8 changes: 4 additions & 4 deletions curl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ARG ZLIB_VERSION=1.3.2
ARG ZLIB_SHA256=bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16
ARG OPENSSL_VERSION=4.0.3
ARG OPENSSL_SHA256=325b5c806167c13b40b1ffeadfe0248197c00eccc4cf123ec1e28d2d2fd216d9
ARG CURL_VERSION=8.22.0
ARG CURL_SHA256=f7ef3ae8a22e521f289803fe93543eb64c329b58aa73a9e224dfd915a2a5f4f7
ARG CURL_VERSION=8.23.0
ARG CURL_SHA256=8dadd7d2536a314f982ad05a651b713f426bf7d02cc2c76cffb9796f2218e6c5

FROM ubuntu:24.04 AS build

Expand Down Expand Up @@ -177,8 +177,8 @@ RUN binary=/src/src/curl \
# ends of every connection rather than only on the client.
#
# stunnel is what makes the TLS cases runnable. Without it curl's suite skips
# 62 HTTPS tests and still reports success, which for a network client would
# leave the most important paths untested while looking healthy.
# HTTPS tests and still reports success, which for a network client would leave
# the most important paths untested while looking healthy.
#
# The run is checked two ways. runtests.pl must succeed, and a floor is placed
# under the number of cases that actually ran, because a configuration change
Expand Down
4 changes: 2 additions & 2 deletions git/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ARG ZLIB_VERSION=1.3.2
ARG ZLIB_SHA256=bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16
ARG OPENSSL_VERSION=4.0.3
ARG OPENSSL_SHA256=325b5c806167c13b40b1ffeadfe0248197c00eccc4cf123ec1e28d2d2fd216d9
ARG CURL_VERSION=8.22.0
ARG CURL_SHA256=f7ef3ae8a22e521f289803fe93543eb64c329b58aa73a9e224dfd915a2a5f4f7
ARG CURL_VERSION=8.23.0
ARG CURL_SHA256=8dadd7d2536a314f982ad05a651b713f426bf7d02cc2c76cffb9796f2218e6c5
ARG PCRE2_VERSION=10.49
ARG PCRE2_SHA256=929f0b20e62879252a15886b06c89f1edef61a363cbd5826fb041080a5e557ae
ARG EXPAT_VERSION=2.9.0
Expand Down
10 changes: 5 additions & 5 deletions nano/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ ARG FILC_X86_64_SHA256=60bfbe8ee63d7e462394aa8d5e44fee675de892bcf800d9cc80d86378
ARG FILC_AARCH64_SHA256=142987830090df8c0cffa0bbcad32a930f661683f8c5073b21986e39aa7209f2
ARG NCURSES_VERSION=6.6
ARG NCURSES_SHA256=355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11
ARG FILE_VERSION=5.46
ARG FILE_SHA256=c9cc77c7c560c543135edc555af609d5619dbef011997e988ce40a3d75d86088
ARG NANO_VERSION=9.1
ARG NANO_SHA256=5f47764274cb7532349ce0aa20ec10f1e8e851a6e9fa3eb66812c43d196db042
ARG FILE_VERSION=5.48
ARG FILE_SHA256=ed14656883b23a364b4057c05595d93252da9bc473d30106519519d0da141283
ARG NANO_VERSION=9.2
ARG NANO_SHA256=05ecb99247b782e8a5b3a25ed4101dd034b0236902f7449bc9795b717642f7e9

FROM ubuntu:24.04 AS build

Expand Down Expand Up @@ -114,7 +114,7 @@ RUN curl -fsSL ${FETCH_RETRY} -o /tmp/file.tar.gz \
&& rm /tmp/file.tar.gz

# --datadir sets the database path compiled into the library, but `make install`
# would also write the 5.46-format magic.mgc to that path, replacing the build
# would also write the 5.48-format magic.mgc to that path, replacing the build
# image's system database with one its own `file` (5.45) cannot read -- which
# then reports every binary as "data" and breaks the provenance checks below.
# Staging the install and copying only the pieces nano links against keeps the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ unnecessary.

--- a/lib/fpucw.h
+++ b/lib/fpucw.h
@@ -65,7 +65,8 @@ extern "C" {
@@ -67,7 +67,8 @@ extern "C" {


/* Inline assembler like this works only with GNU C and clang. */
Expand Down
Loading
Loading