Skip to content

rtk ls with multiple directory arguments omits per-directory headers #2857

Open

Description

@Osatona

Summary

rtk ls dirA dirB (and any N-directory invocation) flattens every directory's entries into one list with no per-directory attribution, unlike native ls, which prints a path: header before each directory's listing. A file can appear to belong to the first directory listed when it actually came from another.

This is distinct from #2271 / PR #2272, which fixes header loss for ls -R (single-directory recursive). The case here is triggered by passing multiple directory operands to non-recursive ls, so it isn't covered by that fix.

Repro

$ mkdir -p dirA dirB && echo a1 > dirA/file_a.txt && echo b1 > dirB/file_b.txt

$ ls dirA dirB
dirA:
file_a.txt

dirB:
file_b.txt

$ rtk ls dirA dirB
file_a.txt  3B
file_b.txt  3B

Expected: output preserves the per-directory path: headers (or equivalent attribution) that native ls prints whenever more than one directory operand is given.

Actual: entries from all directories are merged into a single flat list with no indication of which directory each file came from.

Impact

Deterministic whenever more than one directory is passed and at least one is non-empty. Misleads any check that depends on directory membership (e.g. "did file X land in stage A or stage B of a pipeline") into attributing a file to the wrong directory, since the merged list reads as if everything came from the first path.

Environment

rtk 0.43.0, Windows (Git Bash).

Workaround

rtk proxy ls dirA dirB (unfiltered passthrough) or one directory at a time via rtk proxy ls <dir>.

Activity

  1. added
    bug
    good first issue
    on Jul 7, 2026
  2. pszymkowiak commented on Jul 7, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 85%

    Summary

    rtk ls with multiple directory arguments merges all entries into one flat list without per-directory 'path:' headers like native ls; add per-directory attribution for multi-operand ls calls.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/ls_cmd.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. NickSpag commented on Jul 16, 2026

    @NickSpag

    reproduced on macos

  4. SNComrade commented on Nov 26, 2026

    @SNComrade

    Confirmed with long listings on Ubuntu 26.04.1 LTS x86-64, RTK 1.2.1 full release. Short multi-directory output preserved both headings in this fixture. Long output lost both, so the listing no longer identifies the directory containing y.

    # In an empty directory
    export LC_ALL=C
    mkdir -p a/d b
    printf 'content\n' > a/x
    touch b/y
    chmod 755 a/d
    chmod 644 a/x b/y
    ls -l a b | sed -n '/^[ab]:$/p'
    rtk ls -l a b | sed -n '/^[ab]:$/p'

    Expected and observed from native:

    a:
    b:
    

    The RTK heading check produced zero lines. Before the heading filter, the RTK listing contained 755 d/, 644 x 8B, and 644 y 0B, followed by its filtering and recall notices.

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

    area:clibuggood first issuepriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions