GNU bug report logs - #57498
bash-completion completion functions not loaded when using guix home

Previous Next

Package: guix;

Reported by: Maze <maze <at> pkbd.org>

Date: Wed, 31 Aug 2022 07:36:02 UTC

Severity: normal

Done: Andrew Tropin <andrew <at> trop.in>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57498 in the body.
You can then email your comments to 57498 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#57498; Package guix. (Wed, 31 Aug 2022 07:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maze <maze <at> pkbd.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 31 Aug 2022 07:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maze <maze <at> pkbd.org>
To: bug-guix <at> gnu.org
Subject: bash-completion completion functions not loaded when using guix home
Date: Wed, 31 Aug 2022 15:35:02 +0800
I don't install bash-completion into my system profile and I use only
guix home to install user packages. I typically don't guix install any
packages.

While I do include the bash-completion package in my home configuration
file, the completion bash functions do not get loaded as needed, the
resulting user experience is as if bash-completion wasn't installed,
although .bashrc is edited in the typical way to load the main file
bash_completion. But, the shell code in bash_completion cannot find and
load the individual files containing the completion functions for
individual commands.

The reason is that I don't have a ~/.guix-profile folder, my current
user profile is linked in ~/.guix-home/profile. The relevant path (in
my case) is not included in the search path for completion bash functions.

In guix this completion functions search path is defined by the patch found at
gnu/packages/patches/bash-completion-directories.patch, where you can
see the path to the guix home user profile is missing.

The patch below is a patch to the patch file I mention above from the
guix dource tree. It just adds 2 folders to the search path. 

I verified that it works for me.

---
   bash-completion: fix loading of completion functions with guix home

   * gnu/packages/patches/bash-completion-directories.patch: modified
---
 gnu/packages/patches/bash-completion-directories.patch | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/patches/bash-completion-directories.patch b/gnu/packages/patches/bash-completion-directories.patch
index 021e34653b..3c6b3082ea 100644
--- a/gnu/packages/patches/bash-completion-directories.patch
+++ b/gnu/packages/patches/bash-completion-directories.patch
@@ -10,7 +10,7 @@ This is what this patch does.
 
 --- a/bash_completion
 +++ b/bash_completion
-@@ -2016,7 +2016,13 @@ complete -F _minimal ''
+@@ -2016,7 +2016,15 @@ complete -F _minimal ''
  
  __load_completion()
  {
@@ -19,6 +19,8 @@ This is what this patch does.
 +        ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
 +        "$HOME/.guix-profile/share/bash-completion/completions/$base"
 +        "$HOME/.guix-profile/etc/bash_completion.d/$base"
++        "$HOME/.guix-home/profile/share/bash-completion/completions/$base"
++        "$HOME/.guix-home/profile/etc/bash_completion.d/$base"
 +        "/run/current-system/profile/share/bash-completion/completions/$base"
 +        "/run/current-system/profile/etc/bash_completion.d/$base" )
 +

base-commit: 47c11772dfe840a536ed7ec438fe832878f51054
-- 
2.36.1





Information forwarded to bug-guix <at> gnu.org:
bug#57498; Package guix. (Wed, 31 Aug 2022 11:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 57498 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Maze <maze <at> pkbd.org>, 57498 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: bug#57498: bash-completion completion functions not loaded when
 using guix home
Date: Wed, 31 Aug 2022 14:55:54 +0300
[Message part 1 (text/plain, inline)]
On 2022-08-31 15:35, maze <at> pkbd.org wrote:

> I don't install bash-completion into my system profile and I use only
> guix home to install user packages. I typically don't guix install any
> packages.
>
> While I do include the bash-completion package in my home configuration
> file, the completion bash functions do not get loaded as needed, the
> resulting user experience is as if bash-completion wasn't installed,
> although .bashrc is edited in the typical way to load the main file
> bash_completion. But, the shell code in bash_completion cannot find and
> load the individual files containing the completion functions for
> individual commands.
>
> The reason is that I don't have a ~/.guix-profile folder, my current
> user profile is linked in ~/.guix-home/profile. The relevant path (in
> my case) is not included in the search path for completion bash functions.
>
> In guix this completion functions search path is defined by the patch found at
> gnu/packages/patches/bash-completion-directories.patch, where you can
> see the path to the guix home user profile is missing.
>
> The patch below is a patch to the patch file I mention above from the
> guix dource tree. It just adds 2 folders to the search path. 
>
> I verified that it works for me.

Hi Maze!

That's right, the similiar fix is already applied on core-updates branch
675c5c9bbd28e5e666903aa81efaec25b1573811, unfortunately bash-completion
package update affects a lot of packages that's why it's not on master
branch yet.  Thank you for the patch, anyway!

For now, while 1.4 is not released yet, as a temporary fix I can suggest
to install the package providing bash-completion to ~/.guix-profile or
system profile.  There are other workarounds, but this one seems to be
the easiest.

>
> ---
>    bash-completion: fix loading of completion functions with guix home
>
>    * gnu/packages/patches/bash-completion-directories.patch: modified
> ---
>  gnu/packages/patches/bash-completion-directories.patch | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/patches/bash-completion-directories.patch b/gnu/packages/patches/bash-completion-directories.patch
> index 021e34653b..3c6b3082ea 100644
> --- a/gnu/packages/patches/bash-completion-directories.patch
> +++ b/gnu/packages/patches/bash-completion-directories.patch
> @@ -10,7 +10,7 @@ This is what this patch does.
>  
>  --- a/bash_completion
>  +++ b/bash_completion
> -@@ -2016,7 +2016,13 @@ complete -F _minimal ''
> +@@ -2016,7 +2016,15 @@ complete -F _minimal ''
>   
>   __load_completion()
>   {
> @@ -19,6 +19,8 @@ This is what this patch does.
>  +        ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
>  +        "$HOME/.guix-profile/share/bash-completion/completions/$base"

It seems $base not needed anymore, it's a rudiment from an old version
of the patch. I'll remove it.

>  +        "$HOME/.guix-profile/etc/bash_completion.d/$base"
> ++        "$HOME/.guix-home/profile/share/bash-completion/completions/$base"
> ++        "$HOME/.guix-home/profile/etc/bash_completion.d/$base"
>  +        "/run/current-system/profile/share/bash-completion/completions/$base"
>  +        "/run/current-system/profile/etc/bash_completion.d/$base" )
>  +
>
> base-commit: 47c11772dfe840a536ed7ec438fe832878f51054


-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

bug closed, send any further explanations to 57498 <at> debbugs.gnu.org and Maze <maze <at> pkbd.org> Request was from Andrew Tropin <andrew <at> trop.in> to control <at> debbugs.gnu.org. (Wed, 31 Aug 2022 11:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#57498; Package guix. (Wed, 31 Aug 2022 12:22:02 GMT) Full text and rfc822 format available.

Message #13 received at 57498 <at> debbugs.gnu.org (full text, mbox):

From: Maze <maze <at> pkbd.org>
To: Andrew Tropin <andrew <at> trop.in>
Cc: 57498 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: bug#57498: bash-completion completion functions not loaded when
 using guix home
Date: Wed, 31 Aug 2022 20:21:22 +0800
Thanks for the information and right, it is easy to workaround once
figured out. Next time I find a little thing of this sort I'll be sure to
check on the core-updates branch.

On Wednesday 31 August 2022 at 02:55:54PM, Andrew Tropin has written:
> On 2022-08-31 15:35, maze <at> pkbd.org wrote:
> 
> > I don't install bash-completion into my system profile and I use only
> > guix home to install user packages. I typically don't guix install any
> > packages.
> >
> > While I do include the bash-completion package in my home configuration
> > file, the completion bash functions do not get loaded as needed, the
> > resulting user experience is as if bash-completion wasn't installed,
> > although .bashrc is edited in the typical way to load the main file
> > bash_completion. But, the shell code in bash_completion cannot find and
> > load the individual files containing the completion functions for
> > individual commands.
> >
> > The reason is that I don't have a ~/.guix-profile folder, my current
> > user profile is linked in ~/.guix-home/profile. The relevant path (in
> > my case) is not included in the search path for completion bash functions.
> >
> > In guix this completion functions search path is defined by the patch found at
> > gnu/packages/patches/bash-completion-directories.patch, where you can
> > see the path to the guix home user profile is missing.
> >
> > The patch below is a patch to the patch file I mention above from the
> > guix dource tree. It just adds 2 folders to the search path. 
> >
> > I verified that it works for me.
> 
> Hi Maze!
> 
> That's right, the similiar fix is already applied on core-updates branch
> 675c5c9bbd28e5e666903aa81efaec25b1573811, unfortunately bash-completion
> package update affects a lot of packages that's why it's not on master
> branch yet.  Thank you for the patch, anyway!
> 
> For now, while 1.4 is not released yet, as a temporary fix I can suggest
> to install the package providing bash-completion to ~/.guix-profile or
> system profile.  There are other workarounds, but this one seems to be
> the easiest.
> 
> >
> > ---
> >    bash-completion: fix loading of completion functions with guix home
> >
> >    * gnu/packages/patches/bash-completion-directories.patch: modified
> > ---
> >  gnu/packages/patches/bash-completion-directories.patch | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/gnu/packages/patches/bash-completion-directories.patch b/gnu/packages/patches/bash-completion-directories.patch
> > index 021e34653b..3c6b3082ea 100644
> > --- a/gnu/packages/patches/bash-completion-directories.patch
> > +++ b/gnu/packages/patches/bash-completion-directories.patch
> > @@ -10,7 +10,7 @@ This is what this patch does.
> >  
> >  --- a/bash_completion
> >  +++ b/bash_completion
> > -@@ -2016,7 +2016,13 @@ complete -F _minimal ''
> > +@@ -2016,7 +2016,15 @@ complete -F _minimal ''
> >   
> >   __load_completion()
> >   {
> > @@ -19,6 +19,8 @@ This is what this patch does.
> >  +        ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
> >  +        "$HOME/.guix-profile/share/bash-completion/completions/$base"
> 
> It seems $base not needed anymore, it's a rudiment from an old version
> of the patch. I'll remove it.
> 
> >  +        "$HOME/.guix-profile/etc/bash_completion.d/$base"
> > ++        "$HOME/.guix-home/profile/share/bash-completion/completions/$base"
> > ++        "$HOME/.guix-home/profile/etc/bash_completion.d/$base"
> >  +        "/run/current-system/profile/share/bash-completion/completions/$base"
> >  +        "/run/current-system/profile/etc/bash_completion.d/$base" )
> >  +
> >
> > base-commit: 47c11772dfe840a536ed7ec438fe832878f51054
> 
> 
> -- 
> Best regards,
> Andrew Tropin



-- 
Maze




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Sep 2022 11:24:11 GMT) Full text and rfc822 format available.

bug unarchived. Request was from wolf <wolf <at> wolfsden.cz> to control <at> debbugs.gnu.org. (Sat, 18 Mar 2023 11:34:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#57498; Package guix. (Sat, 18 Mar 2023 11:36:02 GMT) Full text and rfc822 format available.

Message #20 received at 57498 <at> debbugs.gnu.org (full text, mbox):

From: wolf <wolf <at> wolfsden.cz>
To: 57498 <at> debbugs.gnu.org
Subject: Re: bug#57498: bash-completion completion functions not loaded when
 using guix home
Date: Sat, 18 Mar 2023 12:19:19 +0100
[Message part 1 (text/plain, inline)]
Hi,

if anyone else runs into this before the core-updates merge happens, reasonably
simple solution without installing packages into other profiles (or system-wide)
seems to be to add following into services in home definition:

;; TODO: https://issues.guix.gnu.org/57498, should not be necessary after
;;       core-updates merge
(simple-service 'guix-home-bash-completion home-bash-service-type
		(home-bash-extension
		 (bashrc (list (plain-file "load-guix-home-bash-completion" "
for f in ~/.guix-home/profile/etc/bash_completion.d/* ~/.guix-home/profile/share/bash-completion/completions/*; do
[ -r \"$f\" ] && . \"$f\"
done")))))

Leaving it here since it might be useful to someone.

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 16 Apr 2023 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.