Opened 6 years ago

Last modified 4 years ago

#3347 new defect

Account for length limit of the PATH variable on MS Windows

Reported by: wenzeslaus Owned by: grass-dev@…
Priority: trivial Milestone: 7.6.2
Component: wxGUI Version: svn-releasebranch72
Keywords: PATH, environment, GRASS_ADDON_PATH, addons Cc:
CPU: Unspecified Platform: MSWindows 8


When running a Python script from File > Launch script user is asked:

Directory '/home/' is not defined in GRASS_ADDON_PATH.
Do you want add this directory to GRASS_ADDON_PATH?

If the answer is Yes, then the script path is added to a file in the configuration directory (/home/joedoe/.grass7/bashrc on Linux C:\Users\joedoe\...\env.bat on MS Windows). If the user does it couple of times on MS Windows and the paths are long enough, the PATH variable (updated from GRASS_ADDON_PATH) reaches its length limit and reading the variable results in nothing causing all programs to fail. says the following:

Limitation to the length of the System PATH variable

Summary: This article discusses the limitation to the length of the strings that you use in the System PATH variable; overflow symptoms; and possible workarounds

Details: On computers running Microsoft Windows*, the PATH environment variable size that you can use is 2047 characters. On computers running Microsoft Windows* 7 and later, the maximum PATH environment variable size that you can use is 4095 characters (but the system restart is required).

This limitation applies to the command line, individual environment variables (such as the PATH variable) that are inherited by other processes, and all environment variable expansions. If you use Command Prompt to run batch files, this limitation also applies to batch file processing.

Just as an interesting side note, you can select a raster and it renders in GUI, but fails from GUI (Metadata) and command line.

Possible solution: Before extending the GRASS_ADDON_PATH variable the GUI should check if it won't be too long when added to PATH variable. Optionally, should also check that before adding to PATH. It might be worth to double check for duplicates in GRASS_ADDON_PATH.

Workaround: Delete (or rename) the env.bat file which is somewhere in C:\Users\joedoe\AppData\Roaming\GRASS7 or rename the GRASS7 configuration directory.

Change History (4)

comment:1 by neteler, 5 years ago


Ticket retargeted after milestone closed

comment:2 by martinl, 5 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:3 by martinl, 5 years ago

Milestone: 7.2.4

comment:4 by martinl, 4 years ago

Note: See TracTickets for help on using tickets.