Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Add posix sh env script#9

Merged
gridbugs merged 1 commit intoocaml-dune:mainfrom
gridbugs:posix-shell-env-file
Aug 12, 2025
Merged

Add posix sh env script#9
gridbugs merged 1 commit intoocaml-dune:mainfrom
gridbugs:posix-shell-env-file

Conversation

@gridbugs
Copy link
Contributor

@gridbugs gridbugs commented Aug 8, 2025

This amounted taking the bash env script and removing its use of the local keyword and changing is extension to ".sh".

This allows the dune binary distro to be used on machines with minimal shells such as the ash shell in the default environment on alpine linux.

Also adds a test that runs shellcheck on env.sh to make sure it stays posix-compatible.

@gridbugs gridbugs requested a review from Sudha247 August 8, 2025 06:06
@gridbugs gridbugs force-pushed the posix-shell-env-file branch from 8ccd026 to 633255a Compare August 8, 2025 07:44
@gridbugs gridbugs changed the title Make bash env script posix-compatible Add posix sh env script Aug 8, 2025
@gridbugs gridbugs force-pushed the posix-shell-env-file branch 2 times, most recently from 270efae to 27a45ab Compare August 8, 2025 07:46
Comment on lines +16 to +17
# exclude warning for sourcing missing external file
shellcheck --exclude=SC1091 extra/share/dune/env/env.sh extra/share/dune/env/env.bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the warning be excluded rather in the script itself, to also spare devs the noise locally? Or is there a reason for a disparity between the dev environment and what the CI sees?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize that was a possibility. Will update!

This amounted taking the bash env script and removing its use of the
`local` keyword and changing is extension to ".sh". The posix env script
also doesn't source the bash completion script as it uses some
bash-specific features.

This allows the dune binary distro to be used on machines with minimal
shells such as the ash shell in the default environment on alpine linux.

Also adds a test that runs shellcheck on env.sh to make sure it stays
posix-compatible.

Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
@gridbugs gridbugs force-pushed the posix-shell-env-file branch from 27a45ab to 5b45399 Compare August 12, 2025 03:08
@gridbugs gridbugs merged commit 30090e2 into ocaml-dune:main Aug 12, 2025
2 checks passed
@gridbugs gridbugs deleted the posix-shell-env-file branch August 12, 2025 03:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants