unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#42752] [PATCH core-updates] gnu: bash: Make completions work in non-login shells.
@ 2020-08-07 22:14 Jakub Kądziołka
  2020-08-10  9:25 ` Mathieu Othacehe
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kądziołka @ 2020-08-07 22:14 UTC (permalink / raw)
  To: 42752

Currently, /etc/bashrc is only loaded by /etc/profile. Because the
former is responsible for setting up command-specific completions, they
currently only work in login shells. This patch configures bash to load
/etc/bashrc in interactive non-login shells, as by default no
system-wide configuration is loaded.

* gnu/packages/bash.scm (bash): Set SYS_BASHRC to /etc/bashrc.
---
 gnu/packages/bash.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 47ca625d9a..9784e2ccc1 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -108,7 +108,8 @@ number/base32-hash tuples, directly usable in the 'patch-series' form."
   (let* ((cppflags (string-join '("-DDEFAULT_PATH_VALUE='\"/no-such-path\"'"
                                   "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
                                   "-DNON_INTERACTIVE_LOGIN_SHELLS"
-                                  "-DSSH_SOURCE_BASHRC")
+                                  "-DSSH_SOURCE_BASHRC"
+                                  "-DSYS_BASHRC='\"/etc/bashrc\"'")
                                 " "))
          (configure-flags
           ``("--with-installed-readline"
-- 
2.28.0





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#42752] [PATCH core-updates] gnu: bash: Make completions work in non-login shells.
  2020-08-07 22:14 [bug#42752] [PATCH core-updates] gnu: bash: Make completions work in non-login shells Jakub Kądziołka
@ 2020-08-10  9:25 ` Mathieu Othacehe
  2020-08-10 14:41   ` Jakub Kądziołka
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2020-08-10  9:25 UTC (permalink / raw)
  To: Jakub Kądziołka; +Cc: 42752


Hey Jakub,

> Currently, /etc/bashrc is only loaded by /etc/profile. Because the
> former is responsible for setting up command-specific completions, they
> currently only work in login shells. This patch configures bash to load
> /etc/bashrc in interactive non-login shells, as by default no
> system-wide configuration is loaded.

/etc/bashrc is also loaded by ~/.bashrc in "default-skeletons". So your
patch would cover the case of an interactive, non-login shell run by a
logged in user without the default ~/.bashrc file, right?

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#42752] [PATCH core-updates] gnu: bash: Make completions work in non-login shells.
  2020-08-10  9:25 ` Mathieu Othacehe
@ 2020-08-10 14:41   ` Jakub Kądziołka
  2020-08-11  8:44     ` Mathieu Othacehe
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kądziołka @ 2020-08-10 14:41 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 42752

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

On Mon, Aug 10, 2020 at 11:25:12AM +0200, Mathieu Othacehe wrote:
> 
> Hey Jakub,
> 
> > Currently, /etc/bashrc is only loaded by /etc/profile. Because the
> > former is responsible for setting up command-specific completions, they
> > currently only work in login shells. This patch configures bash to load
> > /etc/bashrc in interactive non-login shells, as by default no
> > system-wide configuration is loaded.
> 
> /etc/bashrc is also loaded by ~/.bashrc in "default-skeletons". So your
> patch would cover the case of an interactive, non-login shell run by a
> logged in user without the default ~/.bashrc file, right?

Oh! It seems I overwrote it with my own .bashrc when I migrated my
dotfiles. I still think this patch is a good idea - I think we should
make /etc/skel/.bashrc contain only nice-to-have defaults, such as
changing the prompt based on $GUIX_ENVIRONMENT, and move the essential
things to /etc/bashrc. That way, overwriting the .bashrc won't break
anything important.

I guess I should follow this patch up with an adjustment to
/etc/skel/.bashrc, removing the 'source /etc/bashrc' line?

Regards,
Jakub Kądziołka

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#42752] [PATCH core-updates] gnu: bash: Make completions work in non-login shells.
  2020-08-10 14:41   ` Jakub Kądziołka
@ 2020-08-11  8:44     ` Mathieu Othacehe
  2023-10-21 19:24       ` Maxim Cournoyer
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2020-08-11  8:44 UTC (permalink / raw)
  To: Jakub Kądziołka; +Cc: 42752


Hello,

> Oh! It seems I overwrote it with my own .bashrc when I migrated my
> dotfiles. I still think this patch is a good idea - I think we should
> make /etc/skel/.bashrc contain only nice-to-have defaults, such as
> changing the prompt based on $GUIX_ENVIRONMENT, and move the essential
> things to /etc/bashrc. That way, overwriting the .bashrc won't break
> anything important.
>
> I guess I should follow this patch up with an adjustment to
> /etc/skel/.bashrc, removing the 'source /etc/bashrc' line?

That would make sense. Maybe you could replace the sourcing by a comment
explaining how bash behaviour is altered to source /etc/bashrc for
interactive, non-login shell.

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#42752] [PATCH core-updates] gnu: bash: Make completions work in non-login shells.
  2020-08-11  8:44     ` Mathieu Othacehe
@ 2023-10-21 19:24       ` Maxim Cournoyer
  0 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2023-10-21 19:24 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: Jakub Kądziołka, 42752

Hi,

Mathieu Othacehe <othacehe@gnu.org> writes:

> Hello,
>
>> Oh! It seems I overwrote it with my own .bashrc when I migrated my
>> dotfiles. I still think this patch is a good idea - I think we should
>> make /etc/skel/.bashrc contain only nice-to-have defaults, such as
>> changing the prompt based on $GUIX_ENVIRONMENT, and move the essential
>> things to /etc/bashrc. That way, overwriting the .bashrc won't break
>> anything important.
>>
>> I guess I should follow this patch up with an adjustment to
>> /etc/skel/.bashrc, removing the 'source /etc/bashrc' line?
>
> That would make sense. Maybe you could replace the sourcing by a comment
> explaining how bash behaviour is altered to source /etc/bashrc for
> interactive, non-login shell.

I somewhat weary of the undefined behavior this could have on foreign
distributions?

I'll close this, but feel free to continue discussing it here.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-21 19:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 22:14 [bug#42752] [PATCH core-updates] gnu: bash: Make completions work in non-login shells Jakub Kądziołka
2020-08-10  9:25 ` Mathieu Othacehe
2020-08-10 14:41   ` Jakub Kądziołka
2020-08-11  8:44     ` Mathieu Othacehe
2023-10-21 19:24       ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).