Hi,
When I compile svn trunk in linux, !searchparse pattern fails.
In line 6808 of Source/script.cpp, we can see:
maxlen = (int)(source_string - src_start); // Length of previous string
but src_start is not initialised to source_string.
The following patch fixes it (and !searchparse works with it):
diff --git a/Source/script.cpp b/Source/script.cpp index 88e8515..7cafcde 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -6793,7 +6793,7 @@ DefineList *CEXEBuild::searchParseString(const TCHAR *source_string, LineParser& { if (failParam) *failParam = 0; DefineList *ret = NULL; - const TCHAR *defout = 0, *src_start = 0, *tok; + const TCHAR *defout = 0, *src_start = source_string, *tok; int toklen = 0, maxlen; for (;;) {
Can you show us the !searchparse command that fails?
The only problem I see with a bad maxlen is "if (maxlen < 0) break;" at the end. The first time around the loop no other places should access maxlen...
Last edit: Anders 2014-07-16
I can reproduce the error (and the fix) with the the nsi from
https://github.com/popcorn-official/popcorn-app/blob/dev-0.3/dist/windows/installer.nsi
which tries to extract the version from
https://github.com/popcorn-official/popcorn-app/blob/dev-0.3/package.json
I compiled nsis with the command (debian sid):
scons ZLIB_W32=../zlib PREFIX=/usr/local/nsis/ DEBUG=yes install
Your patch breaks the "starting string" version of the error message. That could be fixed of course but it seems to me like there should be a better way of doing this.
This is my suggestion:
We don't have any good tests for !searchparse and the docs do not spell out the behavior for edge cases so I don't know if this actually breaks anything.
Here is some test code I used:
My patch passes all of these, 3.0 beta 0 barfs on two of them (One is a empty value edge case and my fix is a behavior change)
Last edit: Anders 2014-05-18
Your patch seems better than mine, and of course it resolves my specific case.
Thanks a lot.