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: "direnv: error invalid character 'A' looking for beginning of value" #190

Open
pkubiak-nr opened this issue Jul 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pkubiak-nr
Copy link

Describe the Bug

Keep getting this error on Amazon Linux VM: direnv: error invalid character 'A' looking for beginning of value

Steps to Reproduce

After login create a new .envrc file in any Git repository:

echo export FOO=foo > .envrc
direnv: error /home/ec2-user/repos/poc-tools/.envrc is blocked. Run `direnv allow` to approve its content

[ec2-user@ip-10-222-17-45 poc-tools]$ direnv allow .
direnv: loading ~/repos/poc-tools/.envrc
direnv: error invalid character 'A' looking for beginning of value

[ec2-user@ip-10-222-17-45 poc-tools]$ cat -A .envrc
export FOO=foo$

Expected Behaviour

direnv should load the variable into current session

Actual Behaviour

Each time when trying to run direnv allow or direnv reload I keep getting this error:

direnv: error invalid character 'A' looking for beginning of value

Debug Output

**Environment**
 - OS: Amazon Linux

 cat /etc/os-release
NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.5.20240624"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/"
DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/"
SUPPORT_URL="https://aws.amazon.com/premiumsupport/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
VENDOR_NAME="AWS"
VENDOR_URL="https://aws.amazon.com/"
SUPPORT_END="2028-03-15"
  • Shell:bash
 bash --version | head -2
GNU bash, version 5.2.15(1)-release (x86_64-amazon-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
  • Direnv version [2.25.2, 2.34.0] - installed via asdf

Additional context
The problem exists when using direnv installed with asdf. It exists regardless of version installed (two versions were tested).
The following line was added to a file ~/.bashrc: eval "$(direnv hook bash)

  • asdf version
asdf --version
v0.14.0-ccdd47d

The error shows up on each repository where .envrc is created and then trying to be loaded.

[ec2-user@ip-10-222-17-45 k8s]$ cd ../poc-tools/
direnv: loading ~/repos/poc-tools/.envrc
direnv: error invalid character 'A' looking for beginning of value
  • Hook loaded
 type _direnv_hook
_direnv_hook is a function
_direnv_hook ()
{
    local previous_exit_status=$?;
    trap -- '' SIGINT;
    eval "$("/home/ec2-user/.asdf/installs/direnv/2.34.0/bin/direnv" export bash)";
    trap - SIGINT;
    return $previous_exit_status
}
  • No value printed
[ec2-user@ip-10-222-17-45 poc-tools]$ echo $FOO
  • direnv status
[ec2-user@ip-10-222-17-45 poc-tools]$ direnv status
direnv exec path /home/ec2-user/.asdf/installs/direnv/2.34.0/bin/direnv
DIRENV_CONFIG /home/ec2-user/.config/direnv
bash_path /usr/bin/bash
disable_stdin false
warn_timeout 5s
whitelist.prefix []
whitelist.exact map[]
Loaded RC path /home/ec2-user/repos/poc-tools/.envrc
Loaded watch: ".envrc" - 2024-07-05T04:09:56Z
Loaded watch: "../../.local/share/direnv/allow/4343317fc4707c0c56d1ac82ebcf8eaccfecc85de52ce28ee0a0eb33f74a38bc" - 2024-07-05T04:10:01Z
Loaded watch: "../../.local/share/direnv/deny/d5bd79a7b1bde2ff8456e0490db5641367656c8f67fa40f68eb6bf3009a9c39b" - 1970-01-01T00:00:00Z
Loaded RC allowed 0
Loaded RC allowPath /home/ec2-user/.local/share/direnv/allow/4343317fc4707c0c56d1ac82ebcf8eaccfecc85de52ce28ee0a0eb33f74a38bc
Found RC path /home/ec2-user/repos/poc-tools/.envrc
Found watch: ".envrc" - 2024-07-05T04:09:56Z
Found watch: "../../.local/share/direnv/allow/4343317fc4707c0c56d1ac82ebcf8eaccfecc85de52ce28ee0a0eb33f74a38bc" - 2024-07-05T04:10:01Z
Found watch: "../../.local/share/direnv/deny/d5bd79a7b1bde2ff8456e0490db5641367656c8f67fa40f68eb6bf3009a9c39b" - 1970-01-01T00:00:00Z
Found RC allowed 0
Found RC allowPath /home/ec2-user/.local/share/direnv/allow/4343317fc4707c0c56d1ac82ebcf8eaccfecc85de52ce28ee0a0eb33f74a38bc
  • No extra characters etc.
[ec2-user@ip-10-222-17-45 poc-tools]$ cat -A .envrc
export FOO=foo$

Trying to reshim did not help:

 asdf reshim direnv 2.34.0
[ec2-user@ip-10-222-17-45 poc-tools]$ cd ../
direnv: unloading
[ec2-user@ip-10-222-17-45 repos]$ cd -
/home/ec2-user/repos/poc-tools
direnv: loading ~/repos/poc-tools/.envrc
direnv: error invalid character 'A' looking for beginning of value
[ec2-user@ip-10-222-17-45 poc-tools]$ direnv --version
2.34.0
[ec2-user@ip-10-222-17-45 poc-tools]$ echo $PATH
/home/ec2-user/.krew/bin:/home/ec2-user/.asdf/shims:/home/ec2-user/.asdf/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
[ec2-user@ip-10-222-17-45 poc-tools]$ asdf shim-versions direnv
direnv 2.25.2
direnv 2.34.0
@pkubiak-nr pkubiak-nr added the bug Something isn't working label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant