sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Update Documentation to fix issues when running `zsh`

Open dellis1972 opened this issue 1 year ago • 2 comments

When trying to use the sdk on macOS via source ./eng/dogfood.sh we get the following output.

./eng/dogfood.sh:.:12: no such file or directory: ~/Documents/Sandbox/DotNet/sdk/common/tools.sh
./eng/dogfood.sh:.:13: no such file or directory: ~/Documents/Sandbox/DotNet/sdk/configure-toolset.sh
./eng/dogfood.sh:14: command not found: InitializeToolset
./eng/dogfood.sh:.:15: no such file or directory: ~/Documents/Sandbox/DotNet/sdk/restore-toolset.sh
./eng/dogfood.sh:17: command not found: ReadGlobalVersion
ls: /bin/redist//dotnet/sdk: No such file or directory

This is because the use of BASH_SOURCE[0] does not work in zsh and the #!/usr/bin/env bash does not seem to be launching a bash shell. Rather than change the script to not use BASH_SOURCE[0] just update the documentation so that Mac users are aware they need to use the correct shell.

dellis1972 avatar Jun 19 '24 07:06 dellis1972

Thanks for the clarification @dellis1972 - @marcpopMSFT who owns the dogfood script? We should make sure it runs on bash and zsh - those are the two most widely used shells on the macOS and Linux platforms.

baronfel avatar Jun 21 '24 13:06 baronfel

Thanks for the clarification @dellis1972 - @marcpopMSFT who owns the dogfood script? We should make sure it runs on bash and zsh - those are the two most widely used shells on the macOS and Linux platforms.

It's in the eng folder so we own it but the .sh file hasn't been modified in 3 years so I doubt folks have a lot of context on it.

marcpopMSFT avatar Jun 21 '24 16:06 marcpopMSFT

This is because the use of BASH_SOURCE[0] does not work in zsh and the #!/usr/bin/env bash does not seem to be launching a bash shell.

That's because when you source a script as opposed to running it you're basically just reading the text content and evaluating it in the current shell so the shebang has no effect there.

Ideally we'd not rely on bashisms for these scripts but this would need to be fixed recursively in all scripts sourced by dogfood.sh (tools.sh, configure-toolset.sh, restore-toolset.sh, etc) so I think the doc update is fine for now.

akoeplinger avatar Jul 08 '24 11:07 akoeplinger