dmd installer clobbers PATH on Windows (sometimes)

Ary Manzana ary at esperanto.org.ar
Mon Aug 1 11:35:53 PDT 2011


On 8/1/11 2:58 PM, Brad Anderson wrote:
> The NSIS script used to update the environment
> variable (EnvVarUpdate) has the following warning [1]:
>
> "Warning this code will replace paths rather than append if the existing
> path exceeds the maximum string length in the NSIS build you are using.
> Some setup crash can also occurs."
>
> The default maximum string length is 1024.  There is a special build of
> NSIS [2] which has a larger maximum string length (8192) that would help
> avoid this problem.  There is also a patch [1] for EnvVarUpdate that
> detects if the PATH will be overwritten instead of appended to and tells
> the user to update their PATH manually.
>
> I've seen this issue complained about before online but
> hadn't experienced it myself until recently.  It can be a rather
> frustrating problem to experience as restoring your PATH isn't trivial
> because there is no way (that I know of) to look at what your PATH was
> before it was destroyed and the PATH is often updated by installers (as
> it is with dmd).
>
> [1]
> http://nsis.sourceforge.net/Environmental_Variables:_append,_prepend,_and_remove_entries#Warning
> [2] http://nsis.sourceforge.net/Special_Builds
>
> Regards,
> Brad Anderson

Hi Brad,

IIRC I wrote the installer and I knew about the problem too because some 
people started complaining about it but I didn't know of the solution 
(maybe at that moment the solution was not known). So good you found it :-)

What we can do is to copy this patched EnvVarUpdate function to the 
installer script and use it, I think it'll be much more safe than to 
just hope the system that runs the nsis script has the patched function 
or the special build.

What do you think? Could you make that change and do a pull request? (I 
don't have a Windows machine near me anymore nor a VM).


More information about the Digitalmars-d mailing list