Side findings - Stop-Function without return, a warning that never throws, certificate files on PowerShell 7 and smaller defects in 10 commands

オープン
#10,799 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
powershell
領域
database, testing

調査の方向性

The issue lists defects across several commands and names relevant locations, including tests/Get-DbaComputerCertificate.Tests.ps1:28. Start by reading the affected command and its existing tests, then reproduce one defect against development 900ba0347 (v2.9.1). Add a regression test that fails on the old behavior; done means the selected defect is fixed and its test passes.

索引モデルが issue の本文から書いたものです。

説明

Defects found while going through the notes of the last weeks' work. Each one is checked against development 900ba0347 (v2.9.1); the line numbers are from there. None of them is in an open pull request. The plan is one fix per command, with a test that fails on the old code where the defect can be shown.

Defects

  • Get-XpDirTreeRestoreFile (private, called by Get-DbaBackupInformation and so by Restore-DbaDatabase), lines 51 and 62-67: three Stop-Function calls without return. When the instance cannot access the path, the function warns and then runs the directory query against that path anyway. For an S3 path it warns and goes on with $pathSep unset. The two Test-DbaPath checks at 62 and 65 are one check twice: $path and $Path are the same variable.
  • Set-DbaPrivilege, lines 389-394: when the remoting check fails, the command only writes a warning. -EnableException never throws for it, so a script that relies on the exception carries on as if the privileges had been granted.
  • Get-DbaComputerCertificate, lines 129-130: -Path fails on PowerShell 7. X509Certificate2.Import() is not supported there; the command returns nothing and warns "Issue connecting to computer | X509Certificate is immutable on this platform", which also points to the wrong cause. Reproduced with a .cer file on PowerShell 7.6; Windows PowerShell 5.1 returns the certificate. The integration test skips on PowerShell 7 for this reason (tests/Get-DbaComputerCertificate.Tests.ps1:28). The constructor that takes the bytes works on both.
  • Copy-DbaRegServer: the only registered server command without Disconnect-RegServer. It opens the stores of the source and of every destination through Get-DbaRegServerStore (lines 323 and 338) and never closes them; the other nine registered server commands call it since #10577 and #10633. The effect is not measured yet.
  • Install-DbaFirstResponderKit: since First Responder Kit 8.34 (2026-07-08), sp_Blitz needs sp_ineachdb. -OnlyScript sp_Blitz.sql, as in the example at line 123, installs a procedure that fails at runtime with "Could not find stored procedure 'dbo.sp_ineachdb'" (seen in our lab on 2026-09-20). The command could add sp_ineachdb.sql when sp_Blitz.sql is selected, or at least the example and the help of -OnlyScript should name the dependency.

Smaller ones

  • Invoke-DbaAdvancedUpdate, line 153: the debug message counts $Actions, but the parameter is $Action, so it always reports 0 actions. Lines 231 and 233 write two progress messages directly after each other, so the first one is never readable.
  • Invoke-DbaDbLogShipping, lines 1109 and 1413: $host.ui.PromptForChoice($title, ...) with $title never set, so the prompt has no caption.
  • Invoke-DbaDbClone, line 228: $server.VersionMajor -lt 13 - ($server.VersionMajor -eq 13 -and ...) subtracts the boolean from 13 before comparing. Latent, because the check at line 214 already stops before that for SQL Server 2016 RTM; -lt 13 says what is meant.
  • Get-DbaWaitResource, line 125: stop-function in lower case. It works; it is the only call written that way.
  • Get-OfflineSqlFileStructure (private): no caller anywhere in the module. Remove it?

This text was created by Claude and reviewed by Andreas Jordan.

主要言語
PowerShell
スター
2.9k
フォーク
869
平均マージ
2日 4時間
マージ済み PR(30日)
38

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dataplat/dbatools のほかの issue

dataplat/dbatools の issue をすべて見る

似ている issue

Databases の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。