Opened 12 months ago

Last modified 12 months ago

#4007 new enhancement

grass.py and bash: respect aliases in $HOME/.bashrc

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: Default Version: git-releasebranch78
Keywords: bash Cc:
CPU: Unspecified Platform: Unspecified

Description

At time aliases defined in $HOME/.bashrc are not transferred into the GRASS GIS session (discussed in https://github.com/OSGeo/grass/pull/170 but not yet realised).

It would be way easier to work from command line if $HOME/.bashrc aliases were carried over into the current session.

As per variables.html, $HOME/.grass7/bashrc has to be written by the user which is unneeded extra work. Why this separate bashrc was invented at all, is unknown to me...

Indeed, there has been some related discussion in Feb 2013:

https://lists.osgeo.org/pipermail/grass-dev/2013-February/061857.html (and following)

Perhaps we can solve this in 2019/2020 :)

Change History (7)

comment:1 Changed 12 months ago by hcho

A workaround (current master) is to add

source ~/.bashrc

to $HOME/.grass7/bashrc.

I kind of understand why we have this separate bashrc (history for each mapset), but I'm not sure why we have two different places to read this file in grass.py: load_env (exports) and bash_startup (non-exports). Hopefully, we can make it cleaner soon.

Last edited 12 months ago by hcho (previous) (diff)

comment:2 in reply to:  1 ; Changed 12 months ago by neteler

Replying to hcho:

A workaround (current master) is ...

To make this work in G78 as well, we would have to backport

https://github.com/OSGeo/grass/pull/170

...right? If yes, are there any any objections to do so?

comment:3 in reply to:  2 Changed 12 months ago by hcho

Replying to neteler:

Replying to hcho:

A workaround (current master) is ...

To make this work in G78 as well, we would have to backport

https://github.com/OSGeo/grass/pull/170

...right? If yes, are there any any objections to do so?

You're right. No objection from me. Also, I guess this approach is better than "forcing" source ~/.bashrc. Clean aliases vs. inheriting them. Choice as long as we have a separate bashrc.

comment:4 Changed 12 months ago by neteler

ok I have backported it (pls squash-merge in future - I had to cherry-pick all commits individually).

Now: to be tested if it works in relbranch78

comment:5 Changed 12 months ago by neteler

Milestone: 7.8.2

Ticket retargeted after milestone closed

comment:6 Changed 12 months ago by neteler

Milestone: 7.8.3

comment:7 in reply to:  4 Changed 12 months ago by hcho

Replying to neteler:

ok I have backported it (pls squash-merge in future - I had to cherry-pick all commits individually).

I thought I used the Squash and merge button in GitHub?... Actually, this seems to be the only way to merge from there, I guess? Not sure what happened. Thanks for the backport!

Now: to be tested if it works in relbranch78

Last edited 12 months ago by hcho (previous) (diff)
Note: See TracTickets for help on using tickets.