Skip to content

Sourceable wrapper shadows the native import builtin #175

Description

@fentas

Problem

The sourceable argsh wrapper (v0.10.0 release artifact) defines import() as a bash function near the end of the file unconditionally, after the earlier builtin-detection block already did unset -f import when argsh.so loaded successfully. Result: even with ARGSH_BUILTIN=1 and a matching argsh.so, type -t import reports function, and the native Rust import builtin is never used.

Repro

export PATH_BIN=/path/to/bin   # contains argsh (v0.10.0) + matching argsh.so
source "${PATH_BIN}/argsh"
echo "$ARGSH_BUILTIN"          # 1 — builtin loaded fine
type -t import                  # function — bash fallback shadows it
unset -f import
type -t import                  # builtin — works when unshadowed

Why it matters

The bash fallback's ^-prefix resolution and sourcing semantics differ subtly from the native builtin (resolution anchors on ARGSH_SOURCE/BASH_SOURCE[-1], walk-up behavior). Consumers like lok8s hit hard-to-debug differences depending on which implementation happens to win.

Expected

When the native builtin loads, the wrapper should not re-define import as a function (or should define it only inside the (( ! ARGSH_BUILTIN )) branch).

Found while debugging lok8s CLI breakage on 2026-06-11 (argsh 0.10.0, linux-amd64).

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions