Copilot commented on code in PR #2145:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2145#discussion_r2989879668


##########
.github/workflows/create-release-artifacts.yml:
##########
@@ -40,3 +40,65 @@ jobs:
         with:
           name: ${{ matrix.platform.rpm-artifact }}
           path: build/nifi-minifi-cpp-*.rpm
+  windows_VS2022:
+    name: "Windows Server 2025 x86_64"
+    runs-on: windows-2025
+    timeout-minutes: 240
+    steps:
+      - name: Support longpaths
+        run: git config --system core.longpaths true
+      - name: Checkout project
+        uses: actions/checkout@v4
+      - name: Set up Python
+        run: choco -y install python & refreshenv
+        shell: cmd
+      - name: Install sqliteodbc driver
+        run: |
+          Invoke-WebRequest -Uri 
"http://www.ch-werner.de/sqliteodbc/sqliteodbc_w64.exe"; -OutFile 
"sqliteodbc_w64.exe"

Review Comment:
   The driver installer is downloaded over plain HTTP, which is vulnerable to 
MITM. Even with a hash check, using HTTPS materially improves supply-chain 
security and reduces exposure to interception/tampering attempts. Switch the 
download URL to HTTPS (or a trusted HTTPS mirror) if available.
   ```suggestion
             Invoke-WebRequest -Uri 
"https://www.ch-werner.de/sqliteodbc/sqliteodbc_w64.exe"; -OutFile 
"sqliteodbc_w64.exe"
   ```



##########
.github/workflows/create-release-artifacts.yml:
##########
@@ -40,3 +40,65 @@ jobs:
         with:
           name: ${{ matrix.platform.rpm-artifact }}
           path: build/nifi-minifi-cpp-*.rpm
+  windows_VS2022:
+    name: "Windows Server 2025 x86_64"
+    runs-on: windows-2025
+    timeout-minutes: 240
+    steps:
+      - name: Support longpaths
+        run: git config --system core.longpaths true
+      - name: Checkout project
+        uses: actions/checkout@v4
+      - name: Set up Python
+        run: choco -y install python & refreshenv
+        shell: cmd
+      - name: Install sqliteodbc driver
+        run: |
+          Invoke-WebRequest -Uri 
"http://www.ch-werner.de/sqliteodbc/sqliteodbc_w64.exe"; -OutFile 
"sqliteodbc_w64.exe"
+          if ((Get-FileHash 'sqliteodbc_w64.exe').Hash -ne 
"a4804e4f54f42c721df1323c5fcac101a8c7a577e7f20979227324ceab572d51") {Write 
"Hash mismatch"; Exit 1}
+          Start-Process -FilePath ".\sqliteodbc_w64.exe" -ArgumentList "/S" 
-Wait
+        shell: powershell
+      - name: build
+        run: |
+          python -m venv venv & venv\Scripts\activate & pip install -r 
requirements.txt & python main.py --noninteractive --skip-compiler-install 
--minifi-options="-DCMAKE_BUILD_TYPE=Release -DCI_BUILD=OFF -DENABLE_ALL=ON 
-DMINIFI_FAIL_ON_WARNINGS=OFF"

Review Comment:
   On Windows `cmd`, activating a venv from within a batch context typically 
requires calling `activate.bat` with `call`; otherwise control flow/environment 
updates can be unreliable and subsequent `pip`/`python` commands may run 
outside the venv. Update the command to explicitly `call 
venv\\Scripts\\activate.bat` (or avoid activation by invoking 
`venv\\Scripts\\python -m pip ...` and `venv\\Scripts\\python main.py ...`).
   ```suggestion
             python -m venv venv & call venv\Scripts\activate.bat & pip install 
-r requirements.txt & python main.py --noninteractive --skip-compiler-install 
--minifi-options="-DCMAKE_BUILD_TYPE=Release -DCI_BUILD=OFF -DENABLE_ALL=ON 
-DMINIFI_FAIL_ON_WARNINGS=OFF"
   ```



##########
.github/workflows/create-release-artifacts.yml:
##########
@@ -40,3 +40,65 @@ jobs:
         with:
           name: ${{ matrix.platform.rpm-artifact }}
           path: build/nifi-minifi-cpp-*.rpm
+  windows_VS2022:
+    name: "Windows Server 2025 x86_64"
+    runs-on: windows-2025
+    timeout-minutes: 240
+    steps:
+      - name: Support longpaths
+        run: git config --system core.longpaths true
+      - name: Checkout project
+        uses: actions/checkout@v4
+      - name: Set up Python
+        run: choco -y install python & refreshenv
+        shell: cmd
+      - name: Install sqliteodbc driver
+        run: |
+          Invoke-WebRequest -Uri 
"http://www.ch-werner.de/sqliteodbc/sqliteodbc_w64.exe"; -OutFile 
"sqliteodbc_w64.exe"
+          if ((Get-FileHash 'sqliteodbc_w64.exe').Hash -ne 
"a4804e4f54f42c721df1323c5fcac101a8c7a577e7f20979227324ceab572d51") {Write 
"Hash mismatch"; Exit 1}

Review Comment:
   `Write` is not a standard PowerShell cmdlet; this line can fail before 
exiting, which would obscure the actual hash mismatch error. Use a valid cmdlet 
(e.g., `Write-Error` or `Write-Host`) so the failure path is reliable and the 
logs clearly show the mismatch reason.
   ```suggestion
             if ((Get-FileHash 'sqliteodbc_w64.exe').Hash -ne 
"a4804e4f54f42c721df1323c5fcac101a8c7a577e7f20979227324ceab572d51") { 
Write-Error "Hash mismatch"; Exit 1 }
   ```



##########
extensions/sftp/tests/tools/SFTPTestServer.cpp:
##########
@@ -138,10 +138,10 @@ bool SFTPTestServer::stop() {
     logger_->log_debug("Deleting port file {}", port_file_path_);
     ::unlink(port_file_path_.c_str());
   }
-#endif
   server_pid_ = -1;
   started_ = false;
   port_file_path_ = "";
+#endif

Review Comment:
   Moving `#endif` down causes `server_pid_`, `started_`, and `port_file_path_` 
resets to be compiled only when the corresponding `#if` condition is true. That 
changes `stop()` behavior and can leave the object in an inconsistent state on 
builds where the guard is false. Keep the `#endif` immediately after the 
platform-specific block (e.g., only guard the `unlink` portion), so the state 
reset always executes.
   ```suggestion
   #endif
     started_ = false;
     port_file_path_ = "";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to