-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Labels
bugThis issue is a bug.This issue is a bug.installationneeds-reviewThis issue or pull request needs review from a core team member.This issue or pull request needs review from a core team member.p2This is a standard priority issueThis is a standard priority issue
Description
Describe the bug
Hi
I noticed multiple tiny issues in the install script, while looking into the first one in the list below:
- The
-iand-boptions do not check if the directory name has been supplied. Theshiftcommand fails, but the script continues. shellcheckcomplains about a self assigned variable:INSTALL_DIR="$INSTALL_DIR"create_bin_symlinks()does not catch themkdirerror- The install dir should be verified that it is absolute pathname, otherwise
create_bin_symlinks()andcreate_current_symlinks()will generate bad symlinks.
Expected Behavior
- The script should exit if argument is missing
- The assignment is superfluous, does not affect the behaviour
- The script should exit, if
mkdirfails - The binary symlinks should be valid
Current Behavior
- There is an error message, but the script continues
- Does not affect the behaviour
- An error is reported, but the script continues
- If the supplied install dir (from
-i) is a relative path, the symlink may be invalid
Reproduction Steps
In all cases, unpack the zip file and change to that directory:
- run install with
-ior-b, but no arg
./install -b`
./install: line 64: shift: shift count out of range
...
- run
shellcheckagainst the script
shellcheck install
In install line 81:
INSTALL_DIR="$INSTALL_DIR"
^---------^ SC2269 (info): This variable is assigned to itself, so the assignment does nothing.
For more information:
https://www.shellcheck.net/wiki/SC2269 -- This variable is assigned to itse...
- create a file that has same name as the directory being created
touch bbb
./install -i aaa -b bbb
mkdir: cannot create directory ‘bbb’: File exists
ln: failed to access 'bbb/aws': Not a directory
ln: failed to access 'bbb/aws_completer': Not a directory
You can now run: bbb/aws --version
Note: the script should have aborted after the mkdir error.
- same steps as above
ls -l aaa/v2
total 4
drwxr-xr-x 4 fy fy 4096 Sep 29 16:54 2.7.35
lrwxrwxrwx 1 fy fy 13 Sep 29 16:54 current -> aaa/v2/2.7.35
ls -l aaa/v2/current/
ls: cannot access 'aaa/v2/current/': No such file or directory
Possible Solution
- Check for
$#when parsing-iand-b - Remove the superfluous line
- Append
|| exit 1to themkdirline - Check that the value supplied in
-iis an absolute pathname
I can provide a PR for the above, if required.
Additional Information/Context
All the above were carried out on a Linux box.
I'm not sure how the other OSes behave, or if they use the same script!
CLI version used
aws-cli/2.7.35 Python/3.9.11 Linux/5.19.11-arch1-1 exe/x86_64.arch prompt/off
Environment details (OS name and version, etc.)
5.19.11-arch1-1 GNU/Linux
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.installationneeds-reviewThis issue or pull request needs review from a core team member.This issue or pull request needs review from a core team member.p2This is a standard priority issueThis is a standard priority issue