-
Notifications
You must be signed in to change notification settings - Fork 589
src: address compiler warnings #846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b22eef3
to
2dd5beb
Compare
vszakats
added a commit
that referenced
this pull request
Mar 14, 2023
- avoid outputting 4000 log lines by hiding the progress bar. Reduces log size by 5x. - decrease timeout (from the default 2700 seconds). - omit unnecessary output. Tested as part of #846
e392d1f
to
1558632
Compare
1558632
to
bcecb59
Compare
bcecb59
to
ee53c81
Compare
AppVeyor config updates merged via #849. |
2cd1ab0
to
792a7f0
Compare
The number of warnings appearing in AppVeyor CI runs went down from (after dedupe) 371 to 0.
There are also warnings in ZLIB-specific code, not covered by AppVeyor CI. |
cd2f6cf
to
c482832
Compare
As for GitHub CI warnings, the before value was 794 (clang + gcc), now standing at 67. Of which 26 are in UPDATE: 0. |
9d0b943
to
602908d
Compare
This comment was marked as resolved.
This comment was marked as resolved.
5649f31
to
78f3403
Compare
This comment was marked as resolved.
This comment was marked as resolved.
079bb32
to
df82079
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This was referenced Apr 29, 2023
vszakats
added a commit
that referenced
this pull request
May 3, 2023
Twice. This tests are flaky and we haven't figured out why. In the meantime use this workaround to test and log these issues, but also ensure that CI run aren't flagged red because of it. Also: - kex: add debug message when hostkey `sig_verify` fails, to help tracking WinCNG KEX failures. - test_ssh2: also add retry logic. I'm not quite sure this is correct. Please let me know. - session_fixture: bump up `src_path` slots to fit retries and show message when hitting the limit. - session_fixture: clear `kbd_password` static variable after use. - session_fixture: close and deinit socket after use. - session_fixture: deinit libssh2 after use. Ref: #804 #846 #979 #1012 #1015 Cherry-picked from #1017 Closes #1023
vszakats
added a commit
to vszakats/libssh2
that referenced
this pull request
May 30, 2023
vszakats
added a commit
to vszakats/libssh2
that referenced
this pull request
May 30, 2023
vszakats
added a commit
that referenced
this pull request
May 30, 2023
vszakats
added a commit
that referenced
this pull request
Jun 13, 2023
vszakats
added a commit
to vszakats/libssh2
that referenced
this pull request
Jun 25, 2023
Regression from b13936b libssh2#861 libssh2#846. Update a variable name missed in above. Reported-by: PewPewPew Fixes libssh2#1105 Closes libssh2#1106
vszakats
added a commit
that referenced
this pull request
Jun 25, 2023
lampmanyao
pushed a commit
to lampmanyao/libssh2
that referenced
this pull request
Jul 16, 2023
lampmanyao
pushed a commit
to lampmanyao/libssh2
that referenced
this pull request
Jul 16, 2023
Before 02f2700 libssh2#846 libssh2#876, we used `%I64d'. That patch changed this to `%lld`. This patch uses `PRId64` (defined in `inttypes.h`). Fixes libssh2#1090 Closes libssh2#1091
lampmanyao
pushed a commit
to lampmanyao/libssh2
that referenced
this pull request
Jul 16, 2023
Regression from b13936b libssh2#861 libssh2#846. Update a variable name missed above. Reported-by: PewPewPew Fixes libssh2#1105 Closes libssh2#1106
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
- avoid outputting 4000 log lines by hiding the progress bar. Reduces log size by 5x. - decrease timeout (from the default 2700 seconds). - omit unnecessary output. Tested as part of libssh2#846
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Patch-by: iruis on github Assisted-by: Marc Hörsken Bug libssh2#846, commit e348709. Fixes libssh2#856 Closes libssh2#858
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Fix or silence all C compiler warnings discovered with (or without) `PICKY_COMPILER=ON` (in CMake). This means all warnings showing up in CI (gcc, clang, MSVS 2013/2015), in local tests on macOS (clang 14) and Windows cross-builds using gcc (12) and llvm/clang (14/15). Also fix the expression `nread -= nread` in `sftp_RW_nonblock.c`. Cherry-picked from: libssh2#846 Closes libssh2#861
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Avoid triggering warnings in macros coming from public libssh2 headers. Cherry-picked from: libssh2#846 Closes libssh2#862
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Most of the changes aim to silence warnings by adding casts. An assortment of other issues, mainly compiler warnings, resolved: - unreachable code fixed by using `goto` in `publickey_response_success()` in `publickey.c`. - potentially uninitialized variable in `sftp_open()`. - MSVS-specific bogus warnings with `nid_type` in `kex.c`. - check result of `kex_session_ecdh_curve_type()`. - add missing function declarations. - type changes to fit values without casts: - `cmd_len` in `scp_recv()` and `scp_send()`: `int` -> `size_t` - `Blowfish_expandstate()`, `Blowfish_expand0state()` loop counters: `uint16_t` -> `int` - `RECV_SEND_ALL()`: `int` -> `ssize_t` - `shell_quotearg()` -> `unsigned` -> `size_t` - `sig_len` in `_libssh2_mbedtls_rsa_sha2_sign()`: `unsigned` -> `size_t` - `prefs_len` in `libssh2_session_method_pref()`: `int` -> `size_t` - `firstsec` in `_libssh2_debug_low()`: `int` -> `long` - `method_len` in `libssh2_session_method_pref()`: `int` -> `size_t` - simplify `_libssh2_ntohu64()`. - fix `LIBSSH2_INT64_T_FORMAT` for MinGW. - fix gcc warning by not using a bit field for `burn_optimistic_kexinit`. - fix unused variable warning in `_libssh2_cipher_crypt()` in `libgcrypt.c`. - fix unused variables with `HAVE_DISABLED_NONBLOCKING`. - avoid const stripping with `BIO_new_mem_buf()` and OpenSSL 1.0.2 and newer. - add a missing const in `wincng.h`. - FIXME added for public: - `libssh2_channel_window_read_ex()` `read_avail` argument type. - `libssh2_base64_decode()` `datalen` argument type. - fix possible overflow in `sftp_read()`. Ref: 4552c73 - formatting in `wincng.h`. See warning details in the PR's individual commits. Cherry-picked from libssh2#846 Closes libssh2#876
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Silence warnings in the ZLIB interface by adding casts and changing types. See PR for individual commits. Cherry-picked from libssh2#846 Closes libssh2#878
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Apply type changes to avoid casts and warnings. In most cases this means changing to a larger type, usually `size_t` or `ssize_t`. Change signedness in a few places. Also introduce new variables to avoid reusing them for multiple purposes, to avoid casts and warnings. - add FIXME for public `libssh2_sftp_readdir_ex()` return type. - fix `_libssh2_mbedtls_rsa_sha2_verify()` to verify if `sig_len` is large enough. - fix `_libssh2_dh_key_pair()` in `wincng.c` to return error if `group_order` input is negative. Maybe we should also reject zero? - bump `_libssh2_random()` size type `int` -> `size_t`. Add checks for WinCNG and OpenSSL to return error if requested more than they support (`ULONG_MAX`, `INT_MAX` respectively). - change `_libssh2_ntohu32()` return value `unsigned int` -> `uint32_t`. - fix `_libssh2_mbedtls_bignum_random()` to check for a negative `top` input. - size down `_libssh2_wincng_key_sha_verify()` `hashlen` to match Windows'. - fix `session_disconnect()` to limit length of `lang_len` (to 256 bytes). - fix bad syntax in an `assert()`. - add a few `const` to casts. - `while(1)` -> `for(;;)`. - add casts that didn't fit into libssh2#876. - update `docs/HACKING-CRYPTO` with new sizes. May need review for OS400QC3: /cc @monnerat @jonrumsey See warning details in the PR's individual commits. Cherry-picked from libssh2#846 Closes libssh2#879
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Silence alignment warnings in WinCNG, by reworking the code. Also add two unrelated casts to avoid gcc compiler warnings in surrounding code. `increases required alignment from 1 to 4 [-Wcast-align]` `increases required alignment from 1 to 8 [-Wcast-align]` See warning details in the PR's individual commits. Reviewed-by: Marc Hörsken in <libssh2#846 (review)> Cherry-picked from libssh2#846 Closes libssh2#880
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Twice. This tests are flaky and we haven't figured out why. In the meantime use this workaround to test and log these issues, but also ensure that CI run aren't flagged red because of it. Also: - kex: add debug message when hostkey `sig_verify` fails, to help tracking WinCNG KEX failures. - test_ssh2: also add retry logic. I'm not quite sure this is correct. Please let me know. - session_fixture: bump up `src_path` slots to fit retries and show message when hitting the limit. - session_fixture: clear `kbd_password` static variable after use. - session_fixture: close and deinit socket after use. - session_fixture: deinit libssh2 after use. Ref: libssh2#804 libssh2#846 libssh2#979 libssh2#1012 libssh2#1015 Cherry-picked from libssh2#1017 Closes libssh2#1023
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Before 02f2700 libssh2#846 libssh2#876, we used `%I64d'. That patch changed this to `%lld`. This patch uses `PRId64` (defined in `inttypes.h`). Fixes libssh2#1090 Closes libssh2#1091
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Regression from b13936b libssh2#861 libssh2#846. Update a variable name missed above. Reported-by: PewPewPew Fixes libssh2#1105 Closes libssh2#1106
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bring down C compiler warnings (as seen in CI and local builds) from around 400 to zero.
To reach this: add casts, adjust (mostly extending) types, add missing declarations, stop reusing variables, add a few size checks, add FIXMEs where type extension to a public API would be useful, adjusted platform guards and printfs masks, simplify
_libssh2_ntohu64()
, rework WinCNG Win32 interfaces with alignment warnings.Also:
ENABLE_WERROR
in CMake CI builds.Pending:
ENABLE_WERROR
->ON
#877, src: silence compiler warnings 2 (ZLIB interface) #878, src: silence compiler warnings 3 (change types) #879, src: silence compiler warnings 4 (alignment in WinCNG) #880 were merged.libssh2_sftp.h
#862_libssh2_dh_secret()
memory leak fix → wincng: fix memory leak in_libssh2_dh_secret()
#858ENABLE_WERROR=ON
breaking auto-detections #857ENABLE_WERROR=ON
seems to enable this for feature tests, causingPerforming Test HAVE_O_NONBLOCK - Failed
on Linux.ENABLE_WERROR=ON
breaks detection ofHAVE_IOCTLSOCKET
on Windows.ENABLE_WERROR=ON
breaks detection ofstrtoll
,_strtoi64
,snprintf
,_stricmp
on Windows with MSVC.cmake_push_check_state()
insrc/CMakeLists.txt
in place ofSAVE_*
methods (2x).strcasecmp()
withstrcmp()
or other method, and delete detection logic.__func__
with the function name, and delete detection logic.