Skip to content

getredis: apply obsolete ccflags_lto Makefile patch best-effort (non-fatal)#151

Open
gabsow wants to merge 1 commit into
masterfrom
tom.gabsow/fix-obsolete-ccflags-lto-patch
Open

getredis: apply obsolete ccflags_lto Makefile patch best-effort (non-fatal)#151
gabsow wants to merge 1 commit into
masterfrom
tom.gabsow/fix-obsolete-ccflags-lto-patch

Conversation

@gabsow

@gabsow gabsow commented Jun 4, 2026

Copy link
Copy Markdown

Problem

getredis patches redis's src/Makefile with ccflags_lto.patch (a clang-aware LTO ccflags tweak). That change has since been upstreamed into redis and the Makefile was refactored (LTO flags moved onto OPTIMIZATION, and the CLANG := $(findstring clang,...) detection added upstream). The patch's context no longer exists on current redis, so:

patching file src/Makefile
Hunk #1 FAILED at 15.
Hunk #2 FAILED at 28.
2 out of 2 hunks FAILED -- saving rejects to file src/Makefile.rej
command failed: patch -p1 -i .../ccflags_lto.patch

Because the call was fatal, this aborted the entire getredis redis build → no redis-server → every downstream test failed with Connection refused.

Fix

Apply the patch with _try=True so a non-applying (now redundant) LTO tweak doesn't abort the redis build. Modern redis already selects the correct LTO flags for clang/gcc, so skipping it is harmless. One-line change + explanatory comment.

How it surfaced

RedisBloom release-branch CI (build/linux-sanitizer/linux-valgrind jobs) install redis via deps/readies/bin/getredis -v <N>; all failed at the ccflags_lto.patch step. (Module master branches that install redis via a plain make are unaffected.)


Note

Low Risk
Build-script-only change; skips a redundant Makefile patch when context is missing, with no runtime or security impact.

Overview
getredis no longer treats a failed ccflags_lto.patch apply as fatal when building Redis from source.

ccflags_lto_patch() now runs patch -p1 --dry-run first (via _try=True). The real patch runs only if the dry-run succeeds; if hunks no longer match (e.g. LTO/clang logic already upstream), the step is skipped and the Redis build continues.

This unblocks CI that installs Redis through getredis on current Redis trees where the patch is redundant.

Reviewed by Cursor Bugbot for commit 8266cf9. Bugbot is set up for automated code reviews on this repo. Configure here.

…applies

redis upstream incorporated the clang-aware LTO ccflags change and refactored
src/Makefile, so ccflags_lto.patch no longer applies cleanly on current redis.
Applying it unconditionally either aborted the whole redis build (fatal) or,
worse, applied partially (one hunk) and corrupted the Makefile, breaking the
build. Gate it behind a --dry-run: apply only if the whole patch still applies,
otherwise skip it (modern redis already selects the correct LTO flags, so the
tweak is redundant and a no-op skip is safe). Never leave the Makefile
half-patched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gabsow gabsow force-pushed the tom.gabsow/fix-obsolete-ccflags-lto-patch branch from 9ed0455 to 8266cf9 Compare June 4, 2026 05:53
gabsow added a commit to RedisBloom/RedisBloom that referenced this pull request Jun 4, 2026
…er/valgrind)

Bumps deps/readies to the getredis fix (apply the obsolete ccflags_lto
Makefile patch only if it fully applies; never partially) to verify it
unblocks the redis build and the linux-sanitizer / linux-valgrind jobs.

readies PR: RedisLabsModules/readies#151

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

gabsow added a commit to RedisBloom/RedisBloom that referenced this pull request Jun 4, 2026
…r/valgrind redis

Two changes to green the linux-sanitizer / linux-valgrind jobs on this branch:
1. deps/readies bumped to the getredis fix (apply obsolete ccflags_lto patch
   only if it fully applies; never partially).
2. tests/flow/tests.sh: use the sanitizer/valgrind redis-server that
   .install/install_redis.sh already builds in the CI image, instead of
   building an older redis (6.2) from source via getredis (mirrors master,
   which dropped the getredis-asan/vg build).

readies PR: RedisLabsModules/readies#151

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant