[GRASS-dev] load_env() issues in startup

Huidae Cho grass4u at gmail.com
Tue Oct 29 18:21:16 PDT 2019


OK.. Tried to work around this limitation by adding spaces and $HOME is now
expanded into the location directory. Hmm... I kind of see why we're doing
this. Maybe, better to fix load_env()?

Huidae

On Tue, Oct 29, 2019 at 8:59 PM Huidae Cho <grass4u at gmail.com> wrote:

> Hi,
>
> Currently, .grass7/bashrc is partially broken. This file is read by two
> functions in the startup script: load_env() and *_startup() (
> https://trac.osgeo.org/grass/ticket/3462). Commenting out export lines in
> .grass7/bashrc doesn't work because load_env() splits each line twice (once
> by space and once more by equal) to create environment variables without
> ignoring commented lines. It doesn't matter whether a line is alias or
> export, or whatever as long as it contains one space and one equal sign.
> Also, load_env() doesn't expand environment variables in each line. For
> example, the following two lines:
>
> alias vi='vim'
> #export PATH="$PATH:grass/scripts"
> export GDAL_DRIVER_PATH="$HOME/gdalplugins"
>
> would create three environment variables:
>
> vi="'vim'"
> PATH="...grass paths...:\$PATH:grass/scripts"
> GDAL_DRIVER_PATH="\$HOME/gdalplugins"
>
> The first variable is not meant to be created at all, PATH shouldn't be
> modified because it's commented out, and GDAL_DRIVER_PATH is not usable
> because $HOME is not expanded.
>
> Now, my question is why do we need a separate function load_env() to
> "manually" create environment variables instead of just writing out all
> these lines into .bashrc in the mapset and letting bash handling
> everything? Is it by design or a bug?
>
> Regards,
> Huidae
> --
> Huidae Cho, Ph.D., GISP, PE (MD), CFM, M.ASCE
> Open Source GIS Developer, GRASS GIS Development Team
>


-- 
Huidae Cho, Ph.D., GISP, PE (MD), CFM, M.ASCE
Open Source GIS Developer, GRASS GIS Development Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20191029/2530e95d/attachment.html>


More information about the grass-dev mailing list