Skip to content

fix: rebuild the extension when the cassert flag changes - #28

Open
utkarash2991 wants to merge 1 commit into
supabase:masterfrom
utkarash2991:cassert-rebuild
Open

utkarash2991 wants to merge 1 commit into
supabase:masterfrom
utkarash2991:cassert-rebuild

Conversation

@utkarash2991

Copy link
Copy Markdown
Contributor

The build dir is shared by the cassert and plain builds. Running xpg psql after xpg --cassert test loaded the sanitizer-built extension into a plain server, which exits with "ASan runtime does not come first in initial library list" and leaves the server in recovery. The reverse order loses sanitizer coverage silently.

xpg now records the cassert flag in the build dir and, when a run uses the other flavor, prints what happened and rebuilds:

build-17 was built with cassert=on but this run has cassert=off
removing build-17 and rebuilding, use the same --cassert/--no-cassert on every run to avoid this

CI already deleted the build dir by hand before its cassert step, so that step now checks for the message in both directions instead.

Context: supabase/supautils#260 (review comment on test/startup.sh).

The build dir is shared by the cassert and plain builds, so running one
flavor after the other loaded an extension built for the other server
and crashed it with an obscure sanitizer error. Record the flag in the
build dir and rebuild with a message when it changes.
Comment thread nix/xpg.nix
rm -rf "$BUILD_DIR"
fi
mkdir -p "$BUILD_DIR"
echo "$_arg_cassert" > "$cassert_marker"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Q: Would it be simpler to have a different build dir for the cassert build?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like this idea. Would also be consistent with the way things currently work. Ultimately we should move to native Makefile behavior but until then I think this approach solves the problem.

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.

yeah it would be simpler to have a seperate build dir. Want me to go with that one? I dont have any strong reason to not to go with the seperate build dir approach.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes please, but as I've mentioned before I'm not sure if it's simpler. If the different build dir way is too complex we can prefer this one for now.

@imor

imor commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Since we have moved xpg into the supabase org you can point your remote to this repo instead of creating a fork @utkarash2991. Although it's your preference but many times during review I check our the branch locally to experiment with it, if you can switch to the official repo instead of the fork it makes my life a little bit easier as I can just fetch the branch from the same repo instead of maintaining a remote to your fork.

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.

4 participants