Skip to content

feat(ssh): report free disk space via statvfs@openssh.com #170

Description

@zoza1982

Context

The pane free-space indicator (added for the local backend) inherits Vfs::spaceOk(None) for
SSH/SFTP, so remote panes show no free-space figure. russh-sftp does implement the
statvfs@openssh.com extension, but only on its raw session (RawSftpSession::statvfs); the
high-level SftpSession Cairn uses (SftpVfs/RealSftp) doesn't re-expose it, and there's no
documented way to reach the inner raw session.

Proposal

  • Get access to the raw session's statvfs (either hold a RawSftpSession alongside/instead of the
    high-level SftpSession in the connect path, or upstream a SftpSession::statvfs passthrough).
  • Add SftpOps::statvfs + RealSftp impl mapping Statvfs { blocks, blocks_avail, fragment_size }
    SpaceInfo { total: blocks*frsize, available: blocks_avail*frsize } (fragment_size, not
    block_size). Map "extension unsupported"/transport failure → Ok(None) (decorative, never a gate).
  • Advertise Caps::SPACE for SftpVfs; add a short per-connection TTL cache (5–10s) to avoid a
    round-trip on every navigate.
  • MockSftp support + a unit test (incl. fragment_size != block_size).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions