Archive: A small flaw in script.c (patch included)


A small flaw in script.c (patch included)
Hi,

I currently use two different versions of NSIS. The original and a slightly hacked version with support for some additional commands. In my installer-scripts, i tried to use !ifdef/!endif to make them compile with both versions. Unfortunately this does not work with original NSIS (1.67). Even if !ifdef-ing out some portion of the script, it still checks for known commands and amount of arguments for known commands and then terminates compilation. The attached patch fixes this (IMHO unnecesary) behavior. With that patch applied,
you now can write arbitrary text (like comments) within these disabled areas, just like in C.

Justin, can you please apply this in your next release?

-Fritz


I actually found a simpler way of doing this. Simply insert the following two lines into the very beginning of CEXEBuild::parseLine():


while (*str == ' ' || *str == '\t') str++;
if (ignore && *str!='!') return PS_OK;


I will include this as part of 1.70. The major change in 1.70 from 1.67 is better support for MBCS. I've updated most of NSIS's internal string handling, all that is left is dialog code page etc updates (I think).

After thanksgiving, at least...

-Justin

Originally posted by justin
I actually found a simpler way of doing this. Simply insert the following two lines into the very beginning of CEXEBuild::parseLine():


while (*str == ' ' || *str == '\t') str++;
if (ignore && *str!='!') return PS_OK;

...
-Justin
No, that doesn't catch the following (WHATEVER undefined):


!ifndef WHATEVER
+-----------------+
! My fancy header !
+-----------------!
!endif


At least, it should check for the complete two possible keywords !endif and !else and probably also for a following whitespace.

-Fritz

Originally posted by felfert ...
Ooops! 1,$s/undef/def/g

-Fritz