CI: Simulate Pikaur flag duplication in Arch Linux builds (fix #55) #108

Manually merged
jabber.developer merged 1 commits from feat/pikaur-parity-arch into master 2026-04-21 14:00:20 +00:00

Summary

This PR introduces a simulation layer in the Arch Linux CI runner to detect build failures caused by Pikaur's flag duplication bug. This ensures that any code change which causes a flag collision (e.g., -D_FORTIFY_SOURCE conflicts) will be caught in CI before it breaks the build for our Arch users.

The Problem

Pikaur's makepkg_config.py has a cascading logic flaw: it pulls flags from /etc/makepkg.conf and merges them into the build environment.

This creates a collision when our project's Makefile.am defines its own flags. For example, if the system defines -D_FORTIFY_SOURCE=3 and our Makefile defines -D_FORTIFY_SOURCE=2, the resulting compiler command contains both, causing a "variable redefined" error. Currently, our CI is "too clean"—it uses a standard environment that doesn't trigger this bug, allowing broken code to pass CI and fail in the hands of users.

The Solution

I have updated ci-build.sh to mimic a "dirty" Pikaur environment specifically when running on Arch Linux.

Key Changes:

  • Arch Detection: The simulation only triggers if grep identifies ID=arch in /etc/os-release. This prevents accidental corruption of Debian/Ubuntu CI runs.
  • Robust Parsing: Implemented a get_flag helper using sed to flatten multi-line variables in /etc/makepkg.conf. This correctly handles trailing backslashes (\) and whitespace, preventing syntax errors in the exported strings.
  • Environment Injection: Instead of passing flags as command-line arguments (which would violate parity), the script now exports the system CFLAGS and LDFLAGS directly into the shell. This allows configure and make to pick up the "corrupt" flags naturally, exactly as they would in a real Pikaur session.

How to Verify

  1. Test Collision: Manually add a conflicting flag to Makefile.am (e.g., a different version of a macro used in makepkg.conf). The Arch CI should now fail.
  2. Test Neutrality: Verify that the Debian and Ubuntu CI jobs still run with a clean environment and are unaffected by this change.

Fixes #55

## Summary This PR introduces a simulation layer in the Arch Linux CI runner to detect build failures caused by Pikaur's flag duplication bug. This ensures that any code change which causes a flag collision (e.g., `-D_FORTIFY_SOURCE` conflicts) will be caught in CI before it breaks the build for our Arch users. ## The Problem Pikaur's `makepkg_config.py` has a cascading logic flaw: it pulls flags from `/etc/makepkg.conf` and merges them into the build environment. This creates a **collision** when our project's `Makefile.am` defines its own flags. For example, if the system defines `-D_FORTIFY_SOURCE=3` and our Makefile defines `-D_FORTIFY_SOURCE=2`, the resulting compiler command contains both, causing a "variable redefined" error. Currently, our CI is "too clean"—it uses a standard environment that doesn't trigger this bug, allowing broken code to pass CI and fail in the hands of users. ## The Solution I have updated `ci-build.sh` to mimic a "dirty" Pikaur environment specifically when running on Arch Linux. ### Key Changes: - **Arch Detection:** The simulation only triggers if `grep` identifies `ID=arch` in `/etc/os-release`. This prevents accidental corruption of Debian/Ubuntu CI runs. - **Robust Parsing:** Implemented a `get_flag` helper using `sed` to flatten multi-line variables in `/etc/makepkg.conf`. This correctly handles trailing backslashes (`\`) and whitespace, preventing syntax errors in the exported strings. - **Environment Injection:** Instead of passing flags as command-line arguments (which would violate parity), the script now `export`s the system `CFLAGS` and `LDFLAGS` directly into the shell. This allows `configure` and `make` to pick up the "corrupt" flags naturally, exactly as they would in a real Pikaur session. ## How to Verify 1. [x] **Test Collision:** Manually add a conflicting flag to `Makefile.am` (e.g., a different version of a macro used in `makepkg.conf`). The Arch CI should now fail. 2. [x] **Test Neutrality:** Verify that the Debian and Ubuntu CI jobs still run with a clean environment and are unaffected by this change. Fixes #55
jabber.developer added 1 commit 2026-04-18 16:13:53 +00:00
ci: simulate Pikaur flag duplication in Arch Linux CI
All checks were successful
CI Code / Check spelling (pull_request) Successful in 19s
CI Code / Check coding style (pull_request) Successful in 33s
CI Code / Code Coverage (pull_request) Successful in 2m55s
CI Code / Linux (debian) (pull_request) Successful in 4m7s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m34s
CI Code / Linux (arch) (pull_request) Successful in 9m52s
8c6c9f4f42
Inject system flags from /etc/makepkg.conf into the CI environment to
detect build collisions caused by Pikaur's configuration bug.

Pikaur's cascading logic causes flags from /etc/makepkg.conf to be
merged into the build environment. This creates collisions with flags
defined in the project's Makefile.am (e.g., duplicate -D_FORTIFY_SOURCE
definitions), which can cause builds to fail for users.

By exporting these flags in the CI environment, we ensure that any
code change that is sensitive to flag duplication will trigger a
failure in our Arch Linux CI matrix, preventing broken builds from
reaching users.

Implementation details:
- Detects Arch Linux via /etc/os-release.
- Uses a sed-based flattener to handle multi-line variables and
  trailing backslashes in makepkg.conf.
- Exports the flags to the shell environment so that 'configure'
  and 'make' inherit them naturally, maintaining parity with a
  real Pikaur session.
jabber.developer changed title from ci: simulate Pikaur flag duplication in Arch Linux CI to CI: Simulate Pikaur flag duplication in Arch Linux builds (fix #55) 2026-04-18 16:14:14 +00:00
jabber.developer added 1 commit 2026-04-18 16:36:55 +00:00
Revert "build(pikaur): Fix failure due to duplicated flag and warnings"
Some checks failed
CI Code / Check spelling (pull_request) Successful in 17s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Linux (debian) (pull_request) Successful in 4m38s
CI Code / Code Coverage (pull_request) Failing after 5m4s
CI Code / Linux (arch) (pull_request) Failing after 5m25s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m46s
4611bd339d
This reverts commit 0722dc9e36.
Author
Owner

Last build should fail, indicating parity with Pikaur builds

Last build should fail, indicating parity with Pikaur builds
Author
Owner

As expected, build failed on Arch (only on Arch, confirming that Ubuntu and Debian are not affected). Code Coverage job has also failed due to the fact that it's also run on Arch. Collision and neutrality tests are passed.

As expected, build failed on Arch (only on Arch, confirming that Ubuntu and Debian are not affected). Code Coverage job has also failed due to the fact that it's also run on Arch. Collision and neutrality tests are passed.
jabber.developer force-pushed feat/pikaur-parity-arch from 4611bd339d to 8c6c9f4f42 2026-04-18 16:46:57 +00:00 Compare
jabber.developer self-assigned this 2026-04-18 16:47:28 +00:00
jabber.developer requested review from jabber.developer2 2026-04-18 16:47:30 +00:00
jabber.developer added the
Kind/Testing
Priority
Medium
3
labels 2026-04-18 16:47:47 +00:00
jabber.developer added this to the Plans (2025-2026) project 2026-04-18 16:47:56 +00:00
jabber.developer moved this to Verification in Plans (2025-2026) on 2026-04-18 16:48:44 +00:00
jabber.developer removed this from the Plans (2025-2026) project 2026-04-18 16:49:43 +00:00
jabber.developer force-pushed feat/pikaur-parity-arch from 8c6c9f4f42 to 7ef45977c8 2026-04-19 13:14:16 +00:00 Compare
jabber.developer added 1 commit 2026-04-20 05:59:39 +00:00
Revert "build(pikaur): Fix failure due to duplicated flag and warnings"
All checks were successful
CI Code / Check spelling (pull_request) Successful in 22s
CI Code / Check coding style (pull_request) Successful in 35s
CI Code / Code Coverage (pull_request) Successful in 3m18s
CI Code / Linux (debian) (pull_request) Successful in 4m44s
CI Code / Linux (arch) (pull_request) Successful in 5m35s
CI Code / Linux (ubuntu) (pull_request) Successful in 7m18s
4a59ccaa80
This reverts commit 0722dc9e36.
jabber.developer force-pushed feat/pikaur-parity-arch from 4a59ccaa80 to 04dafdf36f 2026-04-21 10:18:36 +00:00 Compare
jabber.developer removed the
Kind/Testing
Priority
Medium
3
labels 2026-04-21 12:29:59 +00:00
Author
Owner

Notes:
After review by @jabber.developer2, it was decided to use source /etc/makepkg.conf method instead. It was also tested via the same method. Results:

  1. without set -a, the parity is not achieved since variable set in the makepkg.conf are not propagated further
  2. with set -a, the first run of the job 336 failed due to CI issue. Runners were restarted. The second time, it failed as expected (arch & code coverage).

Tests have shown that this implementation is valid.

Notes: After review by @jabber.developer2, it was decided to use `source /etc/makepkg.conf` method instead. It was also tested via the same method. Results: 1. [without](https://git.jabber.space/devs/cproof/actions/runs/335/jobs/0) `set -a`, the parity is not achieved since variable set in the `makepkg.conf` are not propagated further 2. with `set -a`, the first run of the job 336 failed due to CI issue. Runners were restarted. The second time, it failed as expected (arch & code coverage). Tests have shown that this implementation is valid.
jabber.developer force-pushed feat/pikaur-parity-arch from 04dafdf36f to 0feacbc9da 2026-04-21 13:44:58 +00:00 Compare
jabber.developer manually merged commit 0feacbc9da into master 2026-04-21 14:00:20 +00:00
Sign in to join this conversation.
No description provided.