Skip to content

windows check kit: per-process section emits no rows (binary + inside an @() literal splits); berth events --json is not a flag #105

Closed

Description

@azrael-229

Ran contrib/windows/check.ps1 against the v0.3.1 windows-amd64 binary (Windows 11 26100, built-in PowerShell 5.1.26100; pwsh 7.6.7 also present — same behavior in both).

  1. Per-process section: no rows / wrong columns. Root cause: in the row-building lines, e.g.
    $rows += ,@($s.pid, "stowaway " + $s.name, $s.used / 1MB, $d)
    the binary + (and the division) inside the @(...) literal do not evaluate as one element — PowerShell parses the list so that "stowaway " + $s.name lands as two elements (the literal and the variable), shifting every column. Verified minimally in both PS 5.1 and pwsh 7.6:
    @(1, "stowaway " + $x, 2.5, "d") → 5 elements [1 | stowaway | <x> | 2.5 | d], while hoisting the concat into a variable first → the expected 4. (Depending on how the failure lands, the script also throws [System.Object[]] does not contain a method named 'op_Division' at the division.) Fix: hoist the label (and any arithmetic) into a variable before the @(...) literal. With that fix the table renders all rows with correct columns on this box.
  2. Events section always empty: the script calls berth events --json; v0.3.1 has no -json flag, and the script discards stderr, so the section silently prints "berth events returned nothing". The correct flag is --format json.
  3. Cosmetic: the header prints powershell: $PSVersionTable.PSVersion.ToString() literally (missing $( ) subexpression).
  4. Note: berth status --format json has no holders key (it has squatters, unprotected, leases); the script's null-guard makes this harmless, but the field names have drifted.

A patched copy that completes the checklist is available on request.

Activity

  1. T-Crypt commented on Oct 21, 2026

    @T-Crypt
    Owner

    PR #107 fixes all four:

    1. The script builds each label in a variable before the @(...) literal, so every row has its four columns again.
    2. It calls berth events --format json and keeps stderr. An empty answer now prints the exit code instead of "returned nothing".
    3. The header uses $($PSVersionTable.PSVersion.ToString()). Your report still prints System.Collections.Hashtable.PSVersion.ToString(), which fits: your local patch fixed the rows and left the header as it was.
    4. It reads the keys berth status --format json has: squatters, unprotected and leases.

    Your minimal @(1, "stowaway " + $x, 2.5, "d") repro saved a lot of guessing. You can take contrib/windows/check.ps1 from main now, and v0.3.3 will ship it.

  2. T-Crypt commented on Oct 21, 2026

    @T-Crypt
    Owner

    v0.3.3 is out and ships the fixed check kit: https://github.com/T-Crypt/berth/releases/tag/v0.3.3. Its contrib/windows/check.ps1 needs no local patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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