Use GNU comm to check a release artifact list in CI and give the job three outcomes: complete, missing an artifact, or unable to compare. Suppose your release needs an api and a worker binary but built only api. The raw comparison prints worker and still exits with status 0, because the comparison itself succeeded.

Actual shell output showing worker and status zero
The missing artifact is on stdout, even though the status is zero.

Put the expected artifact names in required.txt and the names that actually built in built.txt.

printf '%s\n' api worker \ > required.txt printf '%s\n' api > built.txt LC_ALL=C comm --check-order \ -23 required.txt built.txt printf 'status: %s\n' "$?" 
worker status: 0 

Comparison of the required names api and worker with the built name api
The first column contains the names that only appear in the required list.

-23 hides the second and third columns. The first column, which remains, lists lines found only in the first file. So worker means the comparison worked and the release is incomplete.

Give a missing artifact a status of its own

Capture the output and the exit status separately. Check the status first. A comparison can leave partial output when it encounters invalid input.

check_required() { local -x LC_ALL=C local missing rc if missing=$(comm \ --check-order -23 \ -- "$1" "$2"); then if [[ -n $missing ]]; then >&2 printf '%s\n' \ "$missing" return 1 fi return 0 else rc=$? echo "comm error $rc" >&2 return 2 fi } 

The release check distinguishes a pass, a missing item, and an invalid comparison
A failed comparison takes precedence over any partial output.

With the two files above, the function returns 1. Add worker to built.txt and it returns 0. Put worker before api instead, and GNU comm --check-order rejects the file; the function returns 2.

Captured regression output for missing, complete, and unsorted manifests
The same check produces three different outcomes.

Decide what a repeated line means

Suppose two build steps both expect the same api artifact. Someone appends both names to required.txt and the inventory lists api only once. With ordinary comm, the first api pairs up and the second one is reported as missing. This can happen even when every distinct artifact exists.

Two required api lines compete for one built api line
One built entry cannot pair with two required entries.

For a list of unique artifact names, normalize both files before checking. Keep the originals so you can inspect what a generator actually produced.

export LC_ALL=C sort -u -- required.txt \ > required.sorted || exit 2 sort -u -- built.txt \ > built.sorted || exit 2 check_required \ required.sorted built.sorted 

Sorting and deduplicating name inventories before comparison
Use this only when each distinct name represents one requirement.

If repeated lines represent distinct things, keep them. For example, api built for linux-amd64 and linux-arm64 should have distinct manifest keys such as linux-amd64/api and linux-arm64/api. Deduplicating a list of bare names would hide a missing architecture.

Architecture-qualified api paths keep the builds distinct
Qualify the key before normalizing if there is one requirement per architecture.

Check the producers, too

When commands generate the lists, make each command succeed before sorting its output. An empty file after a failed generator looks exactly like a legitimately empty list to comm.

Release flow: check generators, normalize if allowed, compare, then branch
A failed manifest generator stops the check before comparison.

I ran the fixtures with GNU coreutils 9.7 and Bash 5.2.37. The commands assume GNU comm and nonempty, newline-delimited artifact keys. A blank key would get lost at the end of Bash command substitution, so reject blank keys when you generate the lists. On a different runner, check whether comm supports --check-order before relying on that flag.

Scope of the check, GNU comm and nonempty newline-delimited keys
This example assumes one nonempty artifact key per line.

AI disclosure: AI drafted this article and made the diagrams. The shell outputs were reproduced with GNU coreutils 9.7 and Bash 5.2.37.

Source: GNU Coreutils manual: comm invocation.