Files
reiserfsprogs/.github/workflows/build.yml
T
lgcosta 7b5421ce49
build / build (clang, ) (push) Failing after 7s
build / build (clang, --enable-warnings) (push) Failing after 5s
build / build (gcc, ) (push) Failing after 5s
build / build (gcc, --enable-io-failure-emulation) (push) Failing after 5s
build / build (gcc, --enable-warnings) (push) Failing after 6s
build / out-of-tree (push) Failing after 6s
build / sanitizers (push) Failing after 5s
Support clang builds; fix the defects clang and its sanitizers exposed
Clang (22.1.8 on the host, 14.0.6 in the Debian VM) now builds the tree
warning-free with --enable-warnings, in-tree and out-of-tree, with -j, and
the full VM battery passes with CC=clang: 12/12. ASan/UBSan builds run the
real tool paths (mkfs, check, tune, resize, rollback save/restore/reject)
with halt_on_error and report zero errors. Documented in tests/vm/RESULTS.md;
the CI gained clang+warnings, out-of-tree and sanitizer jobs.

Fixes found by this work:

- reiserfscore/Makefile.am: reiserfs_err.c and reiserfs_err.h shared one
  recipe. With -j, make runs the recipe once per stale target, so two
  compile_et invocations race: one deletes reiserfs_err.c ("no input
  files") while another job compiles it. Attached the recipe to
  reiserfs_err.c only; reiserfs_err.h merely depends on it. Reproduced
  with clang+ASan, stable across 5 clang / 3 asan / 3 gcc parallel builds.

- reiserfscore/Makefile.am: the rule read the source-local
  reiserfs_err.et, so VPATH builds could not find it. Use $(srcdir)/.
  make distcheck now passes.

- reiserfscore/reiserfslib.c: reiserfs_close() did fsync(fs->fs_dev) after
  reiserfs_free() released fs -- a 4-byte heap-use-after-free, flagged
  exactly at reiserfslib.c:406/407 by ASan (found by clang+ASan; gcc never
  caught it because the freed heap usually still holds the old value).
  Moved fsync before the free; reiserfs_flush() has already written
  journal and dirty buffers at that point and free_buffers() never
  writes, so the ordering preserves durability semantics.

- fsck/semantic_check.c, fsck/semantic_rebuild.c: three %K arguments passed
  &tmp_deh->deh2_dir_id where a struct reiserfs_key * is expected. It
  printed the right values only because deh2_dir_id sits at offset 4 and
  the key is read from the pointer as if dir_id sat at offset 0. Build a
  proper local key with set_key_dirid()/set_key_objectid() (the same
  idiom debugreiserfs/scan.c already uses). Verified -Waddress-of-packed-
  member (clang-only) is gone and output is unchanged.

- reiserfscore/hashes.c: four unreachable *(int *)0 = 0 stores (guarded by
  len >= 16/12/8/4 tests that cannot hold after the while (len >= 16)
  loop, len <= 15). Removed; clang's -Wnull-dereference goes quiet.
  Behavior verified: keyed_hash/yura_hash/r5_hash outputs for 16 inputs
  from 0 to 17 bytes are byte-identical before and after.

run_in_vm.sh: propagate CC into the guest, force a remount of /mnt/data
(the host rewrites the backing file under the guest), exclude generated
reiserfs_err.[ch] from the source tar. run_tests.sh: report which compiler
the battery actually used.
2026-11-12 08:51:29 -03:00

165 lines
5.1 KiB
YAML

name: build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- cc: gcc
extra: ""
- cc: gcc
extra: "--enable-warnings"
- cc: clang
extra: ""
# clang builds warning-free with -Wall -Wextra; keep this job as
# the regression gate for that guarantee.
- cc: clang
extra: "--enable-warnings"
- cc: gcc
extra: "--enable-io-failure-emulation"
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
autoconf automake libtool pkg-config \
libcom-err-dev uuid-dev \
build-essential clang
- name: Bootstrap
run: ./autogen.sh
- name: Configure
run: ./configure ${{ matrix.extra }}
- name: Build
run: make -j"$(nproc)"
- name: Fail on any compiler warning
if: matrix.extra == '--enable-warnings'
run: |
make -j"$(nproc)" clean >/dev/null 2>&1 || true
make -j"$(nproc)" > build.log 2>&1 || { cat build.log; exit 1; }
if grep -q "warning:" build.log; then
grep "warning:" build.log
echo "build is not -Wall -Wextra clean"
exit 1
fi
- name: Smoke test
run: |
set -e
dd if=/dev/zero of=smoke.img bs=1M count=64 status=none
./mkreiserfs/mkreiserfs -f -q smoke.img
./fsck/reiserfsck --check -f -q -y smoke.img
./debugreiserfs/debugreiserfs -S smoke.img
out-of-tree:
# Parallel builds from a separate build directory; historically this
# tripped the compile_et target race, so keep it covered.
runs-on: ubuntu-latest
env:
CC: gcc
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
autoconf automake libtool pkg-config \
libcom-err-dev uuid-dev build-essential
- name: Bootstrap
run: ./autogen.sh
- name: Configure (out-of-tree)
run: |
mkdir -p "$RUNNER_TEMP/rfs-build"
cd "$RUNNER_TEMP/rfs-build"
"$GITHUB_WORKSPACE/configure" --enable-warnings
- name: Build
run: make -C "$RUNNER_TEMP/rfs-build" -j"$(nproc)"
- name: Smoke test
run: |
set -e
cd "$RUNNER_TEMP/rfs-build"
dd if=/dev/zero of=smoke.img bs=1M count=64 status=none
./mkreiserfs/mkreiserfs -f -q smoke.img
./fsck/reiserfsck --check -f -q -y smoke.img
sanitizers:
# clang + AddressSanitizer + UndefinedBehaviorSanitizer over the real
# tool paths (format, check, resize, rollback). Leak detection is off:
# the one-shot tools deliberately keep process-lifetime allocations.
runs-on: ubuntu-latest
env:
CC: clang
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
autoconf automake libtool pkg-config \
libcom-err-dev uuid-dev build-essential clang
- name: Bootstrap
run: ./autogen.sh
- name: Configure with sanitizers
run: >
./configure --enable-warnings
CFLAGS="-g -O1 -fsanitize=address,undefined -fno-omit-frame-pointer"
- name: Build
run: make -j"$(nproc)"
- name: Exercise tools under sanitizers
env:
ASAN_OPTIONS: detect_leaks=0:halt_on_error=1
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
run: |
set -e
dd if=/dev/zero of=/tmp/s.img bs=1M count=64 status=none
./mkreiserfs/mkreiserfs -f -q -l SAN /tmp/s.img
./fsck/reiserfsck --check -f -q -y /tmp/s.img
./debugreiserfs/debugreiserfs -S /tmp/s.img
./tune/reiserfstune -l SAN2 -f /tmp/s.img
# resize: 64M -> 128M
dd if=/dev/zero of=/tmp/b.img bs=1M count=64 status=none
./mkreiserfs/mkreiserfs -f -q /tmp/b.img
truncate -s 128M /tmp/b.img
./resize_reiserfs/resize_reiserfs -s +64M -f /tmp/b.img
./fsck/reiserfsck --check -f -q -y /tmp/b.img
# rollback save + restore
cp /tmp/s.img /tmp/r.img
./fsck/reiserfsck --fix-fixable -y -q -R /tmp/rb.dat /tmp/r.img
./fsck/reiserfsck --rollback-fsck-changes -y -q -R /tmp/rb.dat /tmp/r.img
# rollback file with garbage magic must be rejected
head -c 100 /dev/urandom > /tmp/bad.dat
if ./fsck/reiserfsck --rollback-fsck-changes -y -q -R /tmp/bad.dat /tmp/r.img 2>&1 \
| grep -q "does not look like a rollback file"; then
echo "rollback garbage correctly rejected"
else
echo "rollback garbage was NOT rejected"
exit 1
fi