Skip to content

fix(cli): context.Background() used instead of cmd.Context() in packages.go (contextcheck violation) #49

Description

@dipto0321

Describe the bug

Two related problems around asdf's environment variable:

  1. docs/managers.md is factually wrong. It states asdf detection uses ASDF_DIR. The actual code (internal/detector/asdf.go:27,56-96) deliberately uses ASDF_DATA_DIR instead, with a code comment explicitly explaining that ASDF_DIR points at the asdf source checkout, not the data/install directory, and that using it would be wrong.

  2. internal/detector/system_node.go:414-421's classifier is inconsistent with asdf.go's own stated rationale. The "is this node inside a manager's data dir" override check reads ASDF_DIR for asdf — the opposite of what asdf.go says is correct. A user who has only set ASDF_DATA_DIR (the actually-correct variable, per asdf.go's own comment) gets their asdf-managed Node install misclassified by nodeup check/nodeup upgrade's system-node warning, producing a bogus "nodeup does not recognize this install" warning for a perfectly normal asdf setup.

This is a committed, tested inconsistency (system_node_test.go encodes ASDF_DIR as the expected override variable) rather than an accidental typo — but it directly contradicts asdf.go's own two-file-away rationale for why ASDF_DIR is the wrong variable to use.

Suggested fix

  • Change docs/managers.md's asdf row to say ASDF_DATA_DIR (matching the code).
  • Change system_node.go's manager-data-dir override check for asdf to read ASDF_DATA_DIR instead of ASDF_DIR, matching asdf.go's own detection logic, and update system_node_test.go's expectations accordingly.

Severity

Medium — causes real, incorrect warnings for asdf users with a standard setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions