bc-gh: fix broken build - #15930
Open
xingyaner wants to merge 1 commit into
Open
Conversation
|
xingyaner is a new contributor to projects/bc-gh. The PR must be approved by known contributors before it can be merged. The past contributors are: hunsche, gavinhoward |
DavidKorczynski
requested changes
Jul 31, 2026
DavidKorczynski
left a comment
Collaborator
There was a problem hiding this comment.
I think the project is set to disabled? could you please coordinate with the maintainers in terms of getting the project running please
Contributor
Author
|
Alright, I will coordinate with the project maintainers to get bc-gh running again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original build.sh failed when executing ./configure -Z. In bc version 7.2.0, configure.sh adopts the getopts string abBcdDeEfgGhHik:lmMNO:p:PrS:s:T- and no longer supports the -Z flag, resulting in an invalid option error. Previously, the -Z flag was used to enable the OSS-Fuzz build mode, while the latest version has deprecated this flag and controls the OSS-Fuzz feature exclusively via the compile-time macro BC_ENABLE_OSSFUZZ.
After removing the invalid -Z flag and adopting ./configure.sh -H -N, a latent upstream bug was exposed. The test_target variable in configure.sh contains a literal newline that spans multiple lines, breaking the sed-based substring_replace() function. Since the script uses ! as the sed delimiter, the unexpected newline in the replacement content causes an unterminated sed substitution command and leads to build failures.
This fix first patches the malformed multi-line variable before configuration execution, and invokes ./configure.sh -H -N with valid flags. The project is then fully built via make. After the default compilation, five core source files including vm.c, data.c, lex.c, bc_lex.c and dc_lex.c are recompiled with the macros -DBC_ENABLE_OSSFUZZ=1 and -DNDEBUG.
These macros enable the OSS-Fuzz-specific data loading logic inside bc_vm_exec(), and eliminate invalid references to bc_vm_readLine under the BC_MODE_STDIN branch, resolving compilation and runtime compatibility issues when OSS-Fuzz mode is enabled. The regenerated fuzz object files replace the original ones during the linking phase, and are finally linked with the two fuzzer entry points src/bc_fuzzer.c and src/dc_fuzzer.c.
Considering that OSS-Fuzz clones the upstream repository from scratch in every build, persistent local modifications are not available. Therefore, a dynamic sed patch is added to fix the configure.sh syntax issue during each build, ensuring a stable and complete compilation pipeline.