From 8266cf95ce64cbf6c40b36ca493dc76ff3458b70 Mon Sep 17 00:00:00 2001 From: Tom Gabsow Date: Thu, 4 Jun 2026 06:28:05 +0300 Subject: [PATCH] getredis: apply obsolete ccflags_lto Makefile patch only if it fully 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) --- bin/getredis | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/getredis b/bin/getredis index a6126a4..c5db2ed 100755 --- a/bin/getredis +++ b/bin/getredis @@ -213,7 +213,8 @@ index b0727db2c..ae7f3f80a 100644 ''' patch_file = os.path.join(self.base_dir, 'ccflags_lto.patch') paella.fwrite(patch_file, str.lstrip(textwrap.dedent(patch[1:]))) - self.run(f"patch -p1 -i %s" % patch_file, at=self.build_dir) + if self.run(f"patch -p1 --dry-run -i %s" % patch_file, at=self.build_dir, _try=True) == 0: + self.run(f"patch -p1 -i %s" % patch_file, at=self.build_dir) def install_openssl(self, version, build_args, prefix="ssl"): file = os.path.join(self.base_dir, 'openssl.tgz')