diff options
author | psykose <alice@ayaya.dev> | 2022-06-28 10:03:30 +0000 |
---|---|---|
committer | psykose <alice@ayaya.dev> | 2022-06-28 12:03:30 +0200 |
commit | ab67ab0733c2fd5bf0f8272f2ef65aee71984cc3 (patch) | |
tree | 58f189d0631bc263e19a9966139a87ab08954060 | |
parent | 2b6126d614658955a358aa8ed78c40af896121e2 (diff) | |
download | alpine-conf-ab67ab0733c2fd5bf0f8272f2ef65aee71984cc3.zip |
setup-proxy: fix empty proxy
the while loop loops until the value of proxyurl is none or a http*://
scheme. however, when proxyurl is set to 'none', it then gets unset here
(`proxyurl= ;`), but the following `if` block checks if it is 'none' and
fails, so we configure an empty http_proxy= in the proxy.sh profile
script. this is then read by some software, and it causes it to crash.
for instance, flatpak via glib reads `http_proxy` from the environment,
and an empty variable is illegal.
-rw-r--r-- | setup-proxy.in | 2 | ||||
-rwxr-xr-x | tests/setup_proxy_test | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/setup-proxy.in b/setup-proxy.in index 115076b..0c1d14c 100644 --- a/setup-proxy.in +++ b/setup-proxy.in @@ -41,7 +41,7 @@ suggest=${http_proxy:-none} while [ $# -eq 0 ]; do case "$proxyurl" in http://*|https://*) break;; - none) proxyurl= ; break;; + none) break;; esac ask "HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none')" $suggest proxyurl=$resp diff --git a/tests/setup_proxy_test b/tests/setup_proxy_test index d0da07b..e825796 100755 --- a/tests/setup_proxy_test +++ b/tests/setup_proxy_test @@ -4,7 +4,8 @@ init_tests \ setup_proxy_usage \ setup_proxy_url \ - setup_proxy_none + setup_proxy_none \ + setup_proxy_interactive_none setup_proxy_usage_body() { test_usage setup-proxy @@ -35,3 +36,18 @@ setup_proxy_none_body() { fi } +setup_proxy_interactive_none_body() { + init_env + + mkdir -p etc/profile.d + touch etc/profile.d/proxy.sh + + echo none | atf_check -s exit:0 \ + -o match:"HTTP/FTP proxy URL" \ + -e empty \ + setup-proxy + + if test -e etc/profile.d/proxy.sh; then + atf_fail "etc/profile.d/proxy.sh was not removed" + fi +} |