Skip to content

Commit

Permalink
Merge pull request #2955 from github/kaspersv/hash-result-set-in-bqrs…
Browse files Browse the repository at this point in the history
…-filename

Hash result set name in sorted result set path
  • Loading branch information
kaspersv authored Oct 12, 2023
2 parents d15c57e + ee5b738 commit 8ecc31f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [UNRELEASED]

- Sorted result set filenames now include a hash of the result set name instead of the full name. [#2955](https://github.com/github/vscode-codeql/pull/2955)

## 1.9.2 - 12 October 2023

- Fix a bug where the query to Find Definitions in database source files would not be cancelled appropriately. [#2885](https://github.com/github/vscode-codeql/pull/2885)
Expand Down
8 changes: 7 additions & 1 deletion extensions/ql-vscode/src/run-queries-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { BaseLogger, showAndLogWarningMessage } from "./common/logging";
import { extLogger } from "./common/logging/vscode";
import { generateSummarySymbolsFile } from "./log-insights/summary-parser";
import { getErrorMessage } from "./common/helpers-pure";
import { createHash } from "crypto";

/**
* run-queries.ts
Expand Down Expand Up @@ -150,7 +151,12 @@ export class QueryEvaluationInfo extends QueryOutputDir {
};
}
getSortedResultSetPath(resultSetName: string) {
return join(this.querySaveDir, `sortedResults-${resultSetName}.bqrs`);
const hasher = createHash("sha256");
hasher.update(resultSetName);
return join(
this.querySaveDir,
`sortedResults-${hasher.digest("hex")}.bqrs`,
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe("query-results", () => {
const expectedResultsPath = join(queryPath, "results.bqrs");
const expectedSortedResultsPath = join(
queryPath,
"sortedResults-a-result-set-name.bqrs",
"sortedResults-cc8589f226adc134f87f2438e10075e0667571c72342068e2281e0b3b65e1092.bqrs",
);
expect(spy).toBeCalledWith(
expectedResultsPath,
Expand Down

0 comments on commit 8ecc31f

Please sign in to comment.