Release 6.0.0-crc64: enforce the LDB crc64 release line - #118
Merged
Merged
Conversation
Open the CRC64 release line of the engine (6.x, branch crc64), mirroring the
scanoss/ldb 5.0.0-crc64 release. Engine 6.x requires LDB 5.0.0-crc64 or later;
engine 5.x (branch main) stays on LDB 4.x. The two lines are tagged in the same
repository, so releases of this line carry a mandatory "-crc64" suffix, also
carried by SCANOSS_VERSION so that `scanoss -v` identifies the line.
LDB version validation
----------------------
The engine links libldb dynamically, so the LDB present at build time is not
necessarily the one loaded at run time. Both are now validated, and neither
check can drift from the other: the requirement is declared once, in
inc/ldb_compat.h, and read by both.
Build time (scripts/check_ldb_version.sh, run from the Makefile before any
object is compiled). The previous check was `ldb -v | head -c 3` compared with
`bc`, which:
- truncated to 3 characters, so "5.0.0-crc64" became "5.0" and a two digit
major ("10.0.0") became "10." and made bc fail with a syntax error;
- compared as a decimal rather than a semantic version, ranking 4.10 below 4.2;
- never inspected the suffix, so an MD5-only LDB passed;
- queried the binary on PATH, which need not be the build the linker resolves;
- depended on bc.
It now compares major/minor/patch numerically with shell arithmetic, requires
the crc64 suffix, and reports "too old" and "wrong release line" as distinct,
actionable failures. It validates two sources and fails on either: the ldb.h the
compiler resolves (located and expanded by the preprocessor, so it honours
CPPFLAGS rather than assuming /usr/include) and the libldb.so the linker
resolves (probed by building and running a program against -lldb). The header
alone is not sufficient: a stale library earlier in the loader search path
produces a binary that compiles cleanly and then fails at run time on the very
machine that built it. `ldb -v` is kept as a non fatal hint only.
Run time (src/ldb_compat.c, called from initialize_ldb_tables()). The previous
check used strcmp against "4.1.0", which is lexicographic: "5.10.0" sorts below
"5.9.0", so the engine would refuse to start against a newer LDB. That
"5.0.0-crc64" passed at all was an accident of string length. The version is now
parsed into major/minor/patch plus suffix and held to the same rule as the build.
Documentation and consistency
-----------------------------
- SCANOSS_VERSION 5.5.2-beta -> 6.0.0-crc64.
- README.md and docs/source/index.rst: require LDB >= 5.0.0-crc64 and link the
crc64 branch of the LDB README instead of master; document the release lines
and the compatibility rule, noting it comes from the on-disk table layout and
the library API, not from the hash mode, so it applies in MD5 too.
- CONTRIBUTING.md: document the branch and tag scheme, and that the LDB minimum
lives in a single header.
- package.sh: RPM forbids '-' in the Version field, so the suffix is translated
to '_' for the spec (6.0.0-crc64 -> 6.0.0_crc64). The deb keeps the hyphen.
Fixes found while verifying the documentation against the code
--------------------------------------------------------------
- --force-snippet was declared required_argument in long_options, but case 256
never reads optarg and the help text shows no argument, so
`scanoss --force-snippet TARGET` silently consumed TARGET as the option's
argument. Corrected to no_argument.
- README documented --min-match-hits and --min-match-lines, which do not exist
and are rejected by the parser. The real names are --min-snippet-hits and
--min-snippet-lines.
- README also described --force-snippet as "same as -b", omitted
--max-file-content-size, -P/--purl, -C/--url-hash, -p/--project and
-S/--snippet-scan, and pointed the install snippet at an archive of a
nonexistent master branch.
CI
--
Both workflows cloned LDB from master (the 4.x MD5-only line), which the new
check now rejects; they build from the crc64 branch instead. release.yml selected
"the newest tag", which may belong to either line, and now picks the latest
v*-crc64 tag specifically. build.yml also triggers on pull requests targeting
crc64. The actions/checkout@v3 and ::set-output deprecations are left untouched
on purpose: they are warnings, and fixing them on this branch alone would
introduce drift from main.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Opens the CRC64 release line of the engine (6.x, branch
crc64), mirroring the scanoss/ldb 5.0.0-crc64 release (scanoss/ldb#59).mainv5.5.1mainbranch of scanoss/ldb)crc64v6.0.0-crc64crc64branch of scanoss/ldb)Both lines are tagged in the same repository, so releases of this line carry a mandatory
-crc64suffix. It is also carried bySCANOSS_VERSION, soscanoss -videntifies the line a binary comes from.LDB version validation
The engine links libldb dynamically, so the LDB present at build time is not necessarily the one loaded at run time. Both are now validated, and neither check can drift from the other: the requirement is declared once, in
inc/ldb_compat.h, and read by both.Build time —
scripts/check_ldb_version.sh, run from the Makefile before any object is compiledThe previous check was
ldb -v | head -c 3compared withbc, which:5.0.0-crc64became5.0, and a two-digit major (10.0.0) became10.and madebcfail with a syntax error;bc.It now compares major/minor/patch numerically with shell arithmetic, requires the
crc64suffix, and reports "too old" and "wrong release line" as distinct, actionable failures.It validates two sources and fails on either:
ldb.hthe compiler resolves — located and expanded by the preprocessor, so it honoursCPPFLAGSrather than assuming/usr/include;libldb.sothe linker resolves — probed by building and running a program against-lldb.The header alone is not sufficient. On the development machine this was written on, a stale
/usr/local/lib/libldb.so(4.2.2-beta) shadows the correct/usr/lib/libldb.so(5.0.0-crc64) because/usr/local/libsorts first inld.so.conf. A header-only check passes and the resulting binary then fails at run time on the very machine that built it.ldb -vis kept as a non-fatal hint only.Run time —
src/ldb_compat.c, called frominitialize_ldb_tables()The previous check used
strcmpagainst"4.1.0", which is lexicographic:"5.10.0"sorts below"5.9.0", so the engine would refuse to start against a newer LDB. That5.0.0-crc64passed at all was an accident of string length. The version is now parsed into major/minor/patch plus suffix and held to the same rule as the build.Fixes found while verifying the documentation against the code
--force-snippetwas declaredrequired_argumentinlong_options, butcase 256never readsoptargand the help text shows no argument. Soscanoss --force-snippet TARGETsilently consumed TARGET as the option's argument. Corrected tono_argument.--min-match-hitsand--min-match-lines, which do not exist — the parser rejects them with "Unsupported option". The real names are--min-snippet-hitsand--min-snippet-lines.--force-snippetas "same as-b", omitted--max-file-content-size,-P/--purl,-C/--url-hash,-p/--projectand-S/--snippet-scan, and pointed the install snippet at an archive of a nonexistentmasterbranch.Documentation and packaging
SCANOSS_VERSION5.5.2-beta → 6.0.0-crc64.README.mdanddocs/source/index.rstrequire LDB >= 5.0.0-crc64 and link thecrc64branch of the LDB README instead ofmaster. Both document the release lines and note that the constraint comes from the on-disk table layout and the library API, not the hash mode, so it applies in MD5 too.CONTRIBUTING.mddocuments the branch and tag scheme, and that the LDB minimum lives in a single header.package.sh: RPM forbids-in theVersionfield, so the suffix is translated to_for the spec (6.0.0-crc64→6.0.0_crc64). The deb keeps the hyphen.CI
Both workflows cloned LDB from
master— the 4.x MD5-only line, which the new check now rejects. This was a latent hard failure. They build from thecrc64branch instead.release.ymlselected "the newest tag", which may belong to either line, and now picks the latestv*-crc64tag specifically.build.ymlalso triggers on pull requests targetingcrc64.The
actions/checkout@v3and::set-outputdeprecations are left untouched on purpose: they are warnings, and fixing them on this branch alone would introduce drift frommain. They should be fixed on both branches together, in a separate change.Verification
Built against a real LDB 5.0.0-crc64. 12/12 cases pass, using synthetic
ldb.hfiles and actually rebuiltlibldb.sovariants:strcmprejected thishead -c 3+bcsyntax-erroredbcsaid 4.10 < 4.2makeaborts with 0 objects built. Clean rebuild produces no new warnings.scanoss -v,-hand the JSONserver.versionfield all report6.0.0-crc64, and real scans run correctly. RPM/deb version translation verified.Not verified: the engine has no test suite (no
run_test.sh, notest/), so unlike ldb there was nothing to run — functional checking was limited to real scans andscanoss -t.rpmbuildwas not available, so the spec version translation was verified by replaying thepackage.shlogic rather than building a package.No tag has been created; that is a separate, explicit decision.
🤖 Generated with Claude Code