Skip to content

GHA: bump runner to ubuntu-26.04 in most jobs, clang-tidy to v22 - #2078

Closed
vszakats wants to merge 10 commits into
libssh2:masterfrom
vszakats:ub26
Closed

vszakats wants to merge 10 commits into
libssh2:masterfrom
vszakats:ub26

Conversation

@vszakats

@vszakats vszakats commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Keep ubuntu-24.04 for Linux jobs using system packages for more
variation.

Also bump clang-tidy jobs to v22 (from v20, also up from the default v21
preinstalled on ubuntu-26.04.)


The MSVC --parallel patch tested in this PR was deliberately not
merged to master. Maybe later if this turns out to be a permanent
issue. It also need for experiments to avoid the slowdown caused by
reducing it to 1 or 2 (need to figure out the maximum that still fixes
the MSBuild breakage.)

@vszakats
vszakats force-pushed the ub26 branch 3 times, most recently from 460334b to 3059467 Compare June 19, 2026 15:59
vszakats added a commit that referenced this pull request Jun 19, 2026
Seen with clang 21:
```
example/x11.c:154:43: error: identifier 'new' conflicts with a C++ keyword [-Wc++-keyword]
  154 |                     struct chan_X11_list *new;
      |                                           ^
[...]
```
Ref: https://github.com/libssh2/libssh2/actions/runs/27823077802/job/82340633301?pr=2078

Cherry-picked from #2078
vszakats added a commit that referenced this pull request Jun 19, 2026
Seen with clang 21:
```
src/libgcrypt.c:213:24: error: variable 'algo' may be uninitialized when used here [-Wconditional-uninitialized]
  213 |                        algo, hash_len, hash)) {
      |                        ^~~~
src/libgcrypt.c:182:21: note: initialize the variable 'algo' to silence this warning
  182 |     const char *algo;
      |                     ^
      |                      = NULL
```
Ref: https://github.com/libssh2/libssh2/actions/runs/27823077802/job/82340633375?pr=2078

Cherry-picked from #2078
vszakats added a commit that referenced this pull request Jun 19, 2026
Seen with clang 21:
```
src/mbedtls.c:132:19: error: implicit conversion from 'int' to enumeration type 'mbedtls_operation_t' is invalid in C++ [-Wimplicit-int-enum-cast]
  129 |         ret = mbedtls_cipher_setkey(h,
      |               ~~~~~~~~~~~~~~~~~~~~~
  130 |                   secret,
  131 |                   (int)mbedtls_cipher_info_get_key_bitlen(cipher_info),
  132 |                   op);
      |                   ^~
src/mbedtls.c:536:36: error: implicit conversion from 'int' to enumeration type 'mbedtls_md_type_t' is invalid in C++ [-Wimplicit-int-enum-cast]
  536 |     ret = ssh2_mbed_hash(m, m_len, md_type, hash);
      |           ~~~~~~~~~~~~~~           ^~~~~~~
src/mbedtls.c:544:36: error: implicit conversion from 'int' to enumeration type 'mbedtls_md_type_t' is invalid in C++ [-Wimplicit-int-enum-cast]
  543 |     ret = mbedtls_rsa_pkcs1_verify(rsactx,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~
  544 |                                    md_type, (unsigned int)hash_len,
      |                                    ^~~~~~~
src/mbedtls.c:594:38: error: implicit conversion from 'int' to enumeration type 'mbedtls_md_type_t' is invalid in C++ [-Wimplicit-int-enum-cast]
  591 |         ret = mbedtls_rsa_pkcs1_sign(rsactx,
      |               ~~~~~~~~~~~~~~~~~~~~~~
  592 |                                      mbedtls_ctr_drbg_random,
  593 |                                      &mbed_ctr_drbg,
  594 |                                      md_type, (unsigned int)hash_len,
      |                                      ^~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/27823077802/job/82340633351?pr=2078

Cherry-picked from #2078
vszakats added a commit that referenced this pull request Jun 19, 2026
Seen with clang 21:
```
src/openssl.c:641:12: error: implicit conversion from 'int' to enumeration type 'ssh2_curve_type' is invalid in C++ [-Wimplicit-int-enum-cast]
  641 |     return EC_GROUP_get_curve_name(group);
      |     ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/usr/include/wolfssl/openssl/ec.h:347:41: note: expanded from macro 'EC_GROUP_get_curve_name'
  347 | #define EC_GROUP_get_curve_name         wolfSSL_EC_GROUP_get_curve_name
      |                                         ^
```
Ref: https://github.com/libssh2/libssh2/actions/runs/27823674186/job/82342610898?pr=2078

Cherry-picked from #2078
vszakats added a commit that referenced this pull request Jun 19, 2026
Code no longer relies on deprecated APIs when building for OpenSSL 3+,
making this macro redundant.

Follow-up to 363dcbf #1243
Follow-up to 8258194 #1244
Follow-up to 487152f #1236
Follow-up to b0ab005 #1207

Cherry-picked from #2078
vszakats added 5 commits June 19, 2026 18:57
GHA jobs surprised me with a kind of failure I've never seen, without
any change on libssh2's end:

https://github.com/libssh2/libssh2/actions/runs/27823077802/job/82340632890 msvc (windows-2022, x64, uwp, WinCNG, OFF, OFF, ON, OFF, ON)
https://github.com/libssh2/libssh2/actions/runs/27838566519/job/82392203784 msvc (windows-2022, x64, windows, OpenSSL, OFF, OFF, ON, OFF, ON)
https://github.com/libssh2/libssh2/actions/runs/27838566519/job/82392203753 msvc (windows-2022, x64, windows, WinCNG, OFF, OFF, OFF, OFF, ON)

```
Version: 20260616.203.1
[...]
MSBuild version 17.14.40+3e7442088 for .NET Framework
[...]
D:/a/libssh2/libssh2/bld/tests/Release\libssh2.dll: message: deploying dependencies
  D:/a/libssh2/libssh2/bld/tests/Release\libcrypto-3-x64.dll: message: deploying dependencies
  The process cannot access the file because it is being used by another process.
[...]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmDone [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" exited with code 32. [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
  D:/a/libssh2/libssh2/bld/tests/Release/test_auth_keyboard_info_request.exe: message: deploying dependencies
  D:/a/libssh2/libssh2/bld/tests/Release\libcrypto-3-x64.dll: message: deploying dependencies
  test_auth_pubkey_ok_rsa_openssh.vcxproj -> D:\a\libssh2\libssh2\bld\tests\Release\test_auth_pubkey_ok_rsa_openssh.exe
```
@vszakats vszakats changed the title GHA: test ubuntu-26.04 GHA: bump runner to ubuntu-26.04 in most jobs Jun 20, 2026
@vszakats vszakats changed the title GHA: bump runner to ubuntu-26.04 in most jobs GHA: bump runner to ubuntu-26.04 in most jobs, clang-tidy to v22 Jun 20, 2026
@vszakats vszakats closed this in fbe71bc Jun 20, 2026
@vszakats
vszakats deleted the ub26 branch June 20, 2026 11:54
vszakats added a commit that referenced this pull request Jun 21, 2026
This feature has been permanently enabled since the initial commit
adding CMake builds to libssh2. Limited to libssh2's own DLL (if built
that way), and OpenSSL's crypto DLL. While limited to these two DLLs
(and not supporting other dependencies), history shows this feature was
prone to break, and recently started breaking parallel builds, due to
MSBuild failing while copying the DLLs to the same location in
concurrent threads. This recently made MSVC GHA jobs flaky.

It's also a potential performance and disk trashing issue when copying
large DLLs (OpenSSL `libcrypto-*.dll`) on each build, for each of the 52
(at the time of this commit) targets. That's potentially 104 copy
operations. Perhaps this could be limited to once per each target
directory, but that's adding even more complexity and development time.
There is also no generalized/trivial way to pick up the complete set of
DLL dependencies; e.g. libcrypto.dll may need other DLLs. Another
disadvantage is copying around DLLs eventually ends up contributing to
DLL-hell, copies may go stale, picked up when undesired, or due the
heuristic detection, they may not match the dependency version/instance
actually linked. The copying was done on all platforms, while typically
the issue is exclusive to Windows MSVC (and it's also where it breaks.)

As a replacement, I propose to add any necessary DLL location to `PATH`
before running examples or tests. It works well in CI. Also in curl.

Fixing:
```
Version: 20260616.203.1
[...]
MSBuild version 17.14.40+3e7442088 for .NET Framework
[...]
D:/a/libssh2/libssh2/bld/tests/Release\libssh2.dll: message: deploying dependencies
  D:/a/libssh2/libssh2/bld/tests/Release\libcrypto-3-x64.dll: message: deploying dependencies
  The process cannot access the file because it is being used by another process.
[...]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmDone [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" exited with code 32. [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
  D:/a/libssh2/libssh2/bld/tests/Release/test_auth_keyboard_info_request.exe: message: deploying dependencies
  D:/a/libssh2/libssh2/bld/tests/Release\libcrypto-3-x64.dll: message: deploying dependencies
  test_auth_pubkey_ok_rsa_openssh.vcxproj -> D:\a\libssh2\libssh2\bld\tests\Release\test_auth_pubkey_ok_rsa_openssh.exe
```
Refs (MSVC):
https://github.com/libssh2/libssh2/actions/runs/27838566519/job/82392203784 OpenSSL
https://github.com/libssh2/libssh2/actions/runs/27838566519/job/82392203753 WinCNG
https://github.com/libssh2/libssh2/actions/runs/27823077802/job/82340632890 WinCNG UWP

Examples, with shared libssh2:
combined with WINCNG:
Before: https://github.com/libssh2/libssh2/actions/runs/27891639324/job/82535960547 (277 steps)
After: https://github.com/libssh2/libssh2/actions/runs/27901568257/job/82562736781 (229 steps)
combined with OpenSSL:
Before: https://github.com/libssh2/libssh2/actions/runs/27902131772/job/82564199274 (326 steps)
After: https://github.com/libssh2/libssh2/actions/runs/27902733625/job/82565870012 (229 steps)

Observe these steps no longer performed:
```
D:/a/libssh2/libssh2/bld/example/Release\libcrypto-3-x64.dll: message: deploying dependencies
D:/a/libssh2/libssh2/bld/example/Release\libssh2.dll: message: deploying dependencies
```

Ref: #2078
Ref: 1e5e292
Follow-up to a95a02c #2093
Follow-up to 97d8e8d #2091
Follow-up to d652ba0 #2090
Follow-up to dd50a41 #1638
Follow-up to 694b9d9 #1610
Follow-up to 97417ad #899
Follow-up to 19884e5 #818
Follow-up to 6bf8983

Closes #2101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant