Skip to content

[BUG] Output-File does not working correctly #145

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

Closed
Doxoh opened this issue Jun 26, 2024 · 5 comments · Fixed by #146
Closed

[BUG] Output-File does not working correctly #145

Doxoh opened this issue Jun 26, 2024 · 5 comments · Fixed by #146
Assignees
Labels
bug Something isn't working

Comments

@Doxoh
Copy link

Doxoh commented Jun 26, 2024

Describe the bug

By using >= 1.0.0-rc.7 the using of --output-file does not working anymore

To Reproduce

If you use version 1.0.0 or 1.0.0-rc.7 ir 1.0.0-rc.8 then with "yarn cyclonedx-yarn --prod --output-file sbom_yarn.json" it got an error message "Internal Error: ENOENT: no such file or directory, open 'C:\Code\ProjectX\C:\Code\ProjectX\sbom_yarn.json'"

Expected behavior

File has been placed at the desired location

Screenshots or output-paste

If applicable, add screenshots or past the output to help explain your problem.

Environment

  • @cyclonedx/yarn-plugin-cyclonedx version: >= 1.0.0-rc.7
  • yarn version: 4.1.1
  • Node version: v20.14.0
  • OS: windows 11

Additional context

Everything works perfectly with 1.0.0-rc.6

@Doxoh Doxoh added the bug Something isn't working label Jun 26, 2024
@Doxoh Doxoh changed the title [BUG] Output-File does not working [BUG] Output-File does not working correctly Jun 26, 2024
@jkowalleck
Copy link
Member

jkowalleck commented Jun 26, 2024

tried to reproduce

$ mkdir -p /tmp/hrkjwehrkjewr 
$ cd /tmp/hrkjwehrkjewr   
$ yarn set version 4.x
➤ YN0000: Retrieving https://repo.yarnpkg.com/4.3.1/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-4.3.1.cjs
➤ YN0000: Done in 1s 766ms
$ yarn init -y
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: · Done in 0s 110ms
$ yarn dlx -q @cyclonedx/yarn-plugin-cyclonedx@1.0.0 -vvv --output-file sbom.cdx.json
DEBUG | YARN_VERSION: [ 4, 3, 1 ]
DEBUG | options: {"specVersion":"1.5","outputFormat":"JSON","outputFile":"sbom.cdx.json","production":false,"mcType":"application","shortPURLs":false,"outputReproducible":false,"verbosity":4,"projectDir":"/tmp/hrkjwehrkjewr"}
INFO  | gathering project & workspace ...
DEBUG | project: /tmp/hrkjwehrkjewr
DEBUG | workspace: /tmp/hrkjwehrkjewr
LOG   | gathering BOM data ...
LOG   | serializing BOM ...
LOG   | writing BOM to: sbom.cdx.json
INFO  | wrote 1808 bytes to: sbom.cdx.json
$ cat sbom.cdx.json
{
  "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
  "bomFormat": "CycloneDX",
  "specVersion": "1.5",
  "version": 1,
  "serialNumber": "urn:uuid:50f5b1bf-c73a-4456-8e11-4f183344a0f8",
  "metadata": {
    "timestamp": "2024-06-26T19:53:56.470Z",
    "tools": [
      {
        "name": "yarn",
        "version": "4.3.1"
      },
      {
        "vendor": "@cyclonedx",
        "name": "yarn-plugin-cyclonedx",
        "version": "1.0.0+git.610d122",
        "externalReferences": [
          {
            "url": "git+https://github.com/CycloneDX/cyclonedx-node-yarn.git",
            "type": "vcs",
            "comment": "as detected from PackageJson property \"repository.url\""
          },
          {
            "url": "https://github.com/CycloneDX/cyclonedx-node-yarn#readme",
            "type": "website",
            "comment": "as detected from PackageJson property \"homepage\""
          },
          {
            "url": "https://github.com/CycloneDX/cyclonedx-node-yarn/issues",
            "type": "issue-tracker",
            "comment": "as detected from PackageJson property \"bugs.url\""
          }
        ]
      },
      {
        "vendor": "@cyclonedx",
        "name": "cyclonedx-library",
        "version": "6.10.0",
        "externalReferences": [
          {
            "url": "https://github.com/CycloneDX/cyclonedx-javascript-library#readme",
            "type": "website",
            "comment": "as detected from PackageJson property \"homepage\""
          }
        ]
      }
    ],
    "component": {
      "type": "application",
      "name": "hrkjwehrkjewr",
      "bom-ref": "hrkjwehrkjewr@workspace:.",
      "purl": "pkg:npm/hrkjwehrkjewr"
    }
  },
  "components": [],
  "dependencies": [
    {
      "ref": "hrkjwehrkjewr@workspace:."
    }
  ]
}⏎  

conclusion: cannot reproduce.

@Doxoh could you give a reproducible setup and detailed instructions how to reproduce?

@jkowalleck jkowalleck added the question Further information is requested label Jun 26, 2024
@jkowalleck
Copy link
Member

"Internal Error: ENOENT: no such file or directory, open 'C:\Code\ProjectX\C:\Code\ProjectX\sbom_yarn.json'"

this might indicate that there is no such folder C:\Code\ProjectX\C:\Code\ProjectX\ or that there is nor write permission to write to C:\Code\ProjectX\C:\Code\ProjectX\sbom_yarn.json.

did you check on this?

@jkowalleck jkowalleck removed the question Further information is requested label Jun 26, 2024
@jkowalleck
Copy link
Member

Oh, i see, the path join of C:\Code\ProjectX\C:\Code\ProjectX\sbom_yarn.json is broken.
for some reason.

this seams to be some weird windows glitch.
will check this as soon as i do have access to a windows environment.

@jkowalleck jkowalleck self-assigned this Jun 26, 2024
@jkowalleck
Copy link
Member

jkowalleck commented Jun 26, 2024

might be caused by #127
see v1.0.0-rc.6...v1.0.0-rc.7

maybe use npath instead of ppath ...

@jkowalleck
Copy link
Member

Thank you for the report, @Doxoh .

The issue should be sorted out in v1.0.1.

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

Successfully merging a pull request may close this issue.

2 participants