Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: asdf local fails to append to .tool-versions properly if there is no trailing newline #1299

Closed
jthegedus opened this issue Jul 17, 2022 · 1 comment · Fixed by #1310 or #1273
Closed
Assignees
Labels

Comments

@jthegedus
Copy link
Contributor

Describe the Bug

asdf local <tool> latest or asdf local <tool> <version> fail to append .tool-versions if there is no trailing newline in the file already.

Steps to Reproduce

  1. printf "%s" "golang 1.18.3" > .tool-versions
  2. asdf local deno latest
  3. cat .tool-versions
golang 1.18.3deno 1.23.3

Expected Behaviour

With this file:

.tool-versions (before):
----------------
1|golang 1.18.3
----------------

running asdf local deno latest

.tool-versions (after):
----------------
1|golang 1.18.3
2|deno 1.23.4
3|
----------------

gives the correct result.

Actual Behaviour

With this file:

.tool-versions (before):
----------------
1|golang 1.18.3
----------------

running asdf local deno latest

.tool-versions (after):
----------------
1|golang 1.18.3deno 1.23.4
----------------

gives this incorrect result

Environment

~/projects took 90ms 
➜ asdf info
OS:
Linux art-win11 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
0.62.0

ASDF VERSION:
v0.10.2-e1fd8ad97

ASDF ENVIRONMENT VARIABLES:
ASDF_CONFIG_FILE=/home/jthegedus/.config/asdf/.asdfrc

ASDF INSTALLED PLUGINS:
bats                         https://github.com/timgluz/asdf-bats.git main 299551f
deno                         https://github.com/asdf-community/asdf-deno.git master 87442fe
firebase                     /home/jthegedus/projects/asdf-firebase/. heads/v1.1.0 57f29ec
gcloud                       /home/jthegedus/projects/asdf-gcloud main f59e332
github-cli                   https://github.com/bartlomiejdanek/asdf-github-cli.git master d449199
golang                       https://github.com/kennyp/asdf-golang.git master cc8bc47
java                         https://github.com/halcyon/asdf-java.git master e62ee31
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 05f99c3
pnpm                         https://github.com/jonathanmorley/asdf-pnpm.git master 95752a9
python                       https://github.com/danhper/asdf-python.git master 57ef777
shellcheck                   https://github.com/luizm/asdf-shellcheck.git master 9d46274
shfmt                        https://github.com/luizm/asdf-shfmt.git master f893252
v                            https://github.com/jthegedus/asdf-v main aea3c30

asdf plugins affected (if relevant)

No response

@jthegedus jthegedus added the bug label Jul 17, 2022
@Stratus3D Stratus3D self-assigned this Jul 20, 2022
Stratus3D added a commit that referenced this issue Jul 21, 2022
If a .tool-versions file did not end with a newline new tools and
versions would get appended to the same line rather than properly
added on a new line in the file

Fixes #1299
Stratus3D added a commit to Stratus3D/asdf that referenced this issue Jul 21, 2022
If a .tool-versions file did not end with a newline new tools and
versions would get appended to the same line rather than properly
added on a new line in the file

Fixes asdf-vm#1299
Stratus3D added a commit that referenced this issue Jul 21, 2022
If a .tool-versions file did not end with a newline new tools and
versions would get appended to the same line rather than properly
added on a new line in the file

Fixes #1299
Stratus3D added a commit that referenced this issue Jul 21, 2022
If a .tool-versions file did not end with a newline new tools and
versions would get appended to the same line rather than properly
added on a new line in the file

Fixes #1299
Stratus3D added a commit that referenced this issue Jul 25, 2022
)

If a .tool-versions file did not end with a newline new tools and
versions would get appended to the same line rather than properly
added on a new line in the file

Fixes #1299
@Stratus3D
Copy link
Member

Fixed by #1310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants