Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3.1.0 does not work on Alpine Linux #75

Closed
bartlomiejgawel opened this issue Mar 8, 2023 · 2 comments
Closed

Version 3.1.0 does not work on Alpine Linux #75

bartlomiejgawel opened this issue Mar 8, 2023 · 2 comments
Assignees
Labels
bug Something isn't working regression

Comments

@bartlomiejgawel
Copy link
Contributor

bartlomiejgawel commented Mar 8, 2023

Hello,

I've noticed a regression introduced with version 3.1.0.

You can reproduce it in the following way:

  1. Clone https://github.com/bartlomiejgawel/dotnet-affected-bug
  2. Create a docker image and install version 3.0.0 by running the following command:
docker build -f Dockerfile -t dotnet-affected-3.0.0-alpine .

for the following Dockerfile file:

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine

RUN dotnet tool install dotnet-affected --global --version 3.0.0

ENV PATH "$PATH:/root/.dotnet/tools"
  1. Create a docker image and install version 3.1.0 by running the following command:
docker build -f Dockerfile -t dotnet-affected-3.1.0-alpine .

for the following Dockerfile file:

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine

RUN dotnet tool install dotnet-affected --global --version 3.1.0

ENV PATH "$PATH:/root/.dotnet/tools"
  1. Run the following command:
docker run --rm -v "$(pwd):/src" -w /src dotnet-affected-3.0.0-alpine /bin/sh -c "dotnet affected --from b4d7eab --to 71b0a49"

You can see that it works smoothly and creates an affected.proj file as expected.

  1. Run the following command:
docker run --rm -v "$(pwd):/src" -w /src dotnet-affected-3.1.0-alpine /bin/sh -c "dotnet affected --from b4d7eab --to 71b0a49"

You can see that it exits with status code 139.

Notice that standard dotnet SDK works correctly (also outside the container on Windows):

  1. Create a docker image and install version 3.1.0 by running the following command:
docker build -f Dockerfile -t dotnet-affected-3.1.0 .

for the following Dockerfile file:

FROM mcr.microsoft.com/dotnet/sdk:6.0

RUN dotnet tool install dotnet-affected --global --version 3.1.0

ENV PATH "$PATH:/root/.dotnet/tools"
  1. Run the following command:
docker run --rm -v "$(pwd):/src" -w /src dotnet-affected-3.1.0 /bin/sh -c "dotnet affected --from b4d7eab --to 71b0a49"

You can see that it works smoothly and creates an affected.proj file as expected.

I've checked what's changed between 3.0.0 and 3.1.0:
v3.0.0...v3.1.0

And maybe one of the updated packages caused this regression?

@leonardochaia
Copy link
Owner

Hi @bartlomiejgawel , thanks for reaching out.

Thanks for the Dockerfiles, I can confirm I can reproduce the issue with v3.1 but does not happen on 3.0

And maybe one of the updated packages caused this regression?

Most likely yes.

I managed to get this output:

Unhandled exception. System.TypeInitializationException: The type initializer for 'Affected.Cli.Program' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'hostfxr' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library libhostfxr: No such file or directory
   at Microsoft.Build.Locator.NativeMethods.hostfxr_resolve_sdk2(String exe_dir, String working_dir, hostfxr_resolve_sdk2_flags_t flags, hostfxr_resolve_sdk2_result_fn result)
   at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetDotNetBasePaths(String workingDirectory)+MoveNext()
   at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetInstances(String workingDirectory)+MoveNext()
   at Microsoft.Build.Locator.MSBuildLocator.GetInstances(VisualStudioInstanceQueryOptions options)+MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults()
   at Affected.Cli.Program..cctor() in /_/src/dotnet-affected/Program.cs:line 12
   --- End of inner exception stack trace ---
   at Affected.Cli.Program.<Main>(String[] args)
Aborted (core dumped)

I'll keep troubleshooting during the day and report back.

Stay on 3.0 if possible until this is fixed 👍

@leonardochaia leonardochaia self-assigned this Mar 8, 2023
@leonardochaia leonardochaia added bug Something isn't working regression labels Mar 8, 2023
@leonardochaia leonardochaia pinned this issue Mar 8, 2023
leonardochaia added a commit that referenced this issue Mar 9, 2023
Fixes Version 3.1.0 does not work on Alpine Linux #75
@leonardochaia
Copy link
Owner

Hi @bartlomiejgawel , I have narrowed this down to Microsoft.Build.Locator.
Downgrading to Microsoft.Build.Locator v1.4.1 solves the issue.
I'll release dotnet-affected v3.1.1 with the fix.

@leonardochaia leonardochaia unpinned this issue Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

No branches or pull requests

2 participants