This is an automated email from the ASF dual-hosted git repository. leginee pushed a commit to branch bazel-migration in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 005053d4046a4f65c43f299ac7457fe6866af460 Author: Peter Kovacs <[email protected]> AuthorDate: Fri Aug 14 02:02:22 2026 +0200 docs: record the embedded database, and why a phantom registration is fatal The connectivity work in the previous commit, written down where the next session will look for it. The general rule worth keeping is not about databases: NEVER register a .component whose cc_binary does not exist. services.rdb had seven such entries, and the failure mode is not "the driver is missing" -- osl_loadModule fails, the UNO exception escapes the VCL message loop to desktop app.cxx:2241, and FatalError() calls _exit(). The office dies rather than reporting an error. A registration ahead of its build is worse than no registration. Also records the second face of the bzlmod patch bug: Bazel's patch is stricter than GNU patch and skipped a whole `diff -urbwB` patch SILENTLY, creating neither an error nor the new file the patch adds. The check has to be diffing the fetched repo against a reference tree, never "the build succeeded". CLAUDE.md gets the frontier entry (this is the first product feature standing on the Java runtime rather than another proof it loads), Migrated-packages.md the new outputs, and main/connectivity/readme.md the module detail: the four-artifact chain, the hsqldb.jar divergence and how to undo it, the three build landmines, and what each of the four still-unmigrated drivers would take. Carries three pre-existing lint defects the hooks surfaced once these files entered a commit, all unrelated to the content above: Migrated-packages.md was missing its Apache license header (added by the hook), its H1 had trailing punctuation and no blank line below, and its code fence was never closed, so the whole package list was an unterminated block; main/connectivity/readme.md's table delimiter row was unpadded while its data rows were not, tripping MD060. Co-Authored-By: Claude Opus 5 <[email protected]> --- CLAUDE.md | 78 +++++++++++++++++++++++++ Migrated-packages.md | 32 ++++++++++- main/connectivity/readme.md | 135 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 240 insertions(+), 5 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 643e930908..2a2c70363c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -678,6 +678,84 @@ library's own dir, already program/), and sunjavaplugin.ini (staged anyway for upstream parity — its noaccessibility key is the probe's only dependency on a usable display, so it would bite headless). See main/stoc/readme.md and main/jvmfwk/readme.md. +FIRST PRODUCT FEATURE ON THE JAVA RUNTIME — the EMBEDDED DATABASE, GREEN +2026-08-14 on BOTH arches (user-verified: x64 boots, "create a new Base +database" works, a table can be created). Everything above proved a Java UNO +component could be LOADED; this is the first thing a USER can do that needs it. +Six new SDBC driver DLLs in //main/connectivity (file, dbase, flat, calc, jdbc, +hsqldb) + hsqldb.jar + sdbc_hsqldb.jar. The chain is four artifacts, not one: +dbaccess hardcodes sdbc:embedded:hsqldb (dsntypes.cxx) -> hsqldb.dll -> which +does NOT do the SQL but asks the driver manager for "jdbc:hsqldb:db" -> +jdbc.dll -> the hsqldb.jar engine; sdbc_hsqldb.jar is what makes it a SINGLE +FILE (StorageAccess/StorageFileAccess implement org.hsqldb.lib.Storage/ +FileAccess over UNO embedded storage, their native methods being the 28 Java_* +exports of hsqldb.dll). Both jars MUST land in program/classes/ — not a +convention, HDriver.cxx hardcodes +vnd.sun.star.expand:$OOO_BASE_DIR/program/classes/<name>.jar. +ROOT CAUSE IT FIXED, and the general rule: services.rdb had SEVEN connectivity +drivers registered with NO DLL EVER BUILT (calc/dbase/flat + adabas/ado/mysql/ +odbc), and their DataAccess XCUs made all seven SELECTABLE in the Base wizard. +A registration with no library behind it is WORSE THAN NONE: the driver manager +resolves the service, osl_loadModule fails on a file that was never produced, +and the UNO exception escapes the VCL message loop to desktop app.cxx:2241, +whose catch calls FatalError() -> _exit(). So picking such a driver KILLED the +office instead of reporting an error — a hard process exit, no dismissible +dialog, losing unsaved work in every other window. NEVER register a .component +whose cc_binary does not exist; the four still unbuilt are now unregistered. +postprocess's "Java-only components ... omitted, Java build is deferred" comment +had been STALE since 2026-08-05 — that is what hid hsqldb/jdbc. +THREE LANDMINES, all recorded in main/connectivity/readme.md: + (a) stlport is needed by EVERY consumer of connectivity/dbtools.hxx, not just + the hash_map users: line 611 declares askForParameters() with a + ::std::bit_vector default argument, an SGI STL extension. + (b) dbase/DNoException.cxx must be EXCLUDED from the glob — the one file in + that dir absent from dmake's SLOFILES and #included by nothing, a stale + duplicate of bodies in DTable.cxx/dindexnode.cxx => ~25 LNK2005. + (c) AOO's hsqldb patches CANNOT be used verbatim as bzlmod `patches`. + i121754.patch was generated with `diff -urbwB` (ignore whitespace AND + blank lines); GNU patch tolerates it, Bazel's stricter implementation + SILENTLY SKIPPED THE WHOLE PATCH (applying only script.patch) and never + created the new file lib/StringComparator.java — no error, no warning. + Fix = one regenerated byte-exact patch (patch_strip 1); verified the + fetched tree is diff -r identical to a GNU-patch reference. This is a + SECOND face of the recorded bzlmod patch bug, and the check is always + "diff the fetched repo against a reference", never "the build succeeded". + Also: a source.json edit needs `bazel mod deps --lockfile_mode=refresh` + or the stale external repo is silently reused. +DELIBERATE DIVERGENCE — hsqldb.jar is the RELEASE JAR from the archive plus +AOO's eight BEHAVIOURALLY patched files recompiled over it (uno_jar merge, +patched classes FIRST since singlejar keeps the first duplicate), not a full +source build. Upstream's Ant build runs HSQLDB's own CodeSwitcher preprocessor +over the sources; a plain javac fails with 12 errors where the JDBC wrapper +classes do not implement methods java.sql grew after 2008 (getCharacterStream +(long,long), isWrapperFor, generatedKeyAlwaysReturned, getParentLogger, +getObject(String,Class<T>)), and javac 21 cannot target below --release 8, so a +faithful source build would need NEW source changes upstream does not have. +Every behaviour patch is kept (incl. script.patch's 2023 SCRIPT-replay fix); +only i121754's Java-7 BUILD-compat hunks are dropped, and those are moot when +the classes come from the release jar. Reversible: a CodeSwitcher rule (a small +Bazel action, like throwspec.py) would allow the full source build. +WATCH AT RUNTIME: sdbc_hsqldb's NativeLibraries.java calls +System.loadLibrary("hsqldb") and NOTHING in javavm/jvmfwk sets +java.library.path — it resolves today because the JVM is in-process in +soffice.exe and hsqldb.dll is already loaded from program/. Its other preloads +(msvcr71, uwinapi, dbtoolsmi) are STALE names absent from this build; those +failures are swallowed by design, so they are noise, not the bug. +STILL UNMIGRATED, with what each needs (none is blocked, all are just work): + • odbc — odbcbase.dll (9 srcs, OOO_DLLIMPLEMENTATION_ODBCBASE declspec) + + odbc.dll (3 srcs). Header dep ALREADY SOLVED: //main/unixODBC:odbc_headers + exists and works on Windows (_IODBCUNIX_H guard; dbaccess already uses it). + Cheapest of the four — do this next. + • mysql — 9 srcs, zero external libs, a pure delegator (YDriver.cxx routes + sdbc:mysql:odbc: to ODBC and sdbc:mysql:jdbc: to JDBC). The JDBC arm works + TODAY, so it is nearly free. Ships no client; user supplies Connector/J. + • ado — 32 srcs of COM/OLE-DB. adoint.h/adoctint.h/oledb.h/oaidl.h/ocidl.h + are ALL in the pinned SDK v7.0 this build already uses, so there is NO + external module to add — just the largest file count, lowest value. + • adabas — 22 srcs + odbcbase, and needs an installed Adabas D server+client. + Discontinued commercial product; nothing can exercise it. Recommend leaving + it unregistered permanently rather than migrating. +See main/connectivity/readme.md. NOTE: rules_java 8.11.0 IS now wired (MODULE.bazel) and the core Java UNO runtime is migrated & green — ridljar/jurt/jvmaccess/javaunohelper/jvmfwk/ bridges (incl. the java_uno JNI bridge: java_uno.dll + java_uno.jar, done diff --git a/Migrated-packages.md b/Migrated-packages.md index 0a4928d3c8..fbcbf38e8a 100644 --- a/Migrated-packages.md +++ b/Migrated-packages.md @@ -1,5 +1,26 @@ -# Migrated Packages. +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +# Migrated Packages + These packages have been migrated. + ``` sal ✅ — main/sal/readme.md salhelper ✅ @@ -75,7 +96,11 @@ framework ✅ (fwi.dll, fwe.dll, fwk.dll, fwl.dll, fwm.dll) — main/framew editeng ✅ (editeng.dll) — main/editeng/readme.md canvas ✅ (canvastools, canvasfactory, nullcanvas, simplecanvas, vclcanvas, directx9canvas, gdipluscanvas) — main/canvas/readme.md basic ✅ (oovbaapi, svtools, xmlscript, framework, salhelper) -connectivity ✅ (dbtools.dll, sdbc2.dll, dbpool2.dll) — main/connectivity/readme.md +connectivity ✅ (dbtools.dll, sdbc2.dll, dbpool2.dll + SDBC drivers file/dbase/flat/ + calc/jdbc/hsqldb.dll, hsqldb.jar, sdbc_hsqldb.jar) — + main/connectivity/readme.md. STILL UNMIGRATED: odbc+odbcbase, + ado, mysql, adabas — deliberately UNREGISTERED, not merely absent + (see readme: a registration with no DLL behind it kills the office). ── Layer 9 ────────────────────────────────────────────────────────────── sfx2 ✅ (basic, xmlscript, framework, shell, sax + libxml2 ext) — main/sfx2/readme.md cppcanvas ✅ (cppcanvas.dll) — main/cppcanvas/readme.md @@ -167,4 +192,5 @@ default_images ✅ images.zip staged to share/config/ via images_zip Starlark r make_images_zip.pl (Archive::Zip); vcl/res/ excluded (baked into .res); strip_prefix="main/default_images" → zip entries like "framework/res/backing.png" ooo_custom_images ✅ images_industrial.zip staged to share/config/; classic deferred - (classic_images.tar.gz needs tar→zip conversion) \ No newline at end of file + (classic_images.tar.gz needs tar→zip conversion) +``` diff --git a/main/connectivity/readme.md b/main/connectivity/readme.md index 776024a59f..7559c9390d 100644 --- a/main/connectivity/readme.md +++ b/main/connectivity/readme.md @@ -1,12 +1,125 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + # connectivity — Bazel Migration ## Targets | Target | Output | Description | -|--------|--------|-------------| +| ------ | ------ | ----------- | | `//main/connectivity:dbtools` | `dbtools.dll` | Core database tools library (SQL parser, schema classes, common utilities) | | `//main/connectivity:sdbc2` | `sdbc2.dll` | SDBC driver manager UNO component | | `//main/connectivity:dbpool2` | `dbpool2.dll` | Connection pool UNO component | +| `//main/connectivity:file` | `file.dll` | Shared file-based SDBC implementation — **not** a UNO component | +| `//main/connectivity:dbase` | `dbase.dll` | dBASE III/IV driver | +| `//main/connectivity:flat` | `flat.dll` | Delimited-text driver | +| `//main/connectivity:calc` | `calc.dll` | Spreadsheet-as-datasource driver | +| `//main/connectivity:jdbc` | `jdbc.dll` | Generic JDBC bridge driver | +| `//main/connectivity:hsqldb` | `hsqldb.dll` | Embedded HSQLDB driver (UNO component **and** JNI library) | +| `//main/connectivity:hsqldb_jar` | `hsqldb.jar` | HSQLDB 1.8.0 engine, AOO-patched | +| `//main/connectivity:sdbc_hsqldb_jar` | `sdbc_hsqldb.jar` | AOO's storage bridge letting the engine live inside the `.odb` | + +## The embedded-database path + +"Create a new Base database" is `sdbc:embedded:hsqldb`, hardcoded in +`dbaccess/source/core/misc/dsntypes.cxx`. It needs all four of the last rows +above at once: + +1. `hsqldb.dll` implements the driver, but delegates the actual SQL — `HDriver` + asks the driver manager for `jdbc:hsqldb:db`. +2. `jdbc.dll` serves that, driving the engine through JNI. +3. `hsqldb.jar` is the engine. +4. `sdbc_hsqldb.jar` is what makes the database a *single file*: + `StorageAccess` / `StorageFileAccess` implement `org.hsqldb.lib.Storage` / + `FileAccess` over UNO's embedded storage, and their native methods are the + 28 `Java_*` exports of `hsqldb.dll`. + +Both jars are staged to `program/classes/` — not by convention but because +`HDriver.cxx` builds the classpath as the literal string +`vnd.sun.star.expand:$OOO_BASE_DIR/program/classes/<name>.jar`. + +### hsqldb.jar is the release jar plus AOO's behaviour patches + +Upstream builds HSQLDB with Ant, and that build is not a plain `javac`: it runs +HSQLDB's own `org.hsqldb.util.CodeSwitcher` over the sources first, commenting +blocks in and out per JDK level. Compiling the 255 non-test sources directly +fails with 12 errors, all the same shape — the JDBC wrapper classes (`jdbcClob`, +`jdbcDatabaseMetaData`, `jdbcDataSource`, `jdbcParameterMetaData`, +`jdbcResultSet`, `jdbcDriver`) do not implement methods `java.sql` grew after +2008: `getCharacterStream(long,long)` (JDBC 4.0), `isWrapperFor`, +`generatedKeyAlwaysReturned`, `getParentLogger`, `getObject(String,Class<T>)` +(JDBC 4.1). AOO's `i121754.patch` exists to paper over exactly that for Java 7, +and `javac` 21 cannot target below `--release 8`, so a raw source build would +need *new* source changes upstream does not have. + +So `@hsqldb//:hsqldb_upstream` is the release jar from the archive (already +CodeSwitcher-processed), and `@hsqldb//:hsqldb_patches` recompiles only the +eight **behaviourally** patched files — `script.patch`'s fix to skip `SCRIPT` +while a script or log is replayed, plus `i121754`'s alignment to 1.8.0.11 +(`Expression`, `Library`, `Select`, `Table`, `TableWorks`, +`persist/HsqlDatabaseProperties`, `lib/StringComparator`, +`DatabaseCommandInterpreter`). None of those is a `java.sql` implementor, so +they all compile against the release jar. `uno_jar` merges them with the +patched classes FIRST, because singlejar keeps the first occurrence of a +duplicate entry. Net effect: every behaviour patch is kept; only the JDBC-compat +hunks are dropped, and those exist purely to make the source build on Java 7. + +**LANDMINE — the AOO patches cannot be used verbatim as bzlmod `patches`.** +`i121754.patch` was generated with `diff -urbwB` (ignore whitespace *and* blank +lines), which GNU `patch` tolerates and Bazel's stricter implementation silently +does not: it applied `script.patch` and skipped `i121754.patch` entirely, with no +error, and did not create the new file `lib/StringComparator.java`. The fix is a +single regenerated byte-exact patch (`ext_libraries/modules/hsqldb/1.8.0/patches/ +aoo-hsqldb.patch`, `patch_strip: 1`); the fetched tree is now byte-identical to a +GNU-`patch` reference. The originals stay at +`ext_libraries/modules/hsqldb/patches/` as the dmake inputs. Also note a +`source.json` change needs `bazel mod deps --lockfile_mode=refresh` — otherwise +the stale external repo is reused and the rebuild "fails" for the old reason. + +## Drivers deliberately NOT registered + +`adabas`, `ado`, `mysql` and `odbc` have `.component` files and DataAccess +`.xcu` files in this module, and **all four used to be registered in +services.rdb with no DLL behind them**. That is worse than not registering +them: the driver manager resolves the service, `osl_loadModule` fails on a file +that was never produced, and the resulting UNO exception escapes the VCL message +loop to `desktop/source/app/app.cxx:2241`, whose `catch` calls `FatalError()` → +`_exit()`. Picking such a driver in Base killed the office instead of reporting +an error. They are now unregistered until their `cc_binary` exists. What each +would take: + +- **odbc** — `odbcbase.dll` (9 sources, declspec exports via + `OOO_DLLIMPLEMENTATION_ODBCBASE`) + `odbc.dll` (3 sources). The header + dependency is already solved: `//main/unixODBC:odbc_headers` exists and works + on Windows (`_IODBCUNIX_H` guard; dbaccess already consumes it). Cheapest of + the four. +- **mysql** — 9 sources, no external libs. A pure delegator: `YDriver.cxx` + routes `sdbc:mysql:odbc:` to the ODBC driver and `sdbc:mysql:jdbc:` to the + JDBC one. Useless alone; nearly free once odbc exists, and the JDBC arm works + today. Ships no MySQL client — the user supplies Connector/J or a DSN. +- **ado** — 32 sources of COM/OLE-DB wrapper. `adoint.h`, `adoctint.h`, + `oledb.h`, `oaidl.h`, `ocidl.h` are all present in the pinned SDK v7.0 this + build already uses, so there is no external module to add — just the largest + file count and the least value on modern Windows. +- **adabas** — 22 sources plus `odbcbase`, and it needs an installed Adabas D + server and client. Discontinued commercial product; nothing can exercise it. + Recommend leaving it unregistered permanently. ## Source layout @@ -44,4 +157,22 @@ files as textual fragments (declared via `_parse_generated` cc_library). with `std::lower_bound`/`std::equal_range`; MSVC debug STL validates the range by calling `comp(T, T)` which these comparators don't provide — semantically correct C++ but the MSVC debug probe trips on it; applied per-binary for consistency across TUs -- Drivers (ado, odbc, dbase, calc, flat, hsqldb, jdbc, mysql, …) are not yet migrated +- stlport is required by every consumer of `connectivity/dbtools.hxx`, not just the + modules using `hash_map`: line 611 declares `askForParameters()` with a + `::std::bit_vector` default argument, an SGI STL extension only stlport provides +- `dbase/DNoException.cxx` must be EXCLUDED from the source glob. It is the one + file in that directory absent from dmake's `SLOFILES` and `#include`d by nothing: + a stale second copy of bodies that also live in `DTable.cxx` and `dindexnode.cxx`, + so compiling it gives ~25 `LNK2005` duplicate-symbol errors +- `SOLAR_JAVA` is load-bearing for `jdbc` and `hsqldb`, not a feature switch: + `jvmaccess/virtualmachine.hxx` includes the real `<jni.h>` only under it and + otherwise declares stubs, so without it every `JNIEnv->` call is C2027 +- `hsqldb.dll` carries 28 undecorated `Java_*` exports in its DEF alongside the two + `component_*` ones (JNICALL is `__stdcall` on Win32, so without the DEF they would + be `_Java_…@N` and the JVM could not find them) — same trick as `jurt`'s + `jpipe.def`. It does NOT need the RT_MANIFEST id 2 embedded manifest that + `jpipe`/`jpipx` need: those are loaded by a stock `java.exe` with no VC90 + activation context, whereas this JVM runs in-process inside `soffice.exe` +- `hsqldb.dll` takes no DLLPOSTFIX (version.mk sets `HSQLDB_TARGET=hsqldb` bare) + because the Java side hardcodes `System.loadLibrary("hsqldb")` +- Drivers still unmigrated: ado, odbc/odbcbase, mysql, adabas (see above)
