Skip to content

[BUG]: some of the packages are not changing accordingly #337

Closed

Description

@padulkemid

Version
0.5.4
OS
macOS

Describe the bug
Won't change version, always fallback to machine's env like java to usr/bin/java and nodejs to usr/local/bin/node.

Is there anything wrong with my setup? since I just brew update && brew upgrade everything yesterday? (might be an issue with some packages that always falling back to default version?)

Screenshots[optional]
image

Activity

  1. added
    bug
    on Aug 7, 2024
  2. padulkemid commented on Aug 7, 2024

    @padulkemid
    Author

    confirmed: work with kotlin and golang, just java and nodejs

  3. padulkemid commented on Aug 7, 2024

    @padulkemid
    Author

    image

    it appears vfox 's dir in $PATH are added in below from the bin, should we move it to the topmost path?

  4. padulkemid commented on Aug 7, 2024

    @padulkemid
    Author

    I think this commit is from months ago and the version before works fine, is this PATH changing state are handled in here?

    pathSet := env.NewPaths(env.EmptyPaths)
      for _, item := range items {
      	if item.Key == "PATH" {
    		pathSet.Add(item.Value)
    	} else {
    		envKeys.Variables[item.Key] = &item.Value
    	}
      }
    
    envKeys.Paths = pathSet
  5. kuddl commented on Oct 29, 2024

    @kuddl

    I have the same issue...
    But only in my VS Code Terminal .. I use Warp for my main standalone Terminal, and everything works fine there.. any solution to this? @padulkemid maybe you solved it?

  6. padulkemid commented on Oct 29, 2024

    @padulkemid
    Author

    I have the same issue... But only in my VS Code Terminal .. I use Warp for my main standalone Terminal, and everything works fine there.. any solution to this? @padulkemid maybe you solved it?

    i think its about the pathing source and stuff (it might be, from the PATH commit earlier) I haven't take a look at it, since it causes my workflow to be broken,so I moved into mise now @kuddl

  7. kuddl commented on Oct 30, 2024

    @kuddl

    I "kind of fixed it", but do not know why it worked:

    Even though the VSCode terminal said: echo $SHELL -> /bin/zsh
    vfox was not poperly activated ...
    I added the bash activate (!) command to my .zshrc, and then it work as expected.

    So I have both commands in my .zshrc

    # vfox
    eval "$(vfox activate zsh)"
    eval "$(vfox activate bash)"

    I suspect, that something is missing in the zsh variant, that VSCode needs or looks for ...

    But for now it works.
    To @aooohan: Thanks a lot for the project! Maybe this hint / bug is helpful.

  8. padulkemid commented on Oct 30, 2024

    @padulkemid
    Author

    by taking a look at the code, there are subtle differences between activating the shell in zsh and bash, 2 of this has the same commands but there are some quirks that made the same commands achieve different result, might something to do

  9. linghengqian commented on Oct 20, 2026

    @linghengqian
    Member

    This still happens in 1.0.13 (main is still the v1.0.13 commit, b67f56e). When a login shell starts with vfox directories already in PATH, macOS path_helper moves them behind /usr/local/bin, /usr/bin and the other system directories, and vfox activate does not move them back to the front. That is the situation in a tmux pane or a zsh -l typed in a vfox shell. It is also the terminal in VS Code: a login shell on top of the environment VS Code resolved from a login shell at startup, or inherited from the shell that ran code (VS Code's terminal profiles FAQ describes the reordering). The $PATH in the reporter's second comment has the same shape.

    I checked on a GitHub-hosted macOS runner (macOS 26.6.2, arm64, zsh 5.9, the real /usr/libexec/path_helper) with the release binaries of 0.5.4, 1.0.8, 1.0.10 and 1.0.13: https://github.com/linghengqian/vfox/actions/runs/39403641018. That is my fork's e2e job with scripts/e2e-test.sh replaced by this script. Everything starts from env -i and an interactive login zsh, with eval "$(vfox activate zsh)" in ~/.zshrc and global versions set beforehand for demo nodejs and java SDKs (stub scripts in the install directories). /usr/bin/java is the real one. The runner's node is Homebrew's, so I put a stand-in at /usr/local/bin/node. A third demo SDK with no system counterpart resolved to vfox in every case, like kotlin and golang in the report.

    What node and java resolve to (vfox: both from vfox's directories, system: /usr/local/bin/node and /usr/bin/java):

    login shell started from 0.5.4 1.0.8 1.0.10 1.0.13
    a clean environment (new tab) vfox vfox vfox vfox
    a shell where vfox is active system system system system
    a tmux pane in that shell system system system system
    the environment VS Code resolved at startup system system system system
    a non-login zsh in that shell vfox vfox vfox vfox

    The VS Code row replays what VS Code does: at startup it runs zsh -i -l -c with VSCODE_RESOLVING_ENVIRONMENT=1 and keeps that shell's environment, then the terminal is a login zsh on top of it. I did not run VS Code itself.

    The report's steps in the nested shell on 1.0.13, and its PATH:

    $ vfox use -g [email protected]
    Now using [email protected].
    $ vfox current nodejs
    -> v14.18.2
    $ command -v node
    /usr/local/bin/node
    $ print -l ${(s.:.)PATH} | nl -ba
         1	/usr/local/bin
         2	/System/Cryptexes/App/usr/bin
         3	/usr/bin
    ...
        13	~/.vfox/sdks/demo/bin
        14	~/.vfox/sdks/java/bin
        15	~/.vfox/sdks/nodejs/bin
    

    In 0.5.4 and 1.0.8 the zsh hook skips everything in a shell that inherited its variables (0.5.4, 1.0.8), so the new shell gets neither a PATH export nor the precmd hook. c1ac36b (1.0.10, closes #637 and #655) compares the PID instead, and the hook is registered now. The order is still wrong, because activate (L158) and env (L305) keep whatever sits before the first vfox directory ahead of vfox's own (SplitSystemPaths, added in 717c219 for #622). After path_helper that is the whole system PATH.

    With eval "$(brew shellenv)" in ~/.zprofile, the nested shell and the VS Code case resolve node to Homebrew's /opt/homebrew/bin/node on all four versions.

    Until this is fixed, dropping the inherited vfox directories before activating works around it:

    # ~/.zshrc
    path=(${${path:#*/.vfox/*}:#*/.version-fox/*})
    eval "$(vfox activate zsh)"

    On 1.0.10 and 1.0.13 it fixed the nested shell, the tmux pane and the VS Code case. It also fixed the nested shell and the VS Code case with brew shellenv in ~/.zprofile. With no vfox directory left in PATH, SplitSystemPaths has no prefix, so activate puts the vfox directories first.

    My guess is that the directories path_helper adds (/etc/paths and /etc/paths.d) should not count as user-injected, so a virtualenv that really sits in front keeps its place. I have not tried it.

  10. self-assigned this
    on Oct 22, 2026
  11. linghengqian commented on Oct 23, 2026

    @linghengqian
    Member

    #736 (merged, not released yet) adds a fix for this, but it has to be switched on:

    $ vfox config path.mode baseline

    With baseline, vfox activate records the PATH it found, without vfox's own directories, and the entries in front of vfox's that were already in that PATH are moved behind vfox's. That is the case described in the comment above: path_helper puts /usr/local/bin, /usr/bin and the other system directories in front of the vfox directories that a nested shell, a tmux pane or the VS Code terminal inherited.

    Checked with builds of v1.0.13 and main, with a PATH shaped like the one path_helper leaves behind (system directories first, vfox's after them). Which command runs after vfox activate:

    v1.0.13 main, default main, path.mode baseline
    system system vfox

    The default stays legacy (the behavior of 1.0.x), so nothing changes until the setting is switched on; whether and when the default changes is tracked in #737. In the default mode vfox use and vfox doctor now say which directory comes first and why, for example `node` runs /usr/local/bin/node instead of [email protected]: its directory comes before vfox in PATH.

    baseline leaves one thing alone on purpose: a directory that was added to PATH after vfox activate ran, for example eval "$(brew shellenv)" placed below the vfox line in ~/.zshrc, stays in front. vfox doctor reports it as added after activation and suggests activating vfox after that line, or path.mode aggressive.

    A setting change applies at the next prompt, but baseline needs the PATH that was recorded when the shell started, so open a new terminal after upgrading. See PATH Order Settings. This stays open until a release contains path.mode.

  12. linghengqian commented on Nov 10, 2026

    @linghengqian
    Member

    Closed by v1.1.0: baseline is now the default path.mode (#738, released 2026-11-07).

    What this fixes here: when a login shell starts with vfox directories already in PATH, macOS path_helper moves them behind /usr/local/bin, /usr/bin and the other system directories (nested shell, zsh -l in a vfox shell, tmux pane, VS Code terminal). With baseline, vfox activate records the PATH it found (minus vfox's own directories) in __VFOX_ORIG_PATH and moves entries that were already there behind vfox's directories. Verified before the release with a PATH shaped the way path_helper leaves it: v1.0.13 resolves node/java to the system copy, main with path.mode baseline resolves them to vfox's copy.

    After upgrading, open a new terminal: a shell started before the upgrade has no recorded baseline and keeps behaving like legacy until it is restarted. If only a few directories must stay in front, list them in path.preserve instead of switching back to legacy.

    If this still reproduces on v1.1.0+ in a fresh terminal, please reopen with vfox --version, vfox config path.mode, vfox doctor, echo $PATH, and which command resolves to the wrong binary.

  13. added this to the 1.1.0 milestone on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions