[PATCH core-updates] gnu: bash: Make completions work in non-login shells.

  • Done
  • quality assurance status badge
Details
3 participants
  • Jakub K?dzio?ka
  • Maxim Cournoyer
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Jakub K?dzio?ka
Severity
normal
J
J
Jakub K?dzio?ka wrote on 8 Aug 2020 00:14
(address . guix-patches@gnu.org)
20200807221439.729-1-kuba@kadziolka.net
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(-)

Toggle diff (16 lines)
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
M
M
Mathieu Othacehe wrote on 10 Aug 2020 11:25
(name . Jakub K?dzio?ka)(address . kuba@kadziolka.net)(address . 42752@debbugs.gnu.org)
87k0y6hmyv.fsf@gnu.org
Hey Jakub,

Toggle quote (6 lines)
> 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
J
J
Jakub K?dzio?ka wrote on 10 Aug 2020 16:41
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 42752@debbugs.gnu.org)
20200810144141.52fpzv6m4kqp3jix@gravity
On Mon, Aug 10, 2020 at 11:25:12AM +0200, Mathieu Othacehe wrote:
Toggle quote (13 lines)
>
> 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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl8xXKAACgkQ4xWnWEYT
FWRRdg/9G45UuvM3NwhmGMMZchWRsJDLCUfWczIrfOKp7LVhFRCWzZALTe5NntOd
p7NufYD2dgMFfnw2RaWBYHf7k1rE8EIEoGp1C4f1UF92X+G/+TAZEO95c/yk89MM
Z4LsGz7hn9ceLFeo11k5mxqwEhj0KVxtbzC2NRg2SeTYPIcG+Sb4Eo79fnEANZa2
2SsJ5oWQnDIYDG/JqLhOZEk3QxTmNp0Orzlx7yte0K/XbkLUt05ETFZuDNDHvHhs
8PaVobUHSH5Mjm9xukqgLLQ8A24LcsZbXgSslAafydKRphkzKn7HN4tl9Ug2qn+6
ntFCUxGqwNmicW8EzoOWFClL1WsDYCAX2BpttI7NCl1qdBrPnpCIC2R8esOJv/ew
V7qL1QAIl8FZIZtehBmQ0qukDAz0sSHWUfnbKV6zLi8m9OvU5fguot7HqxFGKU3B
+F1Xu7GUgetIScNpLeT+Rsb4PYAfJmWSGoF+qMEOCcuJCtR/q9Z6MAe1iYkV9wa6
kh6Ehx5dBjUNkSJBOwH+YqrHA1IwfDnPe55kTgl4zyAy0C/jnqUcBO0zobhB/Eul
VYNGL2O/APbkJME/CzlgZ3N+MniBeDx9t8TCANHg1yyuagJtdsghtHSfI2l2qUyS
kNk7a/z89j8gT99VSGAecp1McuKWsvu4PKAE4UnZsBgbSdejbZY=
=zA6M
-----END PGP SIGNATURE-----


M
M
Mathieu Othacehe wrote on 11 Aug 2020 10:44
(name . Jakub K?dzio?ka)(address . kuba@kadziolka.net)(address . 42752@debbugs.gnu.org)
874kp9y3ka.fsf@gnu.org
Hello,

Toggle quote (10 lines)
> 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
M
M
Maxim Cournoyer wrote on 21 Oct 2023 21:24
Re: bug#42752: [PATCH core-updates] gnu: bash: Make completions work in non-login shells.
(name . Mathieu Othacehe)(address . othacehe@gnu.org)
875y2zeq3x.fsf_-_@gmail.com
Hi,

Mathieu Othacehe <othacehe@gnu.org> writes:

Toggle quote (16 lines)
> 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
M
M
Maxim Cournoyer wrote on 21 Oct 2023 21:24
control message for bug #42752
(address . control@debbugs.gnu.org)
874jijeq3p.fsf@gmail.com
tags 42752 notabug
close 42752
quit
?
Your comment

This issue is archived.

To comment on this conversation send an email to 42752@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 42752
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch