Bug 844491 - tests fail to run: The procedure entry point sprintf_s could not be located in msvcrt.dll
Summary: tests fail to run: The procedure entry point sprintf_s could not be located i...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: mingw-cppunit
Version: 17
Hardware: Unspecified
OS: Windows
unspecified
unspecified
Target Milestone: ---
Assignee: Nicolas Chauvet (kwizart)
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-30 22:05 UTC by Tim Mayberry
Modified: 2012-09-07 14:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-07 14:37:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch to fix runtime issue on windows XP (580 bytes, patch)
2012-07-31 05:25 UTC, Tim Mayberry
no flags Details | Diff

Description Tim Mayberry 2012-07-30 22:05:11 UTC
Description of problem:

We use Fedora to cross compile an application targetting windows using mingw packages. We also use cppunit to run a number of tests. After upgrading to Fedora 17 the tests fail to run giving the error "The procedure entry point sprintf_s could not be located in the dynamic link library msvcrt.dll

This is using Windows XP with service pack 3

Version-Release number of selected component (if applicable):

mingw32-cppunit-1.12.1-9.fc17.noarch

How reproducible:

Cross compile a test program linking to cppunit and try to run the resulting executable under Windows.

Additional info:

After a casual look into this issue it appears that Cppunit uses the sprintf_s function in TestAssert.h if __STDC_SECURE_LIB__ is defined, which it is in _mingw.h

It looks like the Suse mingw package has a patch for this issue:
https://build.opensuse.org/package/view_file?file=cppunit-1.12.1-windows.patch&package=mingw32-libcppunit&project=windows%3Amingw%3Awin32&rev=09faaad12ffc214b0c257378391a3121

Comment 1 Nicolas Chauvet (kwizart) 2012-07-30 22:39:28 UTC
Thx for your report.
Can you verify in which upstream version the patch was applied ?

Comment 2 Tim Mayberry 2012-07-31 05:24:45 UTC
(In reply to comment #1)
> Thx for your report.
> Can you verify in which upstream version the patch was applied ?

I don't believe the patch has been applied upstream. The sprintf_s function being used by cppunit was introduced in VS 2005(msvcrt80.dll) according to:

http://msdn.microsoft.com/en-us/library/ce3zzk1k%28v=vs.80%29.aspx#1

It may be exported in later versions of msvcrt.dll(vista,7) but at least on XP I get the above error.

I'll attach a patch(same as suse) which fixes the issue for me.

Comment 3 Tim Mayberry 2012-07-31 05:25:48 UTC
Created attachment 601428 [details]
Patch to fix runtime issue on windows XP

Comment 4 Nicolas Chauvet (kwizart) 2012-07-31 06:22:14 UTC
Ok I will reword.
Please forward this patch upstream for inclusion, I will backport once accepted

Comment 5 Nicolas Chauvet (kwizart) 2012-07-31 06:23:20 UTC
FYI:
http://fedoraproject.org/wiki/Staying_close_to_upstream_projects

Comment 6 Tim Mayberry 2012-08-01 11:20:36 UTC
(In reply to comment #4)
> Ok I will reword.
> Please forward this patch upstream for inclusion, I will backport once
> accepted

I don't believe the patch is appropriate for upstream inclusion.

Cppunit is using the "secure" version of the sprintf function because the mingw-64 headers make the secure API available. The problem is that the secure functions are only exported in versions of msvcrt.dll in Vista and above(or so the internet tells me) so if you use them you restrict what versions of Windows your executable will run on.

So the patch is really working around what seems to be a problem in mingw-64

There is a somewhat relevant thread on the mingw-64 mailing list:

http://sourceforge.net/mailarchive/forum.php?thread_name=CAEwic4amFD03iRVBnq6jXifi6AvSVBfTgb8efK60V5dLR0NFPQ%40mail.gmail.com&forum_name=mingw-w64-public

Comment 7 Nicolas Chauvet (kwizart) 2012-09-07 14:37:31 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > Ok I will reword.
> > Please forward this patch upstream for inclusion, I will backport once
> > accepted
> 
> I don't believe the patch is appropriate for upstream inclusion.
So I cannot see how it would be appropriate for fedora either.
Vista and later x64 users should expect to use the secure version.

Anyway, I don't mean that this is to be discussed here, but upstream.


Note You need to log in before you can comment on or make changes to this bug.