Archive: Crash with special build for 2.46


Crash with special build for 2.46
I just tried updating an installer to 2.46 including
the special build files for strlen 8192. Attempting to
then build my installer caused an immediate crash.

I then tried the 2.45 binaries and it worked fine,
also 2.46 with standard string length was fine. So I
wondered if there might be a problem with the
nsis-2.46-strlen_8192.zip

Did anyone else try this already?

BTW, is the space saving so significant that it
warrants using only 1024 in the default version?
Considering that many installers attempt to modify
the PATH variable it's a fine way to get into
serious trouble. Customers get unhappy ;)


You might want to provide a pastebin of the script, and some information on where it crashes.


Actually it doesn't work with 2.45 and strlen 8192
after all: I was accidentally still using the strlen
1024 binaries when attempting to crosscheck. Sorry.

The problem seems to be with

!verbose

statements, they crash on me with strlen 8192.

Did anyone else experience such a problem?

Many of the standard includes use !verbose so
either there is a problem on my side or noone
else is using long strings ...

Edit: Just saw the other reply. I'll try
to reproduce this with a minimal script and
post the results.


Ok now I have a rather small test installer which
crashes reliable. It is an inclusion of StrTok from
StrFunc.nsh with a slightly odd construct I "inherited"
from the EnvVarUpdate function:

--------- test_inc2.nsh ------------------
!include "StrFunc.nsh"

!macro _IncludeStrFunction StrFuncName
!ifndef ${StrFuncName}_INCLUDED
${${StrFuncName}}
!endif
!ifndef Un${StrFuncName}_INCLUDED
${Un${StrFuncName}}
!endif
!define un.${StrFuncName} "${Un${StrFuncName}}"
!macroend

!insertmacro _IncludeStrFunction StrTok
-------------------------------------------

However, the crash only occurs if this code is
two levels deep in include nesting, so I also have

--------- test.nsi ------------------------
!include "test_inc.nsh"
-------------------------------------------

--------- test_inc.nsh --------------------
!include "test_inc2.nsh"
-------------------------------------------

A zip file containing all three files is
attached for convenience. Compiling test.nsi
crashes reliable with 2.45 and strlen 8192.
Most probably also with 2.46 as this was
what I tested originally, but I didn't
yet revert back to that version.

The output from NSIS is as below, followed by
the windows error "makensis has encountered a
problem and needs to close".

Command line:
"C:\Program Files\NSIS\makensis.exe" /NOTIFYHWND 1311446 "H:\release\current\installer\test\test.nsi"

MakeNSIS v2.45 - Copyright 1995-2009 Contributors
See the file COPYING for license details.
Credits can be found in the Users Manual.

Processing config:
Processing plugin dlls: "C:\Program Files\NSIS\Plugins\*.dll"
- AdvSplash::show
- Banner::destroy
- Banner::getWindow
- Banner::show
- BgImage::AddImage
- BgImage::AddText
- BgImage::Clear
- BgImage::Destroy
- BgImage::Redraw
- BgImage::SetBg
- BgImage::SetReturn
- BgImage::Sound
- Dialer::AttemptConnect
- Dialer::AutodialHangup
- Dialer::AutodialOnline
- Dialer::AutodialUnattended
- Dialer::GetConnectedState
- InstallOptions::dialog
- InstallOptions::initDialog
- InstallOptions::show
- LangDLL::LangDialog
- Math::Script
- NSISdl::download
- NSISdl::download_quiet
- Splash::show
- StartMenu::Init
- StartMenu::Select
- StartMenu::Show
- System::Alloc
- System::Call
- System::Copy
- System::Free
- System::Get
- System::Int64Op
- System::Store
- TypeLib::GetLibVersion
- TypeLib::Register
- TypeLib::UnRegister
- UserInfo::GetAccountType
- UserInfo::GetName
- UserInfo::GetOriginalAccountType
- VPatch::GetFileCRC32
- VPatch::GetFileMD5
- VPatch::vpatchfile
- inetc::get
- inetc::head
- inetc::post
- inetc::put
- nsDialogs::Create
- nsDialogs::CreateControl
- nsDialogs::CreateItem
- nsDialogs::CreateTimer
- nsDialogs::GetUserData
- nsDialogs::KillTimer
- nsDialogs::OnBack
- nsDialogs::OnChange
- nsDialogs::OnClick
- nsDialogs::OnNotify
- nsDialogs::SelectFileDialog
- nsDialogs::SelectFolderDialog
- nsDialogs::SetRTL
- nsDialogs::SetUserData
- nsDialogs::Show
- nsExec::Exec
- nsExec::ExecToLog
- nsExec::ExecToStack

!define: "MUI_INSERT_NSISCONF"=""

Changing directory to: "H:\release\current\installer\test"

Processing script file: "H:\release\current\installer\test\test.nsi"
!include: "test_inc.nsh"
!include: "test_inc2.nsh"
!include: "C:\Program Files\NSIS\Include\StrFunc.nsh"
----------------------------------------------------------------------

NSIS String Functions Header File 1.09 - Copyright 2004 Diego Pedroso

----------------------------------------------------------------------

(C:\Program Files\NSIS\Include\StrFunc.nsh:52)
!include: closed: "C:\Program Files\NSIS\Include\StrFunc.nsh"
!insertmacro: _IncludeStrFunction
!insertmacro: FUNCTION_STRING_StrTok
!insertmacro: STRFUNC_FUNC
$ {StrTok} - Copyright 2004 Diego Pedroso - Based on functions by "bigmac666" (macro:STRFUNC_FUNC:11)
!undef: "StrTok"
!define: "StrTok"="!insertmacro FUNCTION_STRING_StrTok_Call"
!define: "StrTok_INCLUDED"=""
Function: "StrTok"
!insertmacro: end of STRFUNC_FUNC
Exch($0,0)
Exch(st(1),0)
Exch($1,0)
Exch(st(1),0)
Exch(st(2),0)
Exch($2,0)
Exch(st(2),0)
Exch(st(3),0)
Exch($3,0)
Exch(st(3),0)
Push: $4
Push: $5
Push: $6
Push: $7
Push: $8
Push: $9
Push: $R0
!insertmacro: _IfThen
!insertmacro: end of _IfThen
!insertmacro: _IfThen
!insertmacro: end of _IfThen
!insertmacro: _IfThen
!insertmacro: end of _IfThen
StrLen $4 "$2"
StrLen $5 "$3"
StrCpy $6 "0" () ()
StrCpy $8 "-1" () ()
IntOp: $8=$8+1
!insertmacro: _Do
!insertmacro: end of _Do
StrCpy $7 "$3" (1) ($6)
!insertmacro: _If
!insertmacro: end of _If
!insertmacro: _If
!insertmacro: end of _If
!insertmacro: _Or
!insertmacro: end of _Or
StrCpy $3 "$3" ($6) ()
!insertmacro: _Else
!insertmacro: end of _Else
StrCpy $3 "" () ()
!insertmacro: _EndIf
!insertmacro: end of _EndIf
StrCpy $R0 "End" () ()
!insertmacro: _Goto
!insertmacro: end of _Goto
!insertmacro: _EndIf
!insertmacro: end of _EndIf
StrCpy $R0 "0" () ()
!insertmacro: _Do
!insertmacro: end of _Do
!insertmacro: _If
!insertmacro: end of _If
StrCpy $9 "$2" (1) ($R0)
!insertmacro: _Else
!insertmacro: end of _Else
StrCpy $9 "$2" (1) ()
!insertmacro: _EndIf
!insertmacro: end of _EndIf
!insertmacro: _IfThen
!insertmacro: end of _IfThen
!insertmacro: _If
!insertmacro: end of _If
StrCpy $7 "$3" ($6) ()
!insertmacro: _If
!insertmacro: end of _If
!insertmacro: _And
!insertmacro: end of _And
IntOp: $6=$6+1
StrCpy $3 "$3" () ($6)
StrCpy $6 "0" () ()
Goto: StrSearchLoop
!insertmacro: _ElseIf
!insertmacro: end of _ElseIf
StrCpy $3 "$3" ($6) ()
StrCpy $R0 "End" () ()
!insertmacro: _Goto
!insertmacro: end of _Goto
!insertmacro: _EndIf
!insertmacro: end of _EndIf
IntOp: $6=$6+1
StrCpy $3 "$3" () ($6)
StrCpy $6 "0" () ()
Goto: ResultPartLoop
!insertmacro: _EndIf
!insertmacro: end of _EndIf
IntOp: $R0=$R0+1
!insertmacro: _Loop
!insertmacro: end of _Loop
!insertmacro: _IfThen
!insertmacro: end of _IfThen
IntOp: $6=$6+1
!insertmacro: _Loop
!insertmacro: end of _Loop
Pop: $R0
Pop: $9
Pop: $8
Pop: $7
Pop: $6
Pop: $5
Pop: $4
Pop: $0
Pop: $1
Pop: $2
Exch($3,0)
FunctionEnd
!insertmacro: end of FUNCTION_STRING_StrTok
!insertmacro: FUNCTION_STRING_UnStrTok
!undef: "UnStrTok"
!insertmacro: FUNCTION_STRING_StrTok
!insertmacro: STRFUNC_FUNC
$ {UnStrTok} - Copyright 2004 Diego Pedroso - Based on functions by "bigmac666" (macro:STRFUNC_FUNC:5)
!define: "UnStrTok"="!insertmacro FUNCTION_STRING_UnStrTok_Call"
!define: "UnStrTok_INCLUDED"=""
Function: "un.StrTok"
!insertmacro: end of STRFUNC_FUNC
Exch($0,0)
Exch(st(1),0)
Exch($1,0)
Exch(st(1),0)
Exch(st(2),0)
Exch($2,0)
Exch(st(2),0)
Exch(st(3),0)
Exch($3,0)
Exch(st(3),0)
Push: $4
Push: $5
Push: $6
Push: $7
Push: $8
Push: $9
Push: $R0
!insertmacro: _IfThen


Just wanted to add that modifying the include structure
of my original installer so that the problematic piece of
code is included one nesting level lower seems to be
a robust workaround for the time being (phew).


I too am getting this problem - special build crashes on Windows 7 32-bit.

...
!insertmacro: SectionTextGetStored
!insertmacro: SectionText
!insertmacro: _Do
!insertmacro: end of _Do
!insertmacro: SectionText_Single
!insertmacro: _If

The If code is at the beginning of the macro:
!macro SectionText_Single single section action io
;this bit is just for checking that the script-author hasn't tried to add too many sections
${If} $MAX_SECTION_COUNT = ""
${OrIf} ${single} > $MAX_SECTION_COUNT
StrCpy $MAX_SECTION_COUNT ${single}
${EndIf}

MAX_SECTION_COUNT variable is defined.
Code compiles and runs fine on non-special build.