Skip to content

statusline-command.sh v3.0: stat -f %m regression on Linux/WSL (was #495) #679

@stratofax

Description

@stratofax

Problem

Issue #495 fixed the stat -f %m macOS-only syntax in the v2.5 statusline, but PAI v3.0 has regressed:

  1. 10 hardcoded stat -f %m calls (up from 7 in v2.5)
  2. No get_mtime() wrapper function — it's completely absent from the v3.0 release
  3. No export -f — even if the function is added, background subshells ({ ... } &) can't see it without export -f get_mtime

On Linux, stat -f means "display filesystem status" (completely different from macOS's "format" flag), so it silently produces unuseable output instead of the desired file modification epoch data.

Symptoms

Linux users see a broken statusline:

  • No LOC or weather data
  • No Branch, Age, Mod, or New counts
  • Empty LEARNING panel
  • Blank SK/WF/Hook counts

Fix

1. Add the function after # PARSE INPUT near the top of statusline-command.sh:

# CROSS-PLATFORM HELPERS
get_mtime() {
    if [[ "$OSTYPE" == darwin* ]]; then
        stat -f %m "$1" 2>/dev/null || echo 0
    else
        stat -c %Y "$1" 2>/dev/null || echo 0
    fi
}
export -f get_mtime

2. Replace all 10 occurrences of stat -f %m "$VAR" 2>/dev/null || echo 0 with get_mtime "$VAR".

Find them with: grep -n 'stat -f %m' statusline-command.sh

3. Ensure fd is available (Ubuntu packages it as fd-find):

sudo apt install -y fd-find
sudo ln -s /usr/bin/fdfind /usr/local/bin/fd

Environment

  • Ubuntu Server 24.04.4 LTS (bare metal)
  • PAI v3.0 (fresh install from release)
  • Claude Code v2.1.42
  • Bun 1.3.9

Notes

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