From d1711699d4d4f397b89491546fe2c7ad22da7203 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sat, 25 Nov 2023 13:40:52 -0800 Subject: [PATCH] Opportunistically use pipefail --- scripts/compress.sh | 1 + scripts/connectivity-check.sh | 4 ++++ scripts/copy-file-to-xhtml.sh | 1 + scripts/curl-wrapper.sh | 5 ++++- scripts/get-webmentions.sh | 1 + scripts/populate-webrings.sh | 3 +++ scripts/setup-ci.sh | 2 ++ scripts/xhtmlize-single-file.sh | 2 ++ scripts/xhtmlize.sh | 1 + 9 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/compress.sh b/scripts/compress.sh index c9bdd22..6b68660 100644 --- a/scripts/compress.sh +++ b/scripts/compress.sh @@ -5,6 +5,7 @@ # 2. "gzip" or "brotli" # 3. ECT zopfli compression level +# no pipefail here since there are no pipes. set -e -u output_dir="$1" diff --git a/scripts/connectivity-check.sh b/scripts/connectivity-check.sh index 07cd3a3..c1e1f01 100644 --- a/scripts/connectivity-check.sh +++ b/scripts/connectivity-check.sh @@ -1,4 +1,8 @@ #!/bin/sh +# Ensure that we can connect to seirdy.one, and print the ipv4/ipv6 addresses used. The latter makes searching through my server logs easier. +# Return a bad exit code if we can't connect over either ipv4 or ipv6. + +# no pipefail here since there are no pipes. set -e -u ipv6_success=1 diff --git a/scripts/copy-file-to-xhtml.sh b/scripts/copy-file-to-xhtml.sh index 7a635a0..7e3cb69 100644 --- a/scripts/copy-file-to-xhtml.sh +++ b/scripts/copy-file-to-xhtml.sh @@ -2,6 +2,7 @@ # Take a single polygot (X)HTML file and make a .xhtml copy of it. Do # the same for static-compressed versions. +# no pipefail here since there are no pipes. set -e -u html_file="$1" diff --git a/scripts/curl-wrapper.sh b/scripts/curl-wrapper.sh index e24d1fb..50ddb90 100755 --- a/scripts/curl-wrapper.sh +++ b/scripts/curl-wrapper.sh @@ -1,3 +1,6 @@ #!/bin/sh # a curl wrapper for seirdy.one -curl --proto "=https" --tlsv1.3 --cert-status -sS -m${SEIRDYONE_CURL_TIMEOUT-10} "$@" +# no pipefail here since there are no pipes. + +set -e -u +curl --proto "=https" --tlsv1.3 --cert-status -sS -m"${SEIRDYONE_CURL_TIMEOUT-10}" "$@" diff --git a/scripts/get-webmentions.sh b/scripts/get-webmentions.sh index 6deff0f..837770e 100644 --- a/scripts/get-webmentions.sh +++ b/scripts/get-webmentions.sh @@ -4,6 +4,7 @@ # Uses POSIX and cURL in CI, also uses any pass/pash-compatible pwmngr otherwise # The response is cached for 90 minutes. If fetching fresh webmentions fails, fall back to the cached version for up to one day (1440 minutes). If cached webmentions are older than a day, error out. +# no pipefail here since there are no pipes. set -e -u dirname="$(dirname "$0")" diff --git a/scripts/populate-webrings.sh b/scripts/populate-webrings.sh index f754a7e..f60865f 100755 --- a/scripts/populate-webrings.sh +++ b/scripts/populate-webrings.sh @@ -6,6 +6,9 @@ # first-party HTML+CSS page. This script fetches webring links by # parsing the iframes and appends appropriate values to my webrings.csv file. +#shellcheck disable=SC3040 # This only sets pipefail if it's available (e.g. in Bash, Zsh) and otherwise does nothing (in other POSIX shells like Busybox sh and dash) +set -o pipefail 2>/dev/null + set -e -u # the name of this program diff --git a/scripts/setup-ci.sh b/scripts/setup-ci.sh index e4230ae..a1f9461 100644 --- a/scripts/setup-ci.sh +++ b/scripts/setup-ci.sh @@ -1,6 +1,8 @@ #!/bin/sh # For CI: configures SSH and installs binaries that I use to build my site. # The binaries are statically-linked for Linux on x86_64 + +# no pipefail here since there are no pipes. set -e -u # configure ssh diff --git a/scripts/xhtmlize-single-file.sh b/scripts/xhtmlize-single-file.sh index 325b489..e6374a4 100644 --- a/scripts/xhtmlize-single-file.sh +++ b/scripts/xhtmlize-single-file.sh @@ -13,6 +13,8 @@ # with sed. # It also decreases indents by one level +#shellcheck disable=SC3040 # This only sets pipefail if it's available and otherwise does nothing +set -o pipefail 2>/dev/null || true set -e -u html_file="$1" diff --git a/scripts/xhtmlize.sh b/scripts/xhtmlize.sh index 263ab0d..796fd37 100644 --- a/scripts/xhtmlize.sh +++ b/scripts/xhtmlize.sh @@ -3,6 +3,7 @@ # Runs xhtmlize-single-file.sh on every single html file in the output dir. # exits if xhtmlize-single-file fails. +# no pipefail here since there are no pipes. set -e -u output_dir="$1"