Skip to content

Fix check-docs.sh failing on macOS when an option has no values - #320

Open
jakepetroules wants to merge 1 commit into
swiftlang:mainfrom
jakepetroules:check-docs-bash32
Open

jakepetroules wants to merge 1 commit into
swiftlang:mainfrom
jakepetroules:check-docs-bash32

Conversation

@jakepetroules

Copy link
Copy Markdown
Contributor

The macOS documentation check always fails immediately:

check-docs.sh: line 68: collected[*]: unbound variable

soundness.yml always passes --additional-docc-arguments ${ADDITIONAL_DOCC_ARGUMENTS}, so when no additional arguments are configured the option is passed with no values and collected stays empty. macOS runners use /bin/bash 3.2, where expanding an empty array under set -u is treated as an unbound variable (bash 4.4+ allows it), so the script exits before building any documentation. The Linux docs check isn't affected because its container has a newer bash.

--doc-targets has the same problem, so this changes both expansions to "${collected[*]:-}".

Tested locally with macOS /bin/bash 3.2.57 against a package:

  • check-docs.sh --additional-docc-arguments (the default CI invocation): previously failed with the error above, now passes
  • check-docs.sh --no-analyze --doc-targets --additional-docc-arguments: passes
  • check-docs.sh --doc-targets <target> --additional-docc-arguments --include-extended-types: values are still forwarded to generate-documentation, passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant