You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: SMB upload parent creation silently suppresses errors and may miss nested directories #184
On current DBackup dev (and v4.0.0), src/lib/adapters/storage/smb.ts has an ensureDir() helper that calls client.mkdir(path.posix.dirname(remotePath), "/") once and catches every error as though the directory already existed.
For nested backup destination paths, an SMB server may require each missing parent to be created separately. If creation fails due to access denial or a genuinely missing ancestor, the catch-all leaves the failure unexplained until a later sendFile() attempt. The adapter's existing session directory cache can also mark the attempted path as known before a usable directory has been proven.
Proposed behavior
Create each absent parent directory in order below the configured SMB pathPrefix; treat the configured destination root as an existing boundary rather than automatically traversing/creating paths above it.
Cache only paths that were successfully created or confirmed to already exist.
Ignore only recognized benign already-exists responses (NT_STATUS_OBJECT_NAME_COLLISION and equivalent server messages); propagate unrelated mkdir errors with a safe path-specific message.
Reject path traversal such as .. and absolute destination paths that escape the configured root, while preserving ordinary relative paths.
Include tests for nested parent creation order, root confinement, idempotent already-existing directories and permission-denied failure.
The current downstream has several iteratively hardened regression tests for this behavior. This is a single generic SMB adapter correctness patch and requires neither a database migration nor environment-specific configuration.
The sibling issues #181 and #182 concern SMB listing completeness and long-filename enumeration respectively, and should remain separate from parent creation.
changed the title [-]SMB upload parent creation silently suppresses errors and may miss nested directories[/-][+][Bug]: SMB upload parent creation silently suppresses errors and may miss nested directories[/+]on Oct 10, 2026
Thanks for this one. The nested part is real. The mkdir of smbclient isn't recursive, so an upload to something like U1/a/b/x.tar fails on dev as soon as more than one folder is missing. This hits restoring directory backups to an SMB share the most, since the files go back with their whole folder structure.
The part about the catch-all is a bit different though. smbclient exits with 0 on every failed mkdir. I tested NT_STATUS_ACCESS_DENIED, NT_STATUS_OBJECT_PATH_NOT_FOUND and NT_STATUS_OBJECT_NAME_COLLISION, and all of them exit with 0. So the catch never sees these errors in the first place. They only show up in the output, and the upload then fails at put with a less helpful message.
Activity
[-]SMB upload parent creation silently suppresses errors and may miss nested directories[/-][+][Bug]: SMB upload parent creation silently suppresses errors and may miss nested directories[/+]Skyfay commentedon Oct 10, 2026
Hey @X1pheR
Thanks for this one. The nested part is real. The
mkdirofsmbclientisn't recursive, so an upload to something likeU1/a/b/x.tarfails ondevas soon as more than one folder is missing. This hits restoring directory backups to an SMB share the most, since the files go back with their whole folder structure.The part about the catch-all is a bit different though.
smbclientexits with 0 on every failedmkdir. I testedNT_STATUS_ACCESS_DENIED,NT_STATUS_OBJECT_PATH_NOT_FOUNDandNT_STATUS_OBJECT_NAME_COLLISION, and all of them exit with 0. So thecatchnever sees these errors in the first place. They only show up in the output, and the upload then fails atputwith a less helpful message.More on the fix in #185.
Thanks :)