Dear List - What?s the latest best practice on trying to reproduce warnings raised on CRAN checks? I updated my epanet2toolkit package earlier this week. R CMD check ?as-cran was clean on RHUB and Winbuilder and my local machines. But on CRAN a few variations are causing warnings. For example R-devel-debian-gcc is ok on rhub https://builder.r-hub.io/status/epanet2toolkit_0.6.1.tar.gz-58c1ce1e316317307679f58450a5e17a But not on CRAN: https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/epanet2toolkit-00check.html Thanks in advance for any suggestions. Brad
[R-pkg-devel] reproducing cran warnings
3 messages · Brad Eck, Bill Dunlap, Ivan Krylov
checking whether package ?epanet2toolkit? can be installed ... WARNING Found the following significant warnings: report.c:1466:37: warning: argument to ?sizeof? in ?snprintf? call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess] report.c:1466:61: warning: ?__builtin___snprintf_chk? output may be truncated before the last format character [-Wformat-truncation=] rules.c:1364:40: warning: argument to ?sizeof? in ?snprintf? call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess] rules.c:1371:43: warning: argument to ?sizeof? in ?snprintf? call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess] rules.c:1371:58: warning: ?%02d? directive output may be truncated writing between 2 and 11 bytes into a region of size between 0 and 6 [-Wformat-truncation=] See https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/epanet2toolkit-00install.html for details. You will get these warnings if you do things like char *string = (char*)malloc(length); snprintf(string, sizeof(string), "format ..."); sizeof(string) here is 8 (on a 64 bit machine), no matter what length is. Change this to either char string[64] // 64 had better be big enough snprintf(string, sizeof(string), "format .."); or char *string = (char*)malloc(length); snprintf(string, length, "format ..."); -Bill
On Fri, Feb 3, 2023 at 8:28 AM Brad Eck <bradleyjeck at gmail.com> wrote:
Dear List - What?s the latest best practice on trying to reproduce warnings raised on CRAN checks? I updated my epanet2toolkit package earlier this week. R CMD check ?as-cran was clean on RHUB and Winbuilder and my local machines. But on CRAN a few variations are causing warnings. For example R-devel-debian-gcc is ok on rhub https://builder.r-hub.io/status/epanet2toolkit_0.6.1.tar.gz-58c1ce1e316317307679f58450a5e17a But not on CRAN: https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/epanet2toolkit-00check.html Thanks in advance for any suggestions. Brad [[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
On Fri, 3 Feb 2023 16:28:23 +0000
Brad Eck <bradleyjeck at gmail.com> wrote:
For example R-devel-debian-gcc is ok on rhub https://builder.r-hub.io/status/epanet2toolkit_0.6.1.tar.gz-58c1ce1e316317307679f58450a5e17a But not on CRAN: https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/epanet2toolkit-00check.html
Speaking of reproducing the warnings, the CRAN checks pass -Wall -Wstrict-prototypes -pedantic to the compiler, while on Rhub, only the UB sanitizer is used without any statical analysis warning flags. It may be possible to see the extra warnings if you set CFLAGS = -Wall -Wextra -Wpedantic in ~/.R/Makevars.
Best regards, Ivan