Bug 222973 - shells/bash: option to enable system-wide /etc/bash.bashrc file for interactive bash shells
Summary: shells/bash: option to enable system-wide /etc/bash.bashrc file for interacti...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-13 10:52 UTC by ilyushkeane
Modified: 2019-06-17 07:36 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (ehaupt)


Attachments
Add an option to enable system-wide /etc/bash.bashrc file for interactive bash shells (683 bytes, patch)
2017-10-13 10:52 UTC, ilyushkeane
no flags Details | Diff
2nd version of add an option to enable system-wide /etc/bash.bashrc file for interactive bash shells (792 bytes, patch)
2017-10-13 15:02 UTC, ilyushkeane
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ilyushkeane 2017-10-13 10:52:21 UTC
Created attachment 187128 [details]
Add an option to enable system-wide /etc/bash.bashrc file for interactive bash shells

Hello,

lately I was trying to find a clean way to implement global bashrc and what I've found in the web is partly working solutions and inefficient workarounds.

I also found, that bash itself has system-wide /etc/bash.bashrc in the source, but commented out. So I guess it's at least convenient have this option to be available and maybe this option should be default one.

Patch for Makefile attached.
Comment 1 Emanuel Haupt freebsd_committer 2017-10-13 12:56:13 UTC
Per tradition and according to hier(7) third party applications such as bash must not install config files under /etc but rather /usr/local/etc. I'd be ok with such a non-default option but it would would probably make sense to enable SYS_BASH_LOGOUT as well otherwise the next person is going to ask for such an option. The idea is that someone who's willing to have system wide login files would probably also like to have the benefit of a global logout file.

Would the proposed solution work for you?
Comment 2 ilyushkeane 2017-10-13 15:02:05 UTC
Created attachment 187136 [details]
2nd version of add an option to enable system-wide /etc/bash.bashrc file for interactive bash shells
Comment 3 ilyushkeane 2017-10-13 15:03:06 UTC
Proposal about SYS_BASH_LOGOUT seems fair.
Relocation to $PREFIX also looks fine.
Still if csh have global /etc/csh.cshrc I'd rather propose to make an option default, but since this option more like a deviation for bash itself I don't have strong opinion on this one.
Next version of patch attached above.
Comment 4 commit-hook freebsd_committer 2017-10-29 11:37:40 UTC
A commit references this bug:

Author: ehaupt
Date: Sun Oct 29 11:37:07 UTC 2017
New revision: 453109
URL: https://svnweb.freebsd.org/changeset/ports/453109

Log:
  Provide an option to enable system-wide rc files.

  This enables:

    - System-wide .bashrc file for interactive shells
      ${PREFIX}/etc/bash.bashrc

    - System-wide .bash_logout for login shells
      ${PREFIX}/etc/bash.bash_logout

  PR:		222973
  Submitted by:	ilyushkeane@gmail.com

Changes:
  head/shells/bash/Makefile
Comment 5 Emanuel Haupt freebsd_committer 2017-10-29 11:38:14 UTC
Committed with minor modifications, thanks!
Comment 6 Maxim Khitrov 2017-11-21 01:35:25 UTC
This patch works for interactive shells, but not for reading /usr/local/etc/bash.bash_login for a login shell. A user still needs ~/.bash_login, which can, of course, be symlinked to /usr/local/etc/bash.bashrc. Is this intentional?
Comment 7 Pokemon999 2019-06-17 07:36:27 UTC
MARKED AS SPAM