-
Notifications
You must be signed in to change notification settings - Fork 223
ENH: Handle error strings in a way that doesn't produce compile warnings #2205
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
Conversation
|
Please rebase the changes onto the release branch. Also can we get more detains about the compatibility of these functions. We should be able to list compatibility with R versions of the R Rprintf and the new REprintf methods. |
|
Hi @richardbeare, Please provide more details in the commit message. Specifically, what build warning and at what version of R was it changed to an error. We want to be able to test these things on the development machines. Also, I believe this change replaces printing to std::out with printing to std:err. The change makes sense in that the original code was printing to the wrong location, is this both a build fix and bug fix at the same time? |
|
Will get onto the rebasing - apologies, I always forget where to begin the modifications. Further details that will get included in the new PR. There are two changes - string formatting and use of REprintf. @zivy zivy Do you prefer them to be separate commits in the next PR, or is documentation sufficient? /tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘SEXPREC* ImAsArray(itk::simple::Image)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:54:15: error: format not a string literal and no format arguments [-Werror=format-security]
54 | Rprintf(error_msg);
| ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:207:15: error: format not a string literal and no format arguments [-Werror=format-security]
207 | Rprintf(error_msg);
| ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘itk::simple::Image ArrayAsIm(SEXP, std::vector<unsigned int>, std::vector<double>, std::vector<double>, unsigned int)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:237:13: error: format not a string literal and no format arguments [-Werror=format-security]
237 | Rprintf(error_msg);
| ^~~~~~~~~
cc1plus: some warnings being treated as errors
make[5]: *** [Wrapping/R/CMakeFiles/SimpleITK_R.dir/build.make:460: Wrapping/R/CMakeFiles/SimpleITK_R.dir/sitkRArray.cxx.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:1855: Wrapping/R/CMakeFiles/SimpleITK_R.dir/all] Error 2
make[3]: *** [Makefile:156: all] Error 2
make[2]: *** [CMakeFiles/SimpleITK-build.dir/build.make:76: SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:289: CMakeFiles/SimpleITK-build.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
ERROR: configuration failed for package ‘SimpleITK’
* removing ‘/home/richard.beare/R/x86_64-pc-linux-gnu-library/4.4/SimpleITK’
|
|
See PR - #2207 |
Any idea on compatibility of this change? With what version of R is it required? With what versions of R is it compatible? Will it break any older versions of R? |
|
I don't anticipate problems with older versions of R. I have only
encountered the elevation of warnings with 4.4.1.
…On Tue, Oct 22, 2024 at 12:40 AM Bradley Lowekamp ***@***.***> wrote:
Will get onto the rebasing - apologies, I always forget where to begin the
modifications.
Further details that will get included in the new PR. Warnings/errors
raised below, on ubuntu 22, R 4.4.1. The warnings are elevated to errors by
R when installation via SimpleITKRInstaller is attempted.
There are two changes - string formatting and use of REprintf. @zivy
<https://github.com/zivy> zivy Do you prefer them to be separate commits
in the next PR, or is documentation sufficient?
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘SEXPREC* ImAsArray(itk::simple::Image)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:54:15: error: format not a string literal and no format arguments [-Werror=format-security]
54 | Rprintf(error_msg);
| ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:207:15: error: format not a string literal and no format arguments [-Werror=format-security]
207 | Rprintf(error_msg);
| ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘itk::simple::Image ArrayAsIm(SEXP, std::vector<unsigned int>, std::vector<double>, std::vector<double>, unsigned int)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:237:13: error: format not a string literal and no format arguments [-Werror=format-security]
237 | Rprintf(error_msg);
| ^~~~~~~~~
cc1plus: some warnings being treated as errors
make[5]: *** [Wrapping/R/CMakeFiles/SimpleITK_R.dir/build.make:460: Wrapping/R/CMakeFiles/SimpleITK_R.dir/sitkRArray.cxx.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:1855: Wrapping/R/CMakeFiles/SimpleITK_R.dir/all] Error 2
make[3]: *** [Makefile:156: all] Error 2
make[2]: *** [CMakeFiles/SimpleITK-build.dir/build.make:76: SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:289: CMakeFiles/SimpleITK-build.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
ERROR: configuration failed for package ‘SimpleITK’* removing ‘/home/richard.beare/R/x86_64-pc-linux-gnu-library/4.4/SimpleITK’
Any idea on compatibility of this change? With what version of R is it
required? With what versions of R is it compatible? Will it break any older
versions of R?
—
Reply to this email directly, view it on GitHub
<#2205 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF6RIMAY6QGZGHDKEBNEGTZ4T755AVCNFSM6AAAAABP2KC6PCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRWG4YTSMRSGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Compiler warnings are being elevated to errors when encountered by SimpelITKRInstaller - presumably a change of defaults in the package build process in more recent versions of R.
The various prints are all errors, so the calls have also been changed to REprintf