Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: Multiline string ENV var handling issue in shim logic (asdf v0.16.4) #1986

@eizengan

Description

@eizengan

Describe the Bug

Related to #1979

#1982 fixes the problem which truncated most multiline ENV, however there are still issues handling values containing particular content. For example, we currently drop all lines beginning-with-and-including lines ending in =, which breaks e.g. x509 certificates. Other characters may also trigger this behavior; I am not sure.

Steps to Reproduce

  1. create a multiline env var like the following:
export CERT="-----BEGIN CERTIFICATE-----
MANY\LINES\THE
LAST\ONE\ENDS\IN
AN=
-----END CERTIFICATE-----"
  1. ruby -e "puts ENV['CERT']"

Expected Behaviour

Prints

-----BEGIN CERTIFICATE-----
MANY\LINES\THE
LAST\ONE\ENDS\IN
AN=
-----END CERTIFICATE-----

Actual Behaviour

Prints

-----BEGIN CERTIFICATE-----
MANY\LINES\THE
LAST\ONE\ENDS\IN

Environment

OS:
Darwin C02FC0QGMD6V 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:22:00 PST 2025; root:xnu-11215.81.4~3/RELEASE_X86_64 x86_64

SHELL:
zsh 5.9 (x86_64-apple-darwin24.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
0.16.4

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/nate.eizenga/.asdf
ASDF_CONFIG_FILE=/Users/nate.eizenga/.asdfrc

ASDF INSTALLED PLUGINS:
python    https://github.com/danhper/asdf-python.git           a3a01856098d6d2b9642e382f5b38e70275726d1
ruby      https://github.com/asdf-vm/asdf-ruby.git             2885ab7d311715ec4f6dfe2fc5dfed329fa1f263
rust      https://github.com/code-lever/asdf-rust.git          95acf4fe65df1de74fca502482b8f3ac5af73c05
terraform https://github.com/asdf-community/asdf-hashicorp.git 22eb1c4a16adcde39aaaf89fbb5d9404a1601fce

asdf plugins affected (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions