Skip to content

Scan another machine over SSH, read-only, from the path field - #101

Open
armada45-pixel wants to merge 3 commits into
tobi:mainfrom
armada45-pixel:ssh-scan
Open

armada45-pixel wants to merge 3 commits into
tobi:mainfrom
armada45-pixel:ssh-scan

Conversation

@armada45-pixel

Copy link
Copy Markdown
Contributor

One of a set of small PRs that replace #87 and #88, one feature each. They touch neighbouring lines in state.rs, views.rs and tests.rs, so whichever merges later will need a rebase; I'll do those as they come up.

Builds on #90 (the path field is the way in), so that PR's commit is the first one here. Review the last two commits; I'll rebase once #90 merges.

Typing an address into the path field (ctrl l) scans a directory on another machine:

  • user@host:/path, as scp writes it
  • host:/path, where host is a Host from ~/.ssh/config, in whatever case it is typed
  • ssh://user@host:2222/path

How it works. The other machine does the walk. GNU find -printf runs there through the user's own ssh (BatchMode=yes, ConnectTimeout=10, -- before the target, the path shell-quoted with a trailing slash so a symlinked start is entered). The tree is built here from the NUL-separated listing. Nothing is installed remotely and disktree never prompts for a password. A listing that ssh did not finish (exit 255) is an error, not half a tree whose totals would be believed.

A remote scan is read-only. Its tree holds another machine's paths, and the same path may exist on this one. While Disktree::remote is set:

  • marks are dropped when the scan starts; marking, removal and the file manager are refused with a notice;
  • git probing, the free-space ticker, the volume picker's lookup of the root, and the administrator and macOS privacy hints are skipped;
  • the Mark button, the space mark / c review hints, the tooltip's mark hint and the Marked section's prompt are not offered;
  • a plain path typed into the field is scanned as a local root, never looked for in the remote tree;
  • paths are shown with forward slashes and no ~, and the root is named with its machine;
  • a failed connection shows "Could not read host:/path" with ssh's own message instead of a spinner.

AGENTS.md gains the house rule "A remote scan is read-only".

Verified. cargo xtask lint and cargo xtask test are green on Windows (71 app tests, 164 core). remote.rs unit tests cover address parsing (rejecting C:/x, http:// and dash-led targets), shell quoting, building the tree from a listing, hidden entries and apparent size, host case matching against the SSH config, an empty listing, and exit 255. A window-harness test sets a remote over a real tree and checks that the Mark button and hints disappear, that space, reveal and removal are refused with a reason, that a typed local path becomes a local scan, and that a local root restores marking.

The same code was run against a real host on the combined branch (#88), from Windows through the system OpenSSH to a Linux machine with GNU find 4.10: a home directory of 820,923 files and 106,027 directories in 3.6 s, with the size, file and directory totals matching find run on the host itself; a symlinked start (/bin); a host typed in the wrong case; and a host that does not exist. ssh was confirmed to exit 255 for a session dropped from the far end and for an unknown host key.

Not verified. No real connection was made from this split branch itself. Nothing was run on Linux or macOS as the scanning side. The remote side needs GNU find, so a macOS or BSD target will fail with find's own message. A connection dropped mid-scan inside the app was not tried.

🤖 Generated with Claude Code

armada45-pixel and others added 3 commits October 13, 2026 12:05
The trail shows where you are but could not be typed into, so going
somewhere known meant clicking down to it or starting again from the
command line. A click on the empty space beside the trail, or ctrl l,
now makes the trail a text field holding the current path, as a file
manager's address bar does: Enter goes there, Escape or a click
elsewhere puts the trail back.

A path inside the tree is a step within it, one above the root widens
the scan and keeps what is measured, and anything else is scanned from
scratch. A file names its directory. A path that does not exist, or is
not a full one, is said in a notice and the field stays open to fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Typing user@host:/path, a Host from the SSH config as host:/path, or
ssh://user@host:port/path into the path field scans that directory on
another machine. The other machine does the walk: GNU find lists the tree
through the user's own ssh, which never prompts, and the tree is built
here from the listing. A listing ssh did not finish is an error, not half
a tree whose totals would be believed.

A remote tree holds another machine's paths, and the same path may exist
here. So while one is on screen nothing marks, removes, reveals or probes
a path: marks are dropped, marking, removal and the file manager say why
not, git, the free-space meter and the administrator and privacy hints
are skipped, and the Mark button and the mark and review hints are not
offered. A local root puts all of it back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two places still took the remote root for a path here. The picker asked
which local volume holds it, and a plain path typed into the field was
looked for in the remote tree, where a directory of the same name would
be stepped into. The picker now lists this machine's volumes as they
are, and a typed local path is scanned as a local root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant