Skip to content

MOD-16514 - fix the bootstrap and build - #1028

Merged
TalBarYakar merged 17 commits into
masterfrom
tal.ba/fix/bootstrap
Jul 2, 2026
Merged

TalBarYakar merged 17 commits into
masterfrom
tal.ba/fix/bootstrap

Conversation

@TalBarYakar

@TalBarYakar TalBarYakar commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Changes affect multi-OS bootstrap scripts and compiler/python alternatives used by all CI builds; mistakes could break builds on specific distros but don’t touch runtime Redis module logic.

Overview
Hardens CI/bootstrap across distros so builds get a consistent compiler, Python, and AWS CLI without fighting shared containers or apt’s clang defaults.

Shared AWS CLI v2 is added via install_aws_cli() (arch-aware, no-op if aws exists) and replaces duplicated installers on Rocky/Mariner/Amazon Linux and pip-based install on Azure Linux 3.

Toolchain pinning: debian_default_install forces cc/gcc/g++ to the newest system GCC so clang doesn’t win after clang packages install. EL8/EL9 (and Amazon Linux 2 devtoolset) symlink gcc-toolset binaries into /usr/local/bin; EL8 also installs python3.11-pip and pins python3 to 3.11. Ubuntu bionic gets noninteractive apt, manual toolchain PPA setup, only upgrades to gcc-10 when the active compiler is older than 10, and builds cmake 3.28 only when needed; focal uses the same conditional gcc-10 logic.

Flow tests: RLTest is bumped to 0.7.27 with numpy<2; a cuckoo overflow test tolerates ResponseError on a huge CF.INSERT.

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

@TalBarYakar TalBarYakar changed the title Tal.ba/fix/bootstrap MOD-16514 - fix the bootstrap and build Jul 1, 2026
@TalBarYakar
TalBarYakar marked this pull request as ready for review July 1, 2026 08:44
Comment thread .install/lib/pm.sh Resolved
@TalBarYakar
TalBarYakar requested review from AvivDavid23 and gabsow July 1, 2026 12:16
@TalBarYakar TalBarYakar self-assigned this Jul 1, 2026
Comment thread .install/os/focal.sh Resolved

@gabsow gabsow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the bootstrap/build changes — two robustness notes inline, both non-blocking. Heads-up on cross-module consistency: this PR's bionic.sh diverges from the sibling RedisJSON #1612, which runs apt-get update first and hard-installs the prerequisites (gnupg wget curl ca-certificates) rather than soft-failing them. Worth keeping the three modules' bootstrap in sync. (cursor's GCC-alternative points look valid too.)

Comment thread .install/os/bionic.sh Outdated
echo 'debconf debconf/frontend select Noninteractive' | $SUDO debconf-set-selections 2>/dev/null || true
echo 'tzdata tzdata/Areas select Etc' | $SUDO debconf-set-selections 2>/dev/null || true
echo 'tzdata tzdata/Zones/Etc select UTC' | $SUDO debconf-set-selections 2>/dev/null || true
$SUDO apt-get install -y --no-install-recommends gnupg wget 2>/dev/null || true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gnupg/wget are installed here before any apt-get update has run. apt_install's deferred apt-get update (guarded by _pm_apt_updated) is first triggered later at apt_install software-properties-common ..., so on a clean bionic image — ubuntu:18.04 ships with empty /var/lib/apt/lists and no preinstalled gnupg/wget — this apt-get install finds nothing to resolve and, because it ends in 2>/dev/null || true, the failure is swallowed. With gpg then absent, the two wget ... | gpg --dearmor ... || true key-import lines below also silently no-op, so the toolchain-r keyrings are never written. The PPA .list gets added unsigned, and the later apt_install gcc-10 g++-10 (no || true) fails because apt won't install from the unsigned repo. Run apt-get update first and hard-install the prerequisites:

$SUDO apt-get update -qq
$SUDO apt-get install -y --no-install-recommends gnupg wget ca-certificates

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread .install/lib/packages.sh Outdated
arch=$(uname -m)
local url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
[ "$arch" = "aarch64" ] && url="https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"
curl "$url" -o /tmp/awscliv2.zip

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curl "$url" -o /tmp/awscliv2.zip lacks -f: on an HTTP 4xx/5xx, curl exits 0 and writes the error body into the file. The next line's unzip then fails with a confusing "cannot find zipfile directory" and, under the script's set -euo pipefail, aborts the whole bootstrap pointing at unzip instead of the real download failure. Use curl -fSL --retry 3 "$url" -o /tmp/awscliv2.zip so a bad download fails loudly at the curl step (--retry also rides out transient network blips).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gabsow

gabsow commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Cross-module consistency (non-blocking) — this is one of three sibling PRs applying the same CI bootstrap/build fix:

Their .install/ logic has drifted in a few places — worth reconciling so the three modules keep an identical bootstrap:

  1. bionic prerequisite install (the one that matters): RedisJSON runs apt-get update -qq and then hard-installs gnupg wget curl ca-certificates; RedisBloom/RedisTimeSeries skip the update and soft-fail (apt-get install ... gnupg wget 2>/dev/null || true). On a clean image that can silently leave the ubuntu-toolchain-r PPA key unimported. Recommend standardizing on the RedisJSON variant.
  2. debian_default_install gcc/cc/g++ pinning (lib/pm.sh): present in RedisBloom/RedisTimeSeries, absent in RedisJSON. Plausibly intentional (JSON is Rust; the others are C with -fblocks defer macros, so pinning gcc over clang matters there) — but worth a deliberate call rather than drift.
  3. el8 python3.11-pip + update-alternatives --set python3: present in RedisBloom/RedisTimeSeries, absent in RedisJSON.

None of this blocks — flagging so the three don't silently diverge.

Comment thread .install/lib/packages.sh Resolved
Comment thread .install/os/amazonlinux2.sh Resolved
@TalBarYakar
TalBarYakar requested a review from gabsow July 2, 2026 07:02
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4b68c79. Configure here.

Comment thread tests/flow/test_cuckoo.py
try:
self.cmd('CF.INSERT', 'cf', 'ITEMS', *["1 "]*140000)
except ResponseError:
pass

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overflow test always passes

Low Severity

test_counter_overflow_with_large_number_of_items now wraps the large CF.INSERT in a bare try/except ResponseError that ignores every error. The test no longer checks successful insert or overflow behavior, so regressions in that path can pass CI without failing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b68c79. Configure here.

@gabsow gabsow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed after the fix commits — all blockers resolved:

  • HIGH (GCC-10 never selected on Ubuntu): bionic/focal now --set gcc/g++/cc to 10, so debian_default_install's priority-100 pin no longer wins and the toolchain is consistently on gcc-10. ✅
  • gnupg/wget before apt-get update: now runs apt-get update first and hard-installs the prerequisites (no more silent key-import no-op). ✅
  • curl -f on AWS CLI download, AL2 dangling devtoolset symlinks: resolved. ✅

One non-blocking nit remains (not gating approval): tests/flow/test_cuckoo.py:35 still wraps the large CF.INSERT in try/except ResponseError: pass, so the overflow test passes regardless of outcome — worth tightening in a follow-up so it can't mask a regression.

LGTM — approving.

@TalBarYakar
TalBarYakar merged commit da293b3 into master Jul 2, 2026
59 checks passed
@TalBarYakar
TalBarYakar deleted the tal.ba/fix/bootstrap branch July 2, 2026 13:20
TalBarYakar added a commit that referenced this pull request Jul 5, 2026
* MOD-16514 - fix the bootstrap and build (#1028)

* install aws if and only if it is not installed yet

* add another build fixes

* fix build for amazonlinux2

* fix(al2): add cc symlink to devtoolset-11 to fix LTO version mismatch

* alma8 +rhel8+rhel9+bionic +focal passes

* fix for bionic

* fix

* bump rltest

* fix bionic bootstrap

* fix azurelinux3

* bionic fix

* fix for bullesye

* fix focal ci

* fix the test due to bump rltest version

* fix for bionic and focal

* fix

* fix remarks

* try another methood (#1030)

* bump version 8.9.81
TalBarYakar added a commit that referenced this pull request Jul 27, 2026
* MOD-16514 - fix the bootstrap and build (#1028)

* install aws if and only if it is not installed yet

* add another build fixes

* fix build for amazonlinux2

* fix(al2): add cc symlink to devtoolset-11 to fix LTO version mismatch

* alma8 +rhel8+rhel9+bionic +focal passes

* fix for bionic

* fix

* bump rltest

* fix bionic bootstrap

* fix azurelinux3

* bionic fix

* fix for bullesye

* fix focal ci

* fix the test due to bump rltest version

* fix for bionic and focal

* fix

* fix remarks

* try another methood (#1030)

* bump version 8.9.81
TalBarYakar added a commit that referenced this pull request Jul 27, 2026
* install aws if and only if it is not installed yet

* add another build fixes

* fix build for amazonlinux2

* fix(al2): add cc symlink to devtoolset-11 to fix LTO version mismatch

* alma8 +rhel8+rhel9+bionic +focal passes

* fix for bionic

* fix

* bump rltest

* fix bionic bootstrap

* fix azurelinux3

* bionic fix

* fix for bullesye

* fix focal ci

* fix the test due to bump rltest version

* fix for bionic and focal

* fix

* fix remarks
TalBarYakar added a commit that referenced this pull request Jul 27, 2026
* MOD-16514 - fix the bootstrap and build (#1028)

* install aws if and only if it is not installed yet

* add another build fixes

* fix build for amazonlinux2

* fix(al2): add cc symlink to devtoolset-11 to fix LTO version mismatch

* alma8 +rhel8+rhel9+bionic +focal passes

* fix for bionic

* fix

* bump rltest

* fix bionic bootstrap

* fix azurelinux3

* bionic fix

* fix for bullesye

* fix focal ci

* fix the test due to bump rltest version

* fix for bionic and focal

* fix

* fix remarks

* try another methood (#1030)

* MOD-16871: replicate in `cfInsertCommon` after `cfCreate` in case of errors (#1034)

* MOD-16871: relicate in  after

* .

* MOD-16306 - pull docker images from registry (#1036)

* MOD-16306 - pull docker images from registry

* cherry pick changes to bloom

* MOD-13409 Harden RDB loading (#1038)

* MOD-13409 Validate Bloom RDB bitset size on load (#126)

* MOD-13409 Validate Bloom RDB bitset size on load

Reject crafted module payloads where the loaded bloom bitset buffer length does not match the declared bits/n2, and add a flow regression test covering RESTORE with a corrupted DUMP payload.

* MOD-13409 clang-format rebloom.c

Run clang-format on rebloom.c to satisfy make lint formatting checks.

* MOD-13409 Validate Bloom RDB bitset length on load

Reject crafted module payloads where persisted bits do not match the loaded bitset buffer length, preventing OOB access after RESTORE.

* Mod 13409 rdb hardening (#127)

* MOD-13409 clang-format rebloom.c

Run clang-format on rebloom.c to satisfy make lint formatting checks.

* MOD-13409 Harden CF RDB load buffer validation

Replace assert-only checks in CFRdbLoad with explicit validation of loaded sizes and ranges, and add a flow test that corrupts a CF DUMP payload to ensure RESTORE is rejected.

* MOD-13409 Harden remaining RDB loaders (TDigest)

TDigest RDB loading trusted attacker-controlled cap, which could desync the allocated centroid arrays from the loaded metadata and enable OOB access after RESTORE.

Reject payloads where loaded cap differs from the allocated cap derived from compression, validate node counters, and add a flow regression that corrupts a TDigest DUMP payload and asserts RESTORE is rejected.

With the earlier BF/CF fixes, this covers all remaining module data structures that load raw buffers from RDB/RESTORE (CMS/TopK already validate buffer sizes).

* Revert "MOD-13409 clang-format rebloom.c"

This reverts commit 456e53503f51b68c4d7a9df988e50a36adf2e61a.

* MOD-13409 Add regression for published P88W exploit

* MOD-13409 Share RDB corruption test helpers

* Fix TDigest RDB load node count overflow check

Avoid signed overflow when validating merged and unmerged node counts by widening the addition.

* MOD-16952 - enhance bootstrap (add list and dry-run arg) (#1037)

* add bootstrap dry-run and chrck-deps

* remove dry-run

* write list to afile

* add optional deps

* add another optional deps

* add another optional deps

* add versioning managment

* rename command to list

* renme to list

* add dry run

* fix colors

* fix bloom missing deps only for dry run

* fix missing

* remove min cmake version

* fix remarks

* fix remarks

* fix remarks

* fix remarks

* fix remarks

* add _sh so we can have the full bootstrap output

* always return to the workspace dir

* make single copy paste install all

* fix alma8

* fix bad dry-run print

* gaurd tool-set version 11

* fix curl minimal

* remove centos-release-scl for amazonlinux2

* fix macos env

* fix(bootstrap): make sudo a no-op on root containers without a sudo binary

The install scripts run privileged steps via literal `sudo` inside `_sh`
command strings (e.g. `sudo ln -sf ...`, `| sudo tee`, `&& sudo make install`).
On a slim Docker image that runs install_script.sh directly as root with no
`sudo` package installed (e.g. RedisTimeSeries' amazonlinux2 CI), those steps
fail with `sudo: command not found` (exit 127), aborting the whole bootstrap.

Add a root-only pass-through in pm.sh/deps_lib.sh: when running as root and no
real `sudo` binary exists, define `sudo()` to run its arguments directly. When
not root, a missing sudo stays a genuine error and is left unmasked.

* bump version to 8.10.0

---------

Co-authored-by: Aviv David <[email protected]>
Co-authored-by: Tom Gabsow <[email protected]>
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.

2 participants