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] Using ~ instead of $HOME in PATH causes git to fail #391

Open
barnes-cabnit opened this issue Apr 12, 2024 · 0 comments
Open

[BUG] Using ~ instead of $HOME in PATH causes git to fail #391

barnes-cabnit opened this issue Apr 12, 2024 · 0 comments
Labels
bug Something isn't working Triage-needed Triage needed by Cloud Shell team

Comments

@barnes-cabnit
Copy link

To Reproduce

Start with a fresh Azure Cloud Shell:

$ wget https://github.com/git-lfs/git-lfs/releases/download/v3.5.1/git-lfs-linux-amd64-v3.5.1.tar.gz
$ tar xzf git-lfs-linux-amd64-v3.5.1.tar.gz
$ cd git-lfs-3.5.1
$ sh install.sh --local
$ echo $PATH
~/.local/bin:~/bin:~/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/istio-latest/bin:/usr/local/linkerd/bin:/usr/lib/golang/bin:/opt/mssql-tools18/bin:~/bundle/bin:~/bundle/gems/bin
$ ls -l ~/.local/bin
-rwxr-xr-x 1 daniel daniel 11444224 Apr 12 04:03 git-lfs
$ git lfs
git: 'lfs' is not a git command. See 'git --help'.

The most similar command is
        log
$ PATH=$HOME/.local/bin:$PATH git lfs
git-lfs/3.5.1 (GitHub; linux amd64; go 1.21.7; git e237bb3a)
...

Is this specific to Cloud Shell?

Yes

Interface information

Edge on Windows 11

Additional context

The failure occurs because the PATH variable uses ~ instead of $HOME and while bash expands ~ in PATH entries other programs do not . I noticed the Cloud Shell Dockerfile includes the command ENV PATH ~/.local/bin:~/bin:~/.dotnet/tools:$PATH
Of course, $HOME isn't used because it is not available at container image build time.

Some possible solutions:

  • move the ~ paths into runtime where $HOME is defined, like /etc/profile, /usr/cloudshell/linux/start.sh, or similar
  • add PATH=${PATH//\~/$HOME} to a system-wide startup script
@barnes-cabnit barnes-cabnit added bug Something isn't working Triage-needed Triage needed by Cloud Shell team labels Apr 12, 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 Triage-needed Triage needed by Cloud Shell team
Projects
None yet
Development

No branches or pull requests

1 participant