asdf-vm/asdf

bug: `Error: nu::shell::access_beyond_end`

selfagency opened this issue · 6 comments

Describe the Bug

After installing asdf with Homebrew, adding the Nushell integration (which seems to need updating as let-env, which your integration uses, was deprecated), and restarting the session:

Error: nu::shell::access_beyond_end

  × Row number too large (empty content).
     ╭─[/Users/daniel/Library/Application Support/nushell/config.nu:874:1]
 874 │ $env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')
 875 │ source /opt/homebrew/opt/asdf
     · ───┬──
     ·    ╰── index too large (empty content)
 876 │ /libexec/asdf.nu
     ╰────

My integration:

$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')
source /opt/homebrew/opt/asdf
/libexec/asdf.nu

Steps to Reproduce

  1. Install asdf with Homebrew
  2. Add integration to Nushell config
  3. Open new terminal session

Expected Behaviour

To not throw an error on session launch

Actual Behaviour

The error as seen above

Environment

OS:
Darwin selfagency-m1mb.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64

SHELL:
0.84.0

BASH VERSION:
5.2.15(1)-release

ASDF VERSION:
v0.12.0

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/daniel/.asdf
ASDF_DIR=/opt/homebrew/Cellar/asdf/0.12.0/libexec
ASDF_CONFIG_FILE=/Users/daniel/.asdfrc

No plugins installed
ASDF INSTALLED PLUGINS:

asdf plugins affected (if relevant)

No response

Thanks for the report! The related deprecation fix is being worked on at #1610

Do you still get this error on the latest asdf? I'm closing this because it's likely fixed by #1624, but feel free to reopen if that is not the case.

Just installed v0.13.1 and seeing this. nu 0.86.0.

Same issue on Steam Deck, installed via homebrew

  • asdf v0.13.1
  • nushell 0.88.1

It seems like the source part doesn't trim the string, so it cause a line break.

Before

"\n$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " +  (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path

$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')
source /home/linuxbrew/.linuxbrew/opt/asdf
/libexec/asdf.nu

After

"\n$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\nsource " +  (brew --prefix asdf | str trim | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path

$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')
source /home/linuxbrew/.linuxbrew/opt/asdf/libexec/asdf.nu

Thanks for the explanation - I have updated #1660 to add str trim to the pipeline. Hopefully it will be merged