Bugs item #1653864, was opened at 2007-02-07 02:00 Message generated for change (Comment added) made by dgutride You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1653864&group_id=105970
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: extensions Group: v3.0 Status: Open Resolution: None Priority: 5 Private: No Submitted By: JunoAU (junoau) Assigned to: Rob Mensching (robmen) Summary: SqlScript element causes ConfigureSql action to fail Initial Comment: I have a fairly straightforward wix script that uses an SqlScript element. When I have this element present in my wix file I get a run time error and the installation fails. If I change the script so it creates a straight database it works. If I use an SqlString element instead it works and if I use the SqlDatabase element on it's own to create a database, it creates the database. I have run this against Wix 3.0.2602, 3.0.2526 and 3.0.2420. My script is: -------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:sql='http://schemas.microsoft.com/wix/SqlExtension' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'> <Product Id='75E7F245-3ED1-4926-8EF4-EF2E7FF867DC' Name='Test Product' Language='1033' Version='1.0.0' Manufacturer='Test Manufacturer' UpgradeCode='F43DD068-3E8E-4f16-97EA-40A61912BBD2'> <Package Description="Test Application" Comments="Test Comments" Manufacturer="Manufacturer" InstallerVersion="200" Compressed="yes" /> <Media Id="1" Cabinet="test.cab" EmbedCab="yes" /> <util:User Id="userTest" Name="sa" /> <sql:SqlDatabase Id="dbTest" Server="DBSERVER01\DEV_01" Database="dbTest" User="userTest"/> <Binary Id="testScript" SourceFile="test.sql" /> <Directory Id='TARGETDIR' Name='SourceDir'> <Directory Id="ProgramFilesFolder" Name="PFiles"> <Directory Id="TESTDIR" Name="Test Application"> <Component Id='testcomp' Guid='263D5DE2-EB30-42ba-ABDE-969EA9677AB0'> <sql:SqlScript Id="scriptOne" SqlDb="dbTest" ExecuteOnInstall="yes" Sequence="001" BinaryKey="testScript" User="userTest" /> <File Id='testapp' Name='testapp' Source='../Files/test.exe' KeyPath="yes"> </File> </Component> </Directory> </Directory> </Directory> <Feature Id='TestFeature' Title='Test Feature' Level='1' Description="Install the Test Application on this machine." ConfigurableDirectory="TESTDIR"> <ComponentRef Id="testcomp"></ComponentRef> </Feature> </Product> </Wix> -------------------------------------------- When I run this script (after building it with WiX 3.0.2602 I get the following in my log: -------------------------------------------- ... MSI (s) (8C:D0) [17:44:23:543]: Doing action: ConfigureSql Action start 17:44:23: ConfigureSql. MSI (s) (8C:D0) [17:44:23:653]: Creating MSIHANDLE (41) of type 790542 for thread 2768 MSI (s) (8C:10) [17:44:23:653]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI19B.tmp, Entrypoint: ConfigureSql MSI (s) (8C:E8) [17:44:23:653]: Generating random cookie. MSI (s) (8C:E8) [17:44:23:668]: Created Custom Action Server with PID 2100 (0x834). MSI (s) (8C:3C) [17:44:23:731]: Running as a service. MSI (s) (8C:68) [17:44:23:731]: Hello, I'm your 32bit Impersonated custom action server. MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (42) of type 790541 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (43) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (43) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (44) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (44) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (45) of type 790540 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (46) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (47) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (47) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (48) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (48) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (49) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (49) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (50) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (51) of type 790540 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (50) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (52) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (53) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (53) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (52) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (51) of type 790540 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (46) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (45) of type 790540 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (54) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (54) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (55) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (55) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Creating MSIHANDLE (56) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:746]: Closing MSIHANDLE (56) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:762]: Creating MSIHANDLE (57) of type 790540 for thread 1112 MSI (s) (8C!58) [17:44:23:762]: Creating MSIHANDLE (58) of type 790540 for thread 1112 MSI (s) (8C!58) [17:44:23:762]: Creating MSIHANDLE (59) of type 790531 for thread 1112 MSI (s) (8C!58) [17:44:23:762]: Creating MSIHANDLE (60) of type 790531 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Leaked MSIHANDLE (60) of type 790531 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Closing MSIHANDLE (60) of type 790531 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Leaked MSIHANDLE (59) of type 790531 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Closing MSIHANDLE (59) of type 790531 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Leaked MSIHANDLE (58) of type 790540 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Closing MSIHANDLE (58) of type 790540 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Leaked MSIHANDLE (57) of type 790540 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Closing MSIHANDLE (57) of type 790540 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Leaked MSIHANDLE (42) of type 790541 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Closing MSIHANDLE (42) of type 790541 for thread 1112 MSI (s) (8C:10) [17:44:23:762]: Note: 1: 2769 2: ConfigureSql 3: 5 DEBUG: Error 2769: Custom Action ConfigureSql did not close 5 MSIHANDLEs. The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: ConfigureSql, 5, MSI (s) (8C:10) [17:44:23:762]: Closing MSIHANDLE (41) of type 790542 for thread 2768 Action ended 17:44:23: ConfigureSql. Return value 3. ... -------------------------------------------- Something is obviously going wring inside the ConfigureSql custom action. I saw that another user mentioned this and Rob Mensching stated that it was a bug that had been fixed in WiX 2.0 (http://sourceforge.net/mailarchive/message.php?msg_id=38104387) . I did a search through the bug list and didn't see this mentioned in the bug database so raised it here. This is a major bug from my perspective as it severly limits how usefull WiX 3.0 is when doing anything against the database. ---------------------------------------------------------------------- Comment By: DGutride (dgutride) Date: 2007-10-08 08:17 Message: Logged In: YES user_id=1204611 Originator: NO We've made sure the strings are null terminated and also changed the strutil file so it wouldn't be looking beyond the end of the array. After introducing this fix, we've run our upgrades and installs many times without any failures. We had been encountering the failure with every single upgrade we'd run. We fixed it by making the following changes: Two files were edited: src/ca/serverca/scasched/scasqlstr.cpp (line 269) Before: // We have an ANSI string so convert it to UNICODE. cchScript = cbScript; hr = StrAllocStringAnsi(&pwzScriptBuffer, reinterpret_cast<LPCSTR>(pbScript), cchScript, CP_ACP); ExitOnFailure1(hr, "Failed to allocate WCHAR string of size '%d'", cchScript); After: LPSTR pszScript = reinterpret_cast<LPSTR>(pbScript); pszScript[cbRead] = '\0'; cchScript = cbRead; // We have an ANSI string so convert it to UNICODE. hr = StrAllocStringAnsi(&pwzScriptBuffer, pszScript, cchScript, CP_ACP); ExitOnFailure1(hr, "Failed to allocate WCHAR string of size '%d'", cchScript); src/dutil/strutil.cpp (Line 246) Before: else if (L'\0' == szSource[cchSource]) // if the source already had a null terminator, don't count that in the character count because we track it below After: else if (L'\0' == szSource[cchSource-1]) // if the source already had a null terminator, don't count that in the character count because we track it below ---------------------------------------------------------------------- Comment By: Roman Sedov (sedovroman) Date: 2007-04-09 07:23 Message: Logged In: YES user_id=1764734 Originator: NO As I can unredstant, the problem is in pwzScript from ScaSqlStrsReadScripts(...) (src\ca\serverca\scasched\scasqlstr.cpp). This variable is not initialized with NULL. That's why calls of StrAllocString() or StrAllocStringAnsi fail. ---------------------------------------------------------------------- Comment By: Rob Mensching (robmen) Date: 2007-02-07 06:43 Message: Logged In: YES user_id=991639 Originator: NO Fixes made in WiX v2 will be pushed up to WiX v3 after WiX v2 has been completed. WiX v3 is not intended for general purpose use yet and will have severe bugs for the next 6 months at least. If you want a stable toolset *right now*, go with WiX v2 instead. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1653864&group_id=105970 ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ WiX-devs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-devs
