Subject: [PATCH] Make bash source /etc/bashrc

From: GB <[email-masked]>
Date: Sun, 27 Aug 2023 22:59:26 +0300

At the moment, login shells source /etc/bashrc properly, while non-login
shells don't, which makes bash-completion not work unless you source the
file manually.
From bc4a68e73c0f281ec45e7e94e734f407793c254c Mon Sep 17 00:00:00 2001
From: "German Bichkovich" <[email-masked]>
Date: Sun, 27 Aug 2023 17:04:13 +0300
Subject: [PATCH] Patch bash to use /etc/bashrc

---
 gnu/packages/bash.scm                             |  5 +++--
 gnu/packages/patches/bash-use-system-bashrc.patch | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/bash-use-system-bashrc.patch

diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index bb3359d5d1..22a57dd09b 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -140,8 +140,9 @@ (define-public bash
                (base32
                 "1alv68wplnfdm6mh39hm57060xgssb9vqca4yr1cyva0c342n0fc"))
               (patch-flags '("-p0"))
-              (patches (cons (search-patch "bash-linux-pgrp-pipe.patch")
-                             %patch-series-5.1))))
+              (patches (cons* (search-patch "bash-linux-pgrp-pipe.patch")
+                              (search-patch "bash-use-system-bashrc.patch")
+                              %patch-series-5.1))))
      (version (string-append version "." (number->string (length %patch-series-5.1))))
      (build-system gnu-build-system)
 
diff --git a/gnu/packages/patches/bash-use-system-bashrc.patch b/gnu/packages/patches/bash-use-system-bashrc.patch
new file mode 100644
index 0000000000..df06d1a311
--- /dev/null
+++ b/gnu/packages/patches/bash-use-system-bashrc.patch
@@ -0,0 +1,14 @@
+Source /etc/bashrc by default. Otherwise, default login shell sources
+bash completion, while non-login shells don't.
+
+--- config-top.h	2020-11-16 17:34:26.000000000 +0200
++++ config-top.h	2023-08-27 14:14:41.404569202 +0300
+@@ -91,7 +91,7 @@
+ #define DEFAULT_BASHRC "~/.bashrc"
+ 
+ /* System-wide .bashrc file for interactive shells. */
+-/* #define SYS_BASHRC "/etc/bash.bashrc" */
++#define SYS_BASHRC "/etc/bashrc"
+ 
+ /* System-wide .bash_logout for login shells. */
+ /* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
-- 
2.41.0