question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't compile F# projects on microsoft/dotnet:2.1-sdk-alpine (bash dependency)

See original GitHub issue

Steps to reproduce

docker run --rm microsoft/dotnet:2.1-sdk-alpine /usr/share/dotnet/sdk/2.1.301/FSharp/RunFsc.sh

Expected behavior

The F# compiler runs on published SDK image. A couple of simple solutions are:

  • install bash on the Alpine SDK image
  • change the shell script to not be bash specific
docker run --rm microsoft/dotnet:2.1-sdk-alpine sh /usr/share/dotnet/sdk/2.1.301/FSharp/RunFsc.sh
/usr/share/dotnet/sdk/2.1.301/FSharp/RunFsc.sh: line 9: syntax error: bad substitution

Actual behavior

env: can't execute 'bash': No such file or directory

I can’t build any F# projects without installing bash first. Workaround:

docker run --rm microsoft/dotnet:2.1-sdk-alpine sh -c "apk update; apk add bash; /usr/share/dotnet/sdk/2.1.301/FSharp/RunFsc.sh"

Environment data

dotnet --info output:

cc @KevinRansom

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Jun 24, 2018

that would need work in roslyn for csharp and vb

@livarcocc, can you point to those scripts in roslyn? I think it used to be through scripts, RunCsc and RunVb, but not anymore?

@svick, we don’t need to write in Almquist shell Alpine. If the scripts are written in Unix/Bourne Shell with shebang #!/usr/bin/env sh, that just works in all distros of BSD, Linux, Mac, Solaris.


That is one of the reasons why many utilities out there such as npm use Unix/Bourne shell instead of bash. In .NET repos, bashism is a normal trait probably because it saves 10-15 minutes of figuring-out and coding time from devs who are new to Unix shells. It is also really a very poor excuse to shove bash down the throats of all consumers, even those who made a choice to use other shells. So please, do consider spending some time and updating the scripts (at least those that are shipped with product and related to runtime) to the common denominator, Unix Shell.

- #!/usr/bin/env bash
+ #!/usr/bin/env sh

... and then some changes in the file ...
... it is hard at first, then gets easier ...
... everything that is possible in bash is possible in sh with bit of an effort ...

This is really a thing to invest time on when you have widespread library/product. There are people in .NET who are trying to reduce amount of dependencies, this could be categories under that epic.

Then there are scripts under github.com/dotnet, that are fully Unix Shell compatible, but yet having bash shebang on the top… This shows lack of interest/awareness.

At least effort could be started by avoiding bash in new scripts (in dotnet/arcade for example)…

re: https://github.com/Microsoft/omi/issues/497

cc @Petermarcu, @weshaggard

1reaction
ctaggartcommented, Jun 22, 2018

We want the 2.1-runtime-alpine as slim as possible. We don’t care if 2.1-sdk-alpine grows in size to accommodate a bash install. We do want the tools to work out of the box. Please add bash to the sdk until product removes it is a dependency.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install the .NET SDK or the .NET Runtime on Alpine
NET is supported on Alpine and this article describes how to install . ... To install the .NET SDK, run the following command:...
Read more >
Running ASP.NET Core in an Alpine Linux Docker Container
The error here is that the debian docker image we are using doesn't have the nightly version of the 2.1 runtime installed and...
Read more >
alpine docker image with dotnet doesn't see my app
I found the problem. Alpine Linux uses musl c library and it makes standard dotnet build incompatible with this linux distro.
Read more >
Building, running, and managing containers
Red Hat Enterprise Linux 8 provides a number of command-line tools for working with container images. You can manage pods and container images...
Read more >
BusyBox.net
Some parts won't compile (not all kernel headers are present, libc API different or incomplete, etc). The maximal config which did compile is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found