#1046 adding to system PATH environment variable can *nuke* it

Roger Pack

I noticed when installing this: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.1/OpenCV-2.1.0-win32-vs2008.exe/download
("add to system path for all users")
that it *deleted* my system PATH environment variable, and replaced it with (only)
which is obviously bad. I realize this is probably caused by some other problem but just noting it since it surprised me.


  • Anders

    Anders - 2012-01-20

    NSIS does have a string limit that makes it problematic to manipulate the system wide path environment variable but your bug is probably is some 3rd party code or a snippet from the wiki and not something we can really do anything about on this tracker...

  • Jim Michaels

    Jim Michaels - 2012-04-20

    I am going to vote for this bug. even windows XP's PATH and cmd shell length has been boosted to 8189 characters on later versions of windows and on XP 8190 characters.
    I would use something much longer to be safe in case microsoft decides to change things again. how about using c++'s string, or using a 16384-character string?

  • Ben Baker

    Ben Baker - 2012-05-25

    This is a common bug with NSIS installers because if you write code that queries a variable that is longer than the NSIS string limit (typically 1024), you get back an empty string. The code then thinks that the variable is empty, appends to it, then overwrites the current value -> nuking it.

    NSIS could fix this bug by removing the limit on string lengths so that the NSIS API could return the actual value for the PATH and the users NSIS script could append to it and write out the new value.

  • Anders

    Anders - 2012-05-25

    Changing the string handling would break all plugins. To deal with %path% you could use the system plugin to allocate memory and read the registry string...


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks