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

Skip to content

Elixir is unable to decode environment variables that end with an "=" #14280

@tomciopp

Description

@tomciopp

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Elixir 1.18.2 (compiled with Erlang/OTP 25)

Operating system

MacOS 15.3.1

Current behavior

I have some local environment variables that are loaded using direnv. This had previously been working for years but I ran into this issue this morning and I am completely baffled.

If I have an environment variable defined below it will not load in elixir. (Ends with = due to it being a Base64 encoded variable)

export TEST="foo="

If I remove the "=" from the end of the variable everything works as expected.

export TEST="foo"

If I run echo $TEST in my shell it will return

=> echo $TEST
foo=

If I run this code: TEST="asdf=" elixir --eval 'System.get_env("TEST") |> IO.inspect()', it returns nil.

If I run this code: TEST="asdf=" erl -noshell -eval 'io:format(os:getenv("TEST")).' -s init stop it works

If I run this code inside iex :os.getenv(~c"TEST") it returns false.

Expected behavior

I expect variables that include an equals sign at the end to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions