Skip to content

Unable to open file from source archive #1008

Open
@arkq

Description

@arkq

Describe the bug

It is not possible to open files from the codeql source archive.

The codeql database was created locally with codeql CLI like follows:

cmake -B build -DCMAKE_VERBOSE_MAKEFILE=ON $PWD
codeql database init --overwrite --language=cpp --source-root=$PWD codeql-db
codeql database trace-command codeql-db --working-dir=$PWD/build -- make
codeql database finalize codeql-db

Then, the DB was added to the codeQL VSCode extension as "From a folder". In the codeql-db directory there is a file src.zip (seen in the screenshot). However, when I try to open a file (by clicking on it in the explorer), I've got an error message which says: "Unable to open 'example.cpp (read-only)': Unable to read file 'codeql-zip-archive://0-52/home/a.bokowy/codeql-presentation/codeql-db/src.zip/home/a.bokowy/codeql-presentation/example.cpp' (TypeError: Cannot read property 'pipes' of undefined)." The strange thing though is the 0-52 before the /home in the codeql-zip-archive URI.

codeql-unable-to-open-db-file

It's also not possible to open the location of the query by clicking on the file name in the CodeQL Query Result explorer.

codeql-query-works

Version

Version: 1.59.0 (system setup)
Commit: 379476f0e13988d90fab105c5c19e7abc8b1dea8
Date: 2021-08-04T23:13:12.822Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19042

CodeQL extension version: 1.5.6
CodeQL CLI version: 2.7.1
Platform: linux x64

Expected behavior
Be able to open files from source archive.

Additional info
The strange thing is, that "sometimes" I am able to add database source to the explorer, so I'm able to open files, see query results and browse AST. I don't know how to reproduce the correct behavior, though. I've tried various things, like removing codeQL database from VSCode, restarting VSCode and then adding codeQL DB once more, etc. None of these attempts has resulted in successful outcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    VSCodebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions