[GRASS-dev] [GRASS-SVN] r61051 - grass/trunk/lib/init

Huidae Cho grass4u at gmail.com
Wed Jul 9 08:44:31 PDT 2014


If that's the only reason for this change, I would keep the previous
version and let the user decide where to append GRASS_ADDON_PATH in

1. It's breaking "export NEW_VAR=$HOME/grassdata" because $HOME doesn't get
expanded by bash.

2. It's inconsistent to append ("keep") GRASS_ADDON_PATH and ignore other
environment variables in ~/.grass7/bashrc.

3. We should "not" simply ignore any environment variables in
~/.grass7/bashrc even if they already exist outside a GRASS session.

4. grass.py is appending GRASS_ADDON_PATH in ~/.grass7/bashrc only "after"
existing GRASS_ADDON_PATH. What if they want to append their path "before"
the one in ~/.grass7/bashrc?

As to my original concern, even r61216 doesn't allow overwriting PS1
initially created by grass.py. As a side effect of startswith('export'), I
can work around it by appending whitespaces before export PS1=, but I would
say that's a bug, not a feature.

Anyway, my point is we can address the original issue by adding the
following line in ~/.grass7/bashrc:

export GRASS_ADDON_PATH="$GRASS_ADDON_PATH:~/grass-addon/bin"

This is more flexible and doesn't impose "appending" of GRASS_ADDON_PATH
and ignoring other variables in ~/.grass7/bashrc. In fact, like I said
above in 1, the new version "breaks" this feature:

export NEW_VAR=$HOME/grassdata

doesn't expand to /home/user/grassdata.

IMHO, it should be the user's responsibility and rights to overwrite or not
overwrite anything available outside a GRASS session and that should happen
in ~/.grass7/bashrc.


On Wed, Jul 9, 2014 at 7:44 AM, Martin Landa <landa.martin at gmail.com> wrote:

> Hi,
> 2014-07-04 21:02 GMT+02:00 Huidae Cho <grass4u at gmail.com>:
> > Please explain why we need this change. It breaks custom PS1 and aliases
> in
> > $HOME/.grass7/bashrc.
> sorry for late answer, the original reason was:
> 1) you have defined GRASS_ADDON_PATH in $HOME/.grass7/bashrc
> 2) you launch GRASS with $ GRASS_ADDON_PATH=~/bin/md-iso grass71
> GRASS_ADDON_PATH points just to the path from `$HOME/.grass7/bashrc`.
> The patch enables to merge paths from $HOME/.grass7/bashrc together
> with `~/bin/md-iso`. I was not aware of aliases, you are absolutely
> right, I will fix it ASAP. Martin
> --
> Martin Landa * http://geo.fsv.cvut.cz/gwiki/Landa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140709/3435ec78/attachment-0001.html>

More information about the grass-dev mailing list