[GRASS-dev] [GRASS GIS] #3347: Account for length limit of the PATH variable on MS Windows

GRASS GIS trac at osgeo.org
Mon May 8 13:54:41 PDT 2017


#3347: Account for length limit of the PATH variable on MS Windows
-------------------------------------------------+-------------------------
 Reporter:  wenzeslaus                           |      Owner:  grass-dev@…
     Type:  defect                               |     Status:  new
 Priority:  trivial                              |  Milestone:  7.2.2
Component:  wxGUI                                |    Version:  svn-
 Keywords:  PATH, environment,                   |  releasebranch72
  GRASS_ADDON_PATH, addons                       |        CPU:  Unspecified
 Platform:  MSWindows 8                          |
-------------------------------------------------+-------------------------
 When running a Python script from ''File > Launch script'' user is asked:

 {{{
 Directory '/home/...py' 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.

 [https://software.intel.com/en-us/articles/limitation-to-the-length-of-
 the-system-path-variable software.intel.com] 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 r.info 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, `grass.py` 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.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3347>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list