<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJzNVltvqzgQ_jXkZQQyBkLykIcmabVV09NV2z2vkQEHfEIga5uk3V-_M5CkSZt2W21XWoTMxTPfXDy3pM6eRw-qSiXYOhPPDp-A02dluVl5psA3WNQabCFBrC1oua6NsrVW0uCHaUprQFUgKpBaI-G2kBXkaoOrAKOqvERGnTcrWVko1VISuOfwq50A8AP84QQXDps67ILeu7v75Fd2td5Ru6oyVpQlqRVcIFglISRWcHjI6dlUSd1UGWyEViIp5XnMdn0slIGVWKIZRlZGkq7oAmUBZWg0aqts8Yo_EWb3y0gLrmyezgoQqEEprNTwqzEWRJpKY1AOEZCi6FICrxsLaSHTJTppt-dwcgZolRf2rUtexKsFONEYzeY7Js7BzSX4-HvqBGM6rqojBbxms5-385-X9w_Xdz-cYIo8_svmCZZPSEQSTOkPOrv9cQ6ULhQNZi1TJUpIBTqRQuX4cAnghOOtKpM_7u8vfzzO252Hx4vx7PKU5WI2Q8ojjRfqv8U88Qj_ukeuuzAl42Et0qXIpfmk-P3z_ZBNG60xlcpnSLQUSwN1o2FyTVlLzpdPYrXGlCusXRsKIX6Fd47h1iReWq_wQ6u_VFXrfP9Kz6Yy-AgHQRAF4TDsO8FVG5pz0ygr54s6bRBtanVzPqfumwq2OSbFqVysGF4bCp24fVS4d_B-Yo8xKVZ1hhTjpw_JTJPV7xJQWdl59_-qlykkBlNbva4ao3FN2sOgNMfiAk48Zk487chdlzPOXea7fh_8AbL5Q1wi7rrwKeN25yRNXW6o4BxToQaDU66h53ngR77nM9_jEfPCIUUYFyxEOaFsy23gk0xUor-L5EldVTK1BG_rf5LgxJNXAuIJYYcByU47KJl5HfRvj4-_Y7_5s5FYUbFgW1JHbIVqpWEjWtdYxImTMwZ3Nx3XTFa5bZtFGEcxKRF6_RsUTgku1utSpcKqmrxeozDrGotJtaLsbvkfxKYzpj2mS-4MmDMcvHv4O4LhcdK2-c5uwCPdvnz5DNtCBFHoRbeYf8wcQ78TEWQmMcDtGHU0ZK37BeXBiI3MyEHkM6oK9Nh7ZN-Wx3CuxmJNC14oKikzmc0xqgWNC21pHpQmmWtZSuoWbWaKLHMxNNzDZPFMwXEAWSlDU8QrlBMSqnvt9jNNIrumGI9fi4_GDk4LaAjmFNIc2LeFSgs40uubkcnKb4Y847MDBbFi92I4EFhcCeNweLj9qlken1fXldgRFI8Jjcc4WOzGC96GAq6fATziD_Y9lJriG5TvHPJ62SjIhsFQ9ESDQ5YeYZPGtA6rPNC9RpejD1ojKbDXY63rX1iB8BMjEMsOvkQBD8JeMQqiYdpnPOjHcT_MWCaSjA1k6A8x8RZJGPRKkcjSjFrjeSW30ELQQUbT3r_XQI0o9Znv9_1BGLHIS0V_MBT9YCHjdMHQXSGTK6HKQ73t6VELmTS5wc1SGWteNgWmWI4R2CqMGlplSzn6VMvEiSTR9RKn_Y8G_15rwKjV_m-aYYYN>53234</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
https://apt.llvm.org/llvm.sh is broken when given a single argument
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
thestr4ng3r
</td>
</tr>
</table>
<pre>
Since today, `llvm.sh` for the apt repositories results in an error when given a single argument like `./llvm.sh 13`:
```
/tmp/llvm-install.sh: line 40: $2: unbound variable
```
This makes sense since it starts with
```bash
set -eux
```
and later just accesses `$2` without checking `$#` right:
```bash
if [ "$#" -ge 1 ]; then
LLVM_VERSION=$1
if [ "$1" == "all" ]; then
# special case for ./llvm.sh all
LLVM_VERSION=$CURRENT_LLVM_STABLE
ALL=1
fi
LLVM_VERSION=$CURRENT_LLVM_STABLE
ALL=1
fi
if [ "$2" == "all" ]; then
# Install all packages
ALL=1
fi
fi
```
This currently breaks our CI, for example https://github.com/rizinorg/rizin/runs/4833534946?check_suite_focus=true
```
Run wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 13
wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 13
shell: /usr/bin/bash -e {0}
--2022-01-16 18:19:52-- https://apt.llvm.org/llvm.sh
Resolving apt.llvm.org (apt.llvm.org)... 151.101.250.49, 2a04:4e42:31::561
Connecting to apt.llvm.org (apt.llvm.org)|151.101.250.49|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4757 (4.6K) [application/octet-stream]
Saving to: ‘/tmp/llvm-install.sh’
0K .... 100% 54.5M=0s
2022-01-16 18:19:52 (54.5 MB/s) - ‘/tmp/llvm-install.sh’ saved [4757/4757]
+ CURRENT_LLVM_STABLE=13
+ needed_binaries=(lsb_release wget add-apt-repository)
+ missing_binaries=()
+ for binary in "${needed_binaries[@]}"
+ which lsb_release
+ for binary in "${needed_binaries[@]}"
+ which wget
+ for binary in "${needed_binaries[@]}"
+ which add-apt-repository
+ [[ 0 -gt 0 ]]
+ LLVM_VERSION=13
+ ALL=0
+ '[' 1 -ge 1 ']'
+ LLVM_VERSION=13
+ '[' 13 == all ']'
/tmp/llvm-install.sh: line 40: $2: unbound variable
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVltvqzgQ_jXkZQQCAyF5yEOTtNqq6emq7TmvkQEHfEIga5uk3V-_MyZJkzbttlJXWoTMxTPfXDy3tMmfRw-yzgSYJufPDpuA0_erarPydIlvsGgUmFIAXxtQYt1oaRolhcYP3VZGg6yB1yCUQsJtKWoo5AZXDlrWRYWMqmhXojZQyaUgcM9hVzsBEIT4wwkvHH_q-Bf03t3dJ7syq_WO2pW1NryqSK3wAsFqARGxgsMiRs-2Tpu2zmHDleRpJc5j2vWxlBpWfIlmaFFrQbqiC6QBlKHQqK005Sv-lOvdLy0MuKJ9OiuAowYVN0LB71Yb4FkmtEY5RECKoksJvGkNZKXIluik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