Skip Menu |
 

This queue is for tickets about the Tcl CPAN distribution.

Report information
The Basics
Id: 78308
Status: resolved
Priority: 0/
Queue: Tcl

People
Owner: Nobody in particular
Requestors: jquelin [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.11



Subject: compilation fails with -Werror=format-security
attached patch fixes the problem.
Subject: Tcl-1.02-fmt_error.patch
--- Tcl.xs.orig 2012-07-09 10:45:04.635579689 +0200 +++ Tcl.xs 2012-07-09 10:45:33.432580876 +0200 @@ -213,7 +213,7 @@ #if !defined(WIN32) && !defined(__hpux) char *error = dlerror(); if (error != NULL) { - warn(error); + warn("%s",error); } #endif warn("NpLoadLibrary: could not find Tcl library at '%s'", dl_path); @@ -399,7 +399,7 @@ #if !defined(WIN32) && !defined(__hpux) char *error = dlerror(); if (error != NULL) { - warn(error); + warn("%s",error); } #endif return TCL_ERROR; @@ -785,7 +785,7 @@ else { if (count != 1) { croak("Perl sub bound to Tcl proc returned %d args, expected 1", - count); + (int)count); } sv = POPs; /* pop the undef off the stack */ @@ -865,7 +865,7 @@ else { if (count != 1) { croak("Perl sub bound to Tcl proc returned %d args, expected 1", - count); + (int)count); } sv = POPs; /* pop the undef off the stack */ @@ -1029,7 +1029,7 @@ /* sv_mortalcopy here prevents stringifying script - necessary ?? */ cscript = SvPV(sv_mortalcopy(script), length); if (Tcl_EvalEx(interp, cscript, length, flags) != TCL_OK) { - croak(Tcl_GetStringResult(interp)); + croak("%s", Tcl_GetStringResult(interp)); } prepare_Tcl_result(aTHX_ interp, "Tcl::Eval"); SPAGAIN; @@ -1092,7 +1092,7 @@ PUTBACK; Tcl_ResetResult(interp); if (Tcl_EvalFile(interp, filename) != TCL_OK) { - croak(Tcl_GetStringResult(interp)); + croak("%s", Tcl_GetStringResult(interp)); } prepare_Tcl_result(aTHX_ interp, "Tcl::EvalFile"); SPAGAIN; @@ -1117,7 +1117,7 @@ { Tcl_ResetResult(interp); if (Tcl_Eval(interp, s) != TCL_OK) - croak(Tcl_GetStringResult(interp)); + croak("%s",Tcl_GetStringResult(interp)); append = 0; } } @@ -1251,7 +1251,7 @@ } if (result != TCL_OK) { - croak(Tcl_GetStringResult(interp)); + croak("%s", Tcl_GetStringResult(interp)); } prepare_Tcl_result(aTHX_ interp, "Tcl::invoke"); @@ -1318,7 +1318,7 @@ } if (result != TCL_OK) { - croak(Tcl_GetStringResult(interp)); + croak("%s", Tcl_GetStringResult(interp)); } prepare_Tcl_result(aTHX_ interp, "Tcl::icall"); @@ -1393,7 +1393,7 @@ CODE: if (!initialized) { return; } if (tclKit_AppInit(interp) != TCL_OK) { - croak(Tcl_GetStringResult(interp)); + croak("%s", Tcl_GetStringResult(interp)); } Tcl_CreateObjCommand(interp, "::perl::Eval", Tcl_EvalInPerl, (ClientData) NULL, NULL);
On Wed Jul 11 07:56:09 2012, JQUELIN wrote:
Show quoted text
> attached patch fixes the problem.

I submitted a pull request on GitHub for the same issue in the XS code: https://github.com/gisle/tcl.pm/pull/12. I was not aware of this patch though; the Perl code portions of the patch would still be needed.
On Tue Jun 19 19:42:42 2018, CAC wrote:
Show quoted text
> the Perl code portions of the patch would still be needed.

For some reason I thought there were Perl files being patched as well. But clearly it's only Tcl.xs which was being patched; there were just other locations besides croak() which I hadn't updated.

Also, the changes to warn() were already applied in https://github.com/gisle/tcl.pm/commit/85681a436a907b85954f416377aaff829276dc96 

So the only remaining changes are casting count to int.
On Tue Jun 19 19:59:57 2018, CAC wrote:
Show quoted text
> So the only remaining changes are casting count to int.

I imagine the reason I wasn't getting a compiler warning for this is that an int is 32 bits on my system so a cast from I32 to int wasn't necessary, whereas the reporter might have had 16-bit ints resulting in a compiler warning.

I've opened another open a pull request to use %ld format specifier (instead of casting to int) to prevent a compiler warning: 
https://github.com/gisle/tcl.pm/pull/13
On Fri Jun 22 20:24:03 2018, CAC wrote:
I've opened another open a pull request to use %ld format specifier (instead of casting to int) to prevent a compiler warning: https://github.com/gisle/tcl.pm/pull/13

That pull request was merged and is part of release 1.11. I believe this ticket can be marked as resolved now.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.