fix(connections): Normalize a database path only as far as it resolves - #2623
Open
krlmlr wants to merge 3 commits into
Open
fix(connections): Normalize a database path only as far as it resolves#2623krlmlr wants to merge 3 commits into
krlmlr wants to merge 3 commits into
Conversation
#455) `path_normalize()` asked `normalizePath(mustWork = TRUE)` to resolve the placeholder it had just created. Resolving a path needs read permission on every directory above it, which a network drive routinely withholds, so `duckdb()` refused paths it could create a database at. Creating the placeholder is now the only step that has to succeed, and it reports the path it could not create when it fails. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WfJ6BGAq8KoUiUitMLx9Cn
This was referenced Aug 9, 2026
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.
Closes #455.
path_normalize()created an empty placeholder for a database file that does not exist yet, then askednormalizePath(out, mustWork = TRUE)to resolve it. Resolving a path needs read permission on every directory above it, which a network drive routinely withholds, soduckdb()refused paths it had just proved it could create a file at.Creating the placeholder is now the only step that has to succeed. Neither
normalizePath()call asks for more than a best effort, and a path that resolves no further is used as it stands — less canonical, not wrong.The failure that does matter now surfaces on its own terms: a
dbdirin a directory that cannot be written to used to reach the user ascannot open the connectionfromwriteLines(), and now saysCannot create database fileand names the path that was passed.Tested in
tests/testthat/test-path_normalize.R. The network-drive failure has no portable equivalent — on Unix,realpath()needs only search permission on the parents — so the regression test injects it, making everymustWork = TRUEcall originating in this package fail while leaving all other callers alone. All five tests pass on this branch; three of them fail onmain.Documented in
handbook/usage/connections/README.md, which owns this topic, and in the?duckdbsection it points at. The handbook page listed #455 as still to drain, so that line is now shorter.Generated by Claude Code