aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.52k stars 4.12k forks source link

Installing in relative path installs broken symlinks #6852

Open raymzag opened 2 years ago

raymzag commented 2 years ago

Describe the bug

Followed the linux installation steps with -i and -b option, but symlinks seem broken. I am unable to run aws after install. It is failing with "No such file or directory"

https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

It seems similar issue has been reported in this thread here too. https://www.reddit.com/r/Ubuntu/comments/hdrfly/aws_cli_command_not_working_when_installed_local/fvn1umn/

Expected Behavior

can run aws command.

Current Behavior

$ ./aws/install -i ./aws-cli -b ./aws-cli/bin --update
You can now run: ./aws-cli/bin/aws --version
$ ls -lad ./aws-cli/bin/aws
lrwxrwxrwx 1 root root 28 Apr  6 05:04 ./aws-cli/bin/aws -> ./aws-cli/v2/current/bin/aws
$ ls -lad ./aws-cli/v2/current
lrwxrwxrwx 1 root root 18 Apr  6 05:04 ./aws-cli/v2/current -> ./aws-cli/v2/2.5.2
$ ./aws-cli/bin/aws --version
/usr/bin/bash: line 140: ./aws-cli/bin/aws: No such file or directory

Reproduction Steps

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install -i ./aws-cli -b ./aws-cli/bin --update

Possible Solution

./aws-cli/v2/2.5.2/bin/aws this seems working when calling directly.

Additional Information/Context

No response

CLI version used

V2

Environment details (OS name and version, etc.)

ubuntu:20.04

aaoswal commented 2 years ago

Hi @raymzag, Thank you for submitting the issue. It was reproducible using the steps above.

We will take a look at this and prioritize a fix.

aaoswal commented 2 years ago

Hi @raymzag, This also seems to be a bug with respect to v1 and v2 both. Again, thank you for bringing this to our attention.

Also, a workaround this would be to use the following set of commands instead until a fix is shipped:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
nateprewitt commented 2 years ago

To add some more context here, the issue is specifically the usage of relative pathing. If you use the absolute paths for -i and -b, we'd expect the functionality to work.

The fix for the current issue will be to automatically expand the paths at runtime for the install script so they're properly stored in the aws bin file.

raymzag commented 2 years ago

Thank you for looking into it!