[GRASS-dev] [GRASS GIS] #3462: Allow setting environment variables in grass startup script

GRASS GIS trac at osgeo.org
Tue Dec 19 00:18:22 PST 2017


#3462: Allow setting environment variables in grass startup script
--------------------------+-------------------------
  Reporter:  mankoff      |      Owner:  grass-dev@…
      Type:  enhancement  |     Status:  new
  Priority:  major        |  Milestone:
 Component:  Default      |    Version:  7.2.2
Resolution:               |   Keywords:
       CPU:  Unspecified  |   Platform:  MacOSX
--------------------------+-------------------------

Comment (by mankoff):

 Yes this is something MAC related. The Fink installation of GRASS gets
 around this by modifying the program to look for a `GRASS_LIBRARY_PATH`
 which lets me set the `DYLD_LIBRARY_PATH`. I'm using MacPorts and this
 modification has not been made.

 I get that as mentioned earlier, environment variables should be loaded by
 `load_env()`. But  nobody has offered an explanation for why `export`
 statements are ignored here. GRASS is, generally, a power user tool and
 lets the users do what they want. Why is it acting in such a protective
 manner here?

 Results from running GRASS with `GRASS_DEBUG=ON` are:

 {{{
 $ GRASS_DEBUG=ON  grass72 -c EPSG:3413 ./Gtmp
 DEBUG: GRASS_DEBUG environmental variable is set. It is meant to be an
 internal variable for debugging only this script.
  Use 'g.gisenv set="DEBUG=[0-5]"' to turn GRASS GIS debug mode on if you
 wish to do so.
 DEBUG: Environmental variable set BAR=42
 DEBUG: Environmental variable set
 DYLD_LIBRARY_PATH=/opt/local/share/grass-7.2.2/lib
 DEBUG: Tmp directory
 '/var/folders/7y/lbz1bs057398tql00m7fz0hr0000gn/T/grass7-kdm-10348'
 created for user 'kdm'
 Cleaning up temporary files...
 access: No such file or directory
 ERROR: LOCATION </Users/kdm/Gtmp> not available
 Creating new GRASS GIS location/mapset...
 DEBUG: Mapset </Users/kdm/Gtmp/PERMANENT> locked using
 '/Users/kdm/Gtmp/PERMANENT/.gislock'

           __________  ___   __________    _______________
          / ____/ __ \/   | / ___/ ___/   / ____/  _/ ___/
         / / __/ /_/ / /| | \__ \\_  \   / / __ / / \__ \
        / /_/ / _, _/ ___ |___/ /__/ /  / /_/ // / ___/ /
        \____/_/ |_/_/  |_/____/____/   \____/___//____/

 Welcome to GRASS GIS 7.2.2
 GRASS GIS homepage:                      http://grass.osgeo.org
 This version running through:            Bash Shell (/bin/bash)
 Help is available with the command:      g.manual -i
 See the licence terms with:              g.version -c
 See citation options with:               g.version -x
 Start the GUI with:                      g.gui wxpython
 When ready to quit enter:                exit

 DEBUG: GRASS GUI should be <text>
 .grass.bashrc
 .grass7/bashrc
 GRASS 7.2.2 (Gtmp):~ > env | grep BAR
 BAR=42
 GRASS 7.2.2 (Gtmp):~ > env | grep DY
 GRASS 7.2.2 (Gtmp):~ >
 }}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3462#comment:10>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list