Skip to content

Commit c5ed96b

Browse files
committed
Merge branch 'main' into redsun82/bzlmod
2 parents 2cc762b + f2e04c0 commit c5ed96b

File tree

165 files changed

+713
-657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+713
-657
lines changed

cpp/ql/lib/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.12.6
2+
3+
### New Features
4+
5+
* A `getInitialization` predicate was added to the `RangeBasedForStmt` class that yields the C++20-style initializer of the range-based `for` statement when it exists.
6+
17
## 0.12.5
28

39
### New Features
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
---
2-
category: feature
3-
---
1+
## 0.12.6
2+
3+
### New Features
4+
45
* A `getInitialization` predicate was added to the `RangeBasedForStmt` class that yields the C++20-style initializer of the range-based `for` statement when it exists.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.12.5
2+
lastReleaseVersion: 0.12.6

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 0.12.6-dev
2+
version: 0.12.7-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

cpp/ql/src/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 0.9.5
2+
3+
### Minor Analysis Improvements
4+
5+
* The "non-constant format string" query (`cpp/non-constant-format`) has been updated to produce fewer false positives.
6+
* Added dataflow models for the `gettext` function variants.
7+
18
## 0.9.4
29

310
### Minor Analysis Improvements

cpp/ql/src/change-notes/2024-02-05-gettext-dataflows.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
---
2-
category: minorAnalysis
3-
---
1+
## 0.9.5
2+
3+
### Minor Analysis Improvements
4+
45
* The "non-constant format string" query (`cpp/non-constant-format`) has been updated to produce fewer false positives.
6+
* Added dataflow models for the `gettext` function variants.

cpp/ql/src/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.9.4
2+
lastReleaseVersion: 0.9.5

cpp/ql/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-queries
2-
version: 0.9.5-dev
2+
version: 0.9.6-dev
33
groups:
44
- cpp
55
- queries

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using System.Security.Cryptography;
77
using System.Text;
8+
using System.Text.RegularExpressions;
89
using System.Threading.Tasks;
910
using Semmle.Util;
1011
using Semmle.Util.Logging;
@@ -14,7 +15,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
1415
/// <summary>
1516
/// Main implementation of the build analysis.
1617
/// </summary>
17-
public sealed class DependencyManager : IDisposable
18+
public sealed partial class DependencyManager : IDisposable
1819
{
1920
private readonly AssemblyCache assemblyCache;
2021
private readonly ILogger logger;
@@ -783,13 +784,53 @@ private void RestoreProjects(IEnumerable<string> projects, out IEnumerable<strin
783784
CompilationInfos.Add(("Successfully restored project files", successCount.ToString()));
784785
}
785786

786-
private void DownloadMissingPackages(List<FileInfo> allFiles, ISet<string> dllPaths)
787+
[GeneratedRegex(@"^(.+)\.(\d+\.\d+\.\d+(-(.+))?)$", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
788+
private static partial Regex LegacyNugetPackage();
789+
790+
791+
private static IEnumerable<string> GetRestoredPackageDirectoryNames(DirectoryInfo root)
787792
{
788-
var alreadyDownloadedPackages = Directory.GetDirectories(packageDirectory.DirInfo.FullName)
793+
return Directory.GetDirectories(root.FullName)
789794
.Select(d => Path.GetFileName(d).ToLowerInvariant());
790-
var notYetDownloadedPackages = fileContent.AllPackages
791-
.Except(alreadyDownloadedPackages)
792-
.ToList();
795+
}
796+
797+
private IEnumerable<string> GetRestoredLegacyPackageNames()
798+
{
799+
var oldPackageDirectories = GetRestoredPackageDirectoryNames(legacyPackageDirectory.DirInfo);
800+
foreach (var oldPackageDirectory in oldPackageDirectories)
801+
{
802+
// nuget install restores packages to 'packagename.version' folders (dotnet restore to 'packagename/version' folders)
803+
// typical folder names look like:
804+
// newtonsoft.json.13.0.3
805+
// there are more complex ones too, such as:
806+
// runtime.tizen.4.0.0-armel.Microsoft.NETCore.DotNetHostResolver.2.0.0-preview2-25407-01
807+
808+
var match = LegacyNugetPackage().Match(oldPackageDirectory);
809+
if (!match.Success)
810+
{
811+
logger.LogWarning($"Package directory '{oldPackageDirectory}' doesn't match the expected pattern.");
812+
continue;
813+
}
814+
815+
yield return match.Groups[1].Value.ToLowerInvariant();
816+
}
817+
}
818+
819+
private void DownloadMissingPackages(List<FileInfo> allFiles, ISet<string> dllPaths)
820+
{
821+
var alreadyDownloadedPackages = GetRestoredPackageDirectoryNames(packageDirectory.DirInfo);
822+
var alreadyDownloadedLegacyPackages = GetRestoredLegacyPackageNames();
823+
824+
var notYetDownloadedPackages = new HashSet<string>(fileContent.AllPackages);
825+
foreach (var alreadyDownloadedPackage in alreadyDownloadedPackages)
826+
{
827+
notYetDownloadedPackages.Remove(alreadyDownloadedPackage);
828+
}
829+
foreach (var alreadyDownloadedLegacyPackage in alreadyDownloadedLegacyPackages)
830+
{
831+
notYetDownloadedPackages.Remove(alreadyDownloadedLegacyPackage);
832+
}
833+
793834
if (notYetDownloadedPackages.Count == 0)
794835
{
795836
return;

0 commit comments

Comments
 (0)