-
Notifications
You must be signed in to change notification settings - Fork 711
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
Fix 64 to 32 conversions #2993
Fix 64 to 32 conversions #2993
Conversation
09eb88e
to
e67f0fc
Compare
e67f0fc
to
a53dd81
Compare
ef2bde8
to
08a9d0e
Compare
08a9d0e
to
b29b62e
Compare
At least, the macOS build issue is fixed. A build on top of your changes is available here https://github.com/OpenSC/OpenSC/actions/runs/7653681110 |
Thanks for checking and good to hear that! I have still some changes trying to squash some of the clang-format warnings, but it can be skipped to avoid even more changes. But I would like to get at least the ones on the directly touched lines (and one outstanding comment that I missed). |
Yeah, I'm currently reviewing the changes - please don't add more on top for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unfortunate to see so many return values being casted, because we are mixing the returned length with a status code. In an ideal world, we would maybe try to refactor the functions to only return the error code and modify the signature to add a return value... 🤷
Correct. But it would require even more changes that I am not sure if they are worth the time spent. Most of them are casts from the some APDU resplen, which are size_t, but really can not go over the |
Sorry, I know that this is a lot of refactoring work. I didn't mean to offload this to you. regarding the return values, that may stay as you suggested - same for sc_read/write/update/erase_binary/record. Thanks for taking the time fixing all those warnings. |
Do you think it is possible to include the newest releases of gcc/clang in the strict workflow somehow? |
In Fedora the latest clang/gcc lands in rawhide (unstable rolling release). The first gcc 14 landed there 12 days ago so there is really not much head-time before the package starts failing and somebody will try to address the newly turned on warning (in this case in #2996). The Fedora change process of these core components usually involves rebuilt of all packages and addressing the more obvious issues or opening bugs: https://koji.fedoraproject.org/koji/buildinfo?buildID=2344783 There should be https://packages.debian.org/sid/gcc The problem with the rolling/unstable releases is that they are updated at unexpected times and CI starts failing in the worst possible times. But if we keep it in separate workflow file we can treat it as "nice to have". Let me give it a try. I would probably be for merging the #2885 first. It will shrink this PR a bit if you agree. |
482fbaf
to
229bed1
Compare
Rebased on top of the removed drivers with an attempt to run CI against unstable versions of both GCC/clang. The flags might need some tweaking or we might try to fix some of the whitelisted in there gradually. |
1216378
to
86984b4
Compare
I think the current version is good enough. One of the strict builds is failing because of clang + strict warnings but I do not see the obvious issue in here:
Additionally, the update of yubico-piv tool likely broke the PIV tests now (sigh ...). Filled this issue Yubico/yubico-piv-tool#465 |
I think it is likely the use of the Lines 466 to 476 in 6e2ea36
|
I think I saw similar issue in some other files that did not include the config.h, but in this case, it did not help: |
Did you notice that detection of the builtins on In an other PR, we had a similar discussion https://github.com/OpenSC/OpenSC/pull/2904/files#r1367731646. in #2904 the fix was to simply rename the internal function. |
Yes, I saw that but did not dig much deeper as I am not well versed in the linux/others gcc/clang differences.
That could do that. But I would propose in another PR if possible |
Thanks for review. I will rebase + squash the fixup commits and then we can merge if there will be no other voices against. |
These are exposed by a shorten-64-to-32 warning from clang that is turned out automatically when building release build for OSX. They can be also triggered manually with similar configuration like this: CC=clang CFLAGS=-Wshorten-64-to-32 ./configure && make -j8 Should fix OpenSC#2967
Without the config, clang complains about conflicting types reader-tr03119.c:138:5: error: conflicting types for 'escape_pace_input_to_buf' int escape_pace_input_to_buf(sc_context_t *ctx, ^ ./reader-tr03119.h:87:5: note: previous declaration is here int escape_pace_input_to_buf(sc_context_t *ctx, ^
0c71c9f
to
a03cd51
Compare
great, thank you |
This is an attempt to fix #2967 while trying locally with my clang:
I tried to rewrite some variables to use more sensible types in the context. Some of them were obvious overlooks, sometimes we get size_t from openssl, but are expected to pass int back to it in some case, where we can not do much other than casting that.
I tried to check also some overflows of the casts in some places where it made sense, but certainly the changeset is too large to do it in all places properly.
The PR also includes strict clang run with many more warnings turned to errors (but I had to disable some others).
Checklist