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

mod failed due to calculating has of non go file #201

Open
rucciva opened this issue Oct 12, 2022 · 8 comments
Open

mod failed due to calculating has of non go file #201

rucciva opened this issue Oct 12, 2022 · 8 comments
Labels
bug Something isn't working triage:needs-reproducer

Comments

@rucciva
Copy link

rucciva commented Oct 12, 2022

Command:

cyclonedx-gomod mod -verbose

Error:

....
1:33AM DBG skipping license detection module=golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c
1:33AM DBG converting module to component module=golang.org/x/sys@v0.0.0-20220209214540-3681064d5158
1:33AM DBG skipping license detection module=golang.org/x/sys@v0.0.0-20220209214540-3681064d5158 reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/sys@v0.0.0-20220209214540-3681064d5158
1:33AM DBG converting module to component module=golang.org/x/text@v0.3.7
1:33AM DBG skipping license detection module=golang.org/x/text@v0.3.7 reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/text@v0.3.7
1:33AM DBG converting module to component module=golang.org/x/time@v0.0.0-20210723032227-1f47c861a9ac
1:33AM DBG skipping license detection module=golang.org/x/time@v0.0.0-20210723032227-1f47c861a9ac reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/time@v0.0.0-20210723032227-1f47c861a9ac
1:33AM DBG converting module to component module=golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1
1:33AM DBG skipping license detection module=golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1
1:33AM DBG converting module to component module=google.golang.org/api@v0.70.0
1:33AM DBG skipping license detection module=google.golang.org/api@v0.70.0 reason="no detector provided"
1:33AM DBG calculating module hash module=google.golang.org/api@v0.70.0
1:33AM DBG converting module to component module=google.golang.org/appengine@v1.6.7
1:33AM DBG skipping license detection module=google.golang.org/appengine@v1.6.7 reason="no detector provided"
1:33AM DBG calculating module hash module=google.golang.org/appengine@v1.6.7
{"level":"error","error":"failed to convert modules: failed to calculate module hash: open /.env.development: no such file or directory","time":"2022-10-12T01:33:05Z"}
@nscuro
Copy link
Member

nscuro commented Nov 3, 2022

Hey @rucciva, thanks for reporting!

And sorry for the long wait. This error is very odd, and I can't reproduce it with any setup so far. Would it be possible to provide a minimal example project that triggers this error?

@rucciva
Copy link
Author

rucciva commented Nov 4, 2022

hi @nscuro , no problem.

Unfortunately the repo is private so i can't share it.

But, i tried running go mod tidy first before running cyclonedx-gomod mod -verbose and its working fine. Attached are the changes on go.mod and go.sum. Maybe it can give some clue?

Screen Shot 2022-11-04 at 08 54 43

Screen Shot 2022-11-04 at 08 55 51

@Aaronzinhoo
Copy link

Aaronzinhoo commented Jan 27, 2023

I am experiencing a similar issue on a private repo as well. I will try your fix @rucciva and see if it works. I can provide the packages I am using if that helps as well @nscuro

@nscuro
Copy link
Member

nscuro commented Jan 27, 2023

@Aaronzinhoo Thanks, if you could provide a minimal Go project that triggers this behavior, that would make reproducing it a lot easier.

@nscuro nscuro added bug Something isn't working triage:needs-reproducer labels Aug 3, 2023
@nluzgin
Copy link

nluzgin commented Feb 9, 2024

Got the same output with -verbose
can i help somehow?

I have a go mod graph out, go.mod and go.sum

@nscuro
Copy link
Member

nscuro commented Feb 9, 2024

@nluzgin The biggest help would be providing a simple reproducer project, or instructions to reproduce it reliably.

@nluzgin
Copy link

nluzgin commented Feb 27, 2024

@nscuro sorry, i'm lost in time

My repo is private too, but i think i found the way to reproduce.

in "wat.zip" impersonal sample of code with .git folder, which seems a problem one:
ERR error="failed to convert modules: failed to calculate module hash: open /.git/FETCH_HEAD: no such file or directory"

wat.zip
gitlab_out.txt

@nluzgin
Copy link

nluzgin commented Feb 27, 2024

Anyway it seems like a some missed check before starting calculate hashes.
As idea:

  1. add .git folder to default "exclude list" (not sure about this)
  2. add an option to exclude some files or folders (or i miss this?)
  3. check file existence before any action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage:needs-reproducer
Projects
None yet
Development

No branches or pull requests

4 participants