Skip to content

fix(connections): Normalize a database path only as far as it resolves - #2623

Open
krlmlr wants to merge 3 commits into
mainfrom
claude/implement-455-xo327q
Open

fix(connections): Normalize a database path only as far as it resolves#2623
krlmlr wants to merge 3 commits into
mainfrom
claude/implement-455-xo327q

Conversation

@krlmlr

@krlmlr krlmlr commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #455.

path_normalize() created an empty placeholder for a database file that does not exist yet, then asked normalizePath(out, mustWork = TRUE) to resolve it. Resolving a path needs read permission on every directory above it, which a network drive routinely withholds, so duckdb() 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 dbdir in a directory that cannot be written to used to reach the user as cannot open the connection from writeLines(), and now says Cannot create database file and 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 every mustWork = TRUE call originating in this package fail while leaving all other callers alone. All five tests pass on this branch; three of them fail on main.

Documented in handbook/usage/connections/README.md, which owns this topic, and in the ?duckdb section it points at. The handbook page listed #455 as still to drain, so that line is now shorter.


Generated by Claude Code

#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
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.

Creating new databases fails on network drives if user has no privileges on underlying folder due to normalizePath with mustWork = TRUE

2 participants