tools icon indicating copy to clipboard operation
tools copied to clipboard

🐛 Path normalization can normalize away all segments

Open parisholley opened this issue 6 years ago • 7 comments

Environment

Environment Variables
  Object {
    COLORFGBG: "15;0"
    COLORTERM: "truecolor"
    LANG: "en_US.UTF-8"
    TERM: "xterm-256color"
    TERM_PROGRAM: "iTerm.app"
  }

User Config
  unset

Rome Version
  10.0.4-beta

Node Version
  12.12.0

Platform
  darwin x64 19.5.0

Terminal Features
  Object {
    background: "dark"
    colorDepth: 24
    columns: 170
    cursor: true
    hyperlinks: true
    isTTY: true
    unicode: true
  }

Client Flags
  Object {
    clientName: "cli"
    cwd: "/Users/pholley/projects/photog-admin"
    realCwd: "/Users/pholley/projects/photog-admin"
    silent: false
  }

Server Status
  Object {
    projects: Array [
      Object {id: 0}
      Object {id: 1}
    ]
    server: Object {
      heapTotal: 25_755_648
      pid: 58_705
      uptime: 0.173907903
    }
    workers: Array [
      Object {
        astCacheSize: 0
        heapTotal: 25_755_648
        ownedBytes: 0
        ownedFileCount: 0
        pid: 58_705
        uptime: 0.173859949
      }
    ]
  }


Steps To Reproduce

./node_modules/.bin/rome check client

 project-rome/@internal/path/index.ts:823:8 internalError/request  INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Segments were normalized to an empty array. Original: ["file:..",".."]

  12. ___R$$priv$project$rome$$internal$path$index_ts$parsePathSegments (project-rome/@internal/path/index.ts:823:8)
  13. ___R$project$rome$$internal$path$index_ts$createUnknownFilePath (project-rome/@internal/path/index.ts:932:16)
  14. ___R$project$rome$$internal$codec$js$manifest$dependencies_ts$parseDependencyPattern (project-rome/@internal/codec-js-manifest/dependencies.ts:469:2)
  15. ___R$project$rome$$internal$codec$js$manifest$dependencies_ts$normalizeDependencies (project-rome/@internal/codec-js-manifest/dependencies.ts:515:16)
  16. ___R$project$rome$$internal$codec$js$manifest$index_ts$normalizeManifest (project-rome/@internal/codec-js-manifest/index.ts:678:19)
  17. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.declareManifestWithPossibleDiagnosticsThrow (
      project-rome/@internal/core/server/fs/MemoryFileSystem.ts:656:12)
  18. ___R$project$rome$$internal$diagnostics$wrap_ts$catchDiagnostics (project-rome/@internal/diagnostics/wrap.ts:29:16)
  19. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.declareManifest (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:627:24)
  20. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addFile (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:926:3)
  21. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:760:4)
  22. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:771:5)
  23. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  24. Function.all
  25. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  26. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  27. Function.all
  28. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  29. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.createWatcher (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:297:3)
  30. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.watch (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:537:23)
  31. ___R$project$rome$$internal$core$server$project$ProjectManager_ts$default.findProject (project-rome/@internal/core/server/project/ProjectManager.ts:891:5)
  and 11 others...

  ⚠ This diagnostic was derived from an internal Rome error. Potential bug, please report if necessary.

parisholley avatar Aug 13 '20 00:08 parisholley

had a similar issue in #990 (10.0.3-beta) now seeing this after #1027 (10.0.4-beta)

node version14.4.0

wlabranche avatar Aug 13 '20 05:08 wlabranche

This might have been fixed earlier, but should be gone for good with #1086. I want to confirm though, since ../.. should never be normalized away.

sebmck avatar Aug 16 '20 00:08 sebmck

Ran into this issue on 10.0.4-beta node version v12.18.3 after running rome init on existing project

 Welcome to Rome! Let's get you started... 

[1/2] Generating .editorconfig

project-rome/@internal/path/index.ts:823:8 internalError/request INTERNAL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Segments were normalized to an empty array. Original: ["file:..",".."]

  1. ___R$$priv$project$rome$$internal$path$index_ts$parsePathSegments (project-rome/@internal/path/index.ts:823:8)
  2. ___R$project$rome$$internal$path$index_ts$createUnknownFilePath (project-rome/@internal/path/index.ts:932:16)
  3. ___R$project$rome$$internal$codec$js$manifest$dependencies_ts$parseDependencyPattern ( project-rome/@internal/codec-js-manifest/dependencies.ts:469:2)
  4. ___R$project$rome$$internal$codec$js$manifest$dependencies_ts$normalizeDependencies ( project-rome/@internal/codec-js-manifest/dependencies.ts:515:16)
  5. ___R$project$rome$$internal$codec$js$manifest$index_ts$normalizeManifest ( project-rome/@internal/codec-js-manifest/index.ts:678:19)
  6. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default. declareManifestWithPossibleDiagnosticsThrow (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:656:12)
  7. ___R$project$rome$$internal$diagnostics$wrap_ts$catchDiagnostics ( project-rome/@internal/diagnostics/wrap.ts:29:16)
  8. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.declareManifest ( project-rome/@internal/core/server/fs/MemoryFileSystem.ts:627:24)
  9. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addFile ( project-rome/@internal/core/server/fs/MemoryFileSystem.ts:926:3)
  10. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:760:4)
  11. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory ( project-rome/@internal/core/server/fs/MemoryFileSystem.ts:771:5)
  12. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  13. Function.all
  14. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory ( project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  15. declareItem (project-rome/@internal/core/server/fs/MemoryFileSystem.ts:762:4)
  16. Function.all
  17. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.addDirectory ( project-rome/@internal/core/server/fs/MemoryFileSystem.ts:777:2)
  18. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.createWatcher ( project-rome/@internal/core/server/fs/MemoryFileSystem.ts:297:3)
  19. ___R$project$rome$$internal$core$server$fs$MemoryFileSystem_ts$default.watch ( project-rome/@internal/core/server/fs/MemoryFileSystem.ts:537:23)
  20. ___R$project$rome$$internal$core$server$project$ProjectManager_ts$default.findProject ( project-rome/@internal/core/server/project/ProjectManager.ts:891:5) and 9 others...

qw-in avatar Aug 24 '20 22:08 qw-in

We haven't done a release in a couple of weeks, I'll try and have one out today as it will fix a ton of issues like this.

sebmck avatar Aug 27 '20 16:08 sebmck

@sebmck Any update on cutting a release? I'm also running into this issue!

kysley avatar Sep 10 '20 21:09 kysley

Hey! Not at the moment, sorry 😢 I have had restricted time to work on Rome but it will stabilize in a couple of weeks. If another core contributor who is reading this is interested in cutting a release and writing a changelog then I can defer it to them and add the relevant permissions.

sebmck avatar Sep 10 '20 22:09 sebmck

This has been fixed on master

ematipico avatar May 20 '21 12:05 ematipico