Skip to content

fix(session): create honours an absolute path whose parent exists - #151

Closed
russimicro wants to merge 1 commit into
FiveTechSoft:mainfrom
russimicro:fix/create-honours-absolute-path
Closed

fix(session): create honours an absolute path whose parent exists#151
russimicro wants to merge 1 commit into
FiveTechSoft:mainfrom
russimicro:fix/create-honours-absolute-path

Conversation

@russimicro

Copy link
Copy Markdown
Collaborator

Follow-up to #142, from the same deployment.

Problem

#142 honoured an absolute create path when it sits under data_dir_. The
other half of the same report is an application that stages work tables
somewhere else and reads them back by the same absolute name — ours builds
scratch copies under the TEMP drive.

Those paths still fold:

} else if (path_is_inside(data_dir_, rel)) {
    return platform::resolve_case_insensitive(rel.string());
}
rel = rel.relative_path();          // <- everything else lands here

and the fold produces data_dir_ / <the whole client path>, whose intermediate
directories nobody creates. The create fails, and the caller cannot find its
table under either name.

Change

Also honour an absolute path when its parent directory already exists. That
is what the real ACE engine does for a free-table create: it writes exactly the
file it was given.

Deliberately unchanged:

  • a path whose parent does not exist still folds — that is the case the
    guard was written for, a client passing a path from its own working directory
    that means nothing on the server;
  • a bare drive-root name (C:\STRAY.DBF) still folds — the root always exists,
    but writing a table there is never a deliberate location, it is the signature
    of a client that built the name from its own root. abi_create_table_test
    pins that and still passes.

Verification

tests/unit/abi_create_outside_datadir_test.cpp — creates into an existing
directory outside data_dir_, checks the file lands there and not under
data_dir_, and reopens it by the same absolute name. Second subcase checks a
non-existent parent still does not land at the caller's path.

Full suite on this branch (MSVC x64 Release): 1228/1235 — the 7 failures are
pre-existing on main and unrelated (6 × abi_pritpal_lock_test remote
connect, 1 × abi_server_fs_test teardown that threw on remove_all because
the temp directory was held by another process on this machine).

FiveTechSoft#142 honoured an absolute create path when it sits under data_dir_. The
other half is an application staging work tables elsewhere and reading
them back by the same absolute name -- the ERP that reported FiveTechSoft#142 builds
scratch copies under the TEMP drive. Those still folded, producing a path
whose intermediate directories nobody creates, so the create failed and
the caller could never find its table.

Honour an absolute path whose parent directory already exists, which is
what the real ACE engine does for a free-table create.

Unchanged: a path whose parent does not exist still folds -- that is the
case the guard was written for, a client passing a path from its own
working directory -- and so does a bare drive-root name (C:\STRAY.DBF),
since the root always exists but is never a deliberate destination.
abi_create_table_test pins that case and still passes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

FiveTechSoft added a commit that referenced this pull request Jul 30, 2026
Cherry-picked and conflict-resolved against main (post CI fix 54e977c):

- #150 fix(sql): ORDER BY cursor keeps source column types
- #148 fix(adi): tag ordinals follow creation order
- #152 fix(adt): non-.adt extension (.DAT) works end to end
- #151 fix(session): create honours absolute path with existing parent
  (+ #include <vector> so the new unit test builds under clang)
- #154 fix(engine): partial SEEK keeps Found() with SET DELETED ON
- #155 fix(engine): ordScope bound shorter than key is a prefix
- #153 perf(engine): live key count without per-row goto + recno order

Also includes the CMakeLists resolution that keeps every new regression
case in the unit-test target.
@FiveTechSoft

Copy link
Copy Markdown
Owner

Integrated into main as part of the PR stack merge (9e7ac41). Cherry-picked onto post-CI-fix main, conflict-resolved (CHANGELOG / CMakeLists), and verified locally. Thank you @russimicro.

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