konveyor / analyzer-lsp

Add-on that is focused on providing analysis based on the Language Server Protocol.
Apache License 2.0
12 stars 45 forks source link

[BUG] Analysis for .NET HelloWorld app fails with permissions error #587

Closed abrugaro closed 6 months ago

abrugaro commented 6 months ago

Is there an existing issue for this?

Konveyor version

latest

Priority

Undefined (Default)

Current Behavior

When trying to analyze the HelloWorld example application following the steps defined here, I get the following error:

Where I run the analysis:

abrugaro@fedora:~/analyzer-lsp$ go run cmd/analyzer/main.go \
    --provider-settings external-providers/dotnet-external-provider/examples/HelloWorld/provider-settings-example.json \
    --rules external-providers/dotnet-external-provider/examples/HelloWorld/rule-example.yaml

UNKN[0000] rules parsed                                  logger=parser parsed=1
ERRO[0000] unable to load rule set                       error="stat external-providers/dotnet-external-provider/examples/HelloWorld/ruleset.yaml: no such file or directory" logger=parser
ERRO[0000] Error inside ProviderInit, after g.Init.      error="chdir /home/abrugaro/analyzer-lsp/external-providers/dotnet-external-provider/examples/HelloWorld: permission denied" logger=dotnet provider=grpc
ERRO[0000] unable to init the providers                  error="chdir /home/abrugaro/analyzer-lsp/external-providers/dotnet-external-provider/examples/HelloWorld: permission denied" provider=dotnet
exit status 1

In the running podman container:

ERRO[0043] failed to start language server process       client=2637543189119697618 error="chdir /home/abrugaro/analyzer-lsp/external-providers/dotnet-external-provider/examples/HelloWorld: permission denied" provider=dotnet

It says permission denied in both places but I can't locate where exactly is the permissions issue.

Expected Behavior

The analysis should complete successfully and generate the output.yaml file as defined in the Readme.

How Reproducible

Always (Default)

Steps To Reproduce

Follow the steps defined here

Environment

Provider Image:

REPOSITORY                                                       TAG         DIGEST
quay.io/konveyor/dotnet-external-provider                        latest      sha256:ca0d657b9ac49b301e4e4ee65e24a41a7fafc70bed0f73f7643e2a75b77cf9c6 

Provider settings:

[
    {
        "name": "dotnet",
        "address": "localhost:41023",
        "initConfig": [{
            "location": "/home/abrugaro/analyzer-lsp/external-providers/dotnet-external-provider/examples/HelloWorld",
            "providerSpecificConfig": {
                "lspServerPath": "/opt/app-root/.dotnet/tools/csharp-ls"
            }
        }]
    }
]

Anything else?

No response

konveyor-ci-bot[bot] commented 6 months ago

This issue is currently awaiting triage. If contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance. The triage/accepted label can be added by org members.

djzager commented 6 months ago

Is it possible @abrugaro that you need to deal with SELinux? Looking at this stack overflow answer it appears that it would look something like:

podman run -it --rm -P -u 1000:1000 \
    -v $PWD/external-providers/dotnet-external-provider/examples/:$PWD/external-providers/dotnet-external-provider/examples/:z \
    quay.io/konveyor/dotnet-external-provider:latest

Can you confirm?

abrugaro commented 6 months ago

Hi @djzager you were right, now the analysis completed successfully, it could be beneficial to mention the SELinux possible issue in the README file.

On the other hand, I got this error in the analsysis output, I don't know if that's expected.

ERRO[0000] unable to load rule set                       error="stat external-providers/dotnet-external-provider/examples/HelloWorld/ruleset.yaml: no such file or directory" logger=parser

Full output:

UNKN[0000] rules parsed                                  logger=parser parsed=1
ERRO[0000] unable to load rule set                       error="stat external-providers/dotnet-external-provider/examples/HelloWorld/ruleset.yaml: no such file or directory" logger=parser
UNKN[0002] All rules added buffer, waiting for engine to complete  size=1
UNKN[0002] taking rule                                   rule=dotnet-lang-ref-example-001 ruleset=konveyor-analysis worker=4
UNKN[0003] finished rule                                 error=null found=1 rule=dotnet-lang-ref-example-001 worker=4
INFO[0003] rule returned                                 rule=dotnet-lang-ref-example-001
UNKN[0003] rule response received                        failed=0 matched=1 total=1 unmatched=0
TRAC[0003] done processing all the rules                
UNKN[0003] rule engine stopping                         
UNKN[0003] stopping rule worker                          worker=1
UNKN[0003] stopping rule worker                          worker=4
UNKN[0003] stopping rule worker                          worker=0
UNKN[0003] stopping rule worker                          worker=9
UNKN[0003] stopping rule worker                          worker=8
UNKN[0003] stopping rule worker                          worker=7
UNKN[0003] stopping rule worker                          worker=5
UNKN[0003] stopping rule worker                          worker=6
UNKN[0003] stopping rule worker                          worker=3

If its expected, this issue can be closed, thanks!