Repository navigation
Description
Problem
DBackup's SMB adapter delegates directory enumeration to samba-client (client.list()). With long backup archive filenames, smbclient can emit a line without the usual padded filename column. The downstream has observed cases where samba-client returns an empty or incomplete listing while a raw dir command still contains those entries.
Example (synthetic data):
Critical_Backups_2026-10-10_01-20-00_full-000.tar A 2580549120 Sat Oct 10 01:20:00 2026
nightly.index A 100 Sat Oct 10 01:20:00 2026
snapshot-2026-10-10 Dn 0 Sat Oct 10 01:20:00 2026
Related downstream discoveries: inconsistent raw output type (string/Buffer), non-padded filenames, mixed-case DOS directory flags, and directories containing spaces. These are related symptoms of one logical SMB listing correctness problem, not separate feature requests.
Current upstream
At v4.0.0 / current main, src/lib/adapters/storage/smb.ts uses client.list(currentDir + "/*") for recursive listing and does not recover rows omitted by the library parser.
Proposed upstream-compatible fix
- Normalize enumeration to a properly scoped current directory so names containing spaces are not interpreted as a glob/path outside the intended listing.
- Recover otherwise omitted entries from the same
smbclientdirectory output using a conservative right-anchored parser, retaining only syntactically valid rows. - Merge parsed entries by exact filename with ordinary
list()output to avoid duplicates, preserving original API shape. - Recognize mixed-case DOS attribute flags and correctly distinguish files from directories.
- Preserve existing path-prefix and credential-sanitization boundaries; no Homelab-specific paths or policy.
- Include source-level regressions for long filename, partial/empty library listing, directory containing spaces,
Dnattributes, and failed raw enumeration.
A maintained downstream has regression coverage for these cases. This issue is intended to converge that single logical patch with upstream rather than submit iterative repair commits as multiple unrelated PRs. A separate issue covers incomplete recursive listings after permission errors (#181), which has different compatibility considerations.
Activity
[-]SMB listings may omit long filenames and misparse directory rows[/-][+][Bug]: SMB listings may omit long filenames and misparse directory rows[/+]Skyfay commentedon Oct 10, 2026
Hey @X1pheR
Thanks for the report. The problem is real, I could reproduce it against a Samba 4.22 server, but the cause is a bit different from what the issue describes.
smbclientprints every row as%-30s%7.7s %8.0f %s, so the attribute is right-aligned in 7 characters.samba-clientparses that with\s{6,}([A-Z0-9]{1,2})\s+, which drops a row when:AnorDnon Windows servers with content indexing turned off. On such a share the listing comes back completely empty.AHS.When a folder row is dropped, everything below it is missing too.
The first and the last row are found on
dev, the second one isn't. So a long name on its own is fine, andsmbclientnever prints a row with a single space like in your example. Folder names with spaces also work today, sincesamba-clientputs the path in quotes. The Buffer case doesn't happen either,execareturns a string here.I left my notes on the fix in #183.
Thanks :)