all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bash: have: command not found
@ 2024-12-06 14:14 Einar Largenius
  2024-12-06 19:17 ` Tobias Geerinckx-Rice
  2024-12-07  4:01 ` Nils Landt
  0 siblings, 2 replies; 9+ messages in thread
From: Einar Largenius @ 2024-12-06 14:14 UTC (permalink / raw)
  To: help-guix

Hello,

For a while now every time I start a terminal I get the following message, right before my prompt:

    bash: have: command not found

It doesn't appear to impact the functionality of the shell.

If I then run:

    LANG=C bash -x

Some of the contents are:

    ...
    + for f in "$HOME"/.guix-profile/etc/bash_completion.d/*
    + . /home/me/.guix-profile/etc/bash_completion.d/img2sixel
    ++ have img2sixel
    bash: have: command not found
    ...

Here is the relevant part of my config:

    # ...
    for f in "$HOME"/.guix-profile/etc/bash_completion.d/* ; do
        . "$f"
    done
    # ...

-- 
Med vänliga hälsningar Einar


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

* Re: bash: have: command not found
  2024-12-06 14:14 bash: have: command not found Einar Largenius
@ 2024-12-06 19:17 ` Tobias Geerinckx-Rice
  2024-12-06 21:59   ` Einar Largenius
  2024-12-07  4:01 ` Nils Landt
  1 sibling, 1 reply; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2024-12-06 19:17 UTC (permalink / raw)
  To: help-guix, Einar Largenius

Hi Einar,

On 6 December 2024 14:14:54 UTC, Einar Largenius <einar.largenius@gmail.com> wrote:
>    bash: have: command not found

'have' isn't a binary or bash builtin, it's a function defined only when sourcing completion files in the intended manner using the "bash-completion" package.  You'll see that in 'bash -x' output once you fix your configuration.

>It doesn't appear to impact the functionality of the shell.

It just won't define _img2sixel() to provide completions for that command.

>Here is the relevant part of my config:
>
>    # ...
>    for f in "$HOME"/.guix-profile/etc/bash_completion.d/* ; do
>        . "$f"
>    done
>    # ...

So yeah, this is the problem.  This isn't how completion works.  Remove it.  Install "bash-completion".  Be happy.

Do you have any idea which package added this (broken) code?  Which distribution are you using?


Kind regards,

T G-R

Sent on the go.  Excuse or enjoy my brevity.


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

* Re: bash: have: command not found
  2024-12-06 19:17 ` Tobias Geerinckx-Rice
@ 2024-12-06 21:59   ` Einar Largenius
  2024-12-06 22:58     ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 9+ messages in thread
From: Einar Largenius @ 2024-12-06 21:59 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, help-guix

fredag den 06 december 2024 skrev Tobias Geerinckx-Rice:

> So yeah, this is the problem. This isn't how completion works. Remove
> it. Install "bash-completion". Be happy.

I have installed that package. Guix doesn't touch my login shell config
(.bashrc) as far as I know, so I needed to add those lines on my own. I
believe guix-home and guix-system adds loading for bash-completion
automatically.

I believe its more likely that a broken package is the culprit. In my
current profile I have 5 completion scripts only img2sixel complains.

> Do you have any idea which package added this (broken) code?

No idea, how can I tell which package adds img2sixel?

> Which distribution are you using?

I am using Fedora 41 as a foreign distro.

-- 
Med vänliga hälsningar Einar


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

* Re: bash: have: command not found
  2024-12-06 21:59   ` Einar Largenius
@ 2024-12-06 22:58     ` Tobias Geerinckx-Rice
  2024-12-09  9:16       ` Einar Largenius
  0 siblings, 1 reply; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2024-12-06 22:58 UTC (permalink / raw)
  To: Einar Largenius, help-guix

Hiya,

On 6 December 2024 21:59:12 UTC, Einar Largenius <einar.largenius@gmail.com> wrote:
>fredag den 06 december 2024 skrev Tobias Geerinckx-Rice:
>> Do you have any idea which package added this (broken) code?
>
>No idea, how can I tell which package adds img2sixel?

libsixel, through mpv, but you misunderstand me, there's nothing wrong with it.  It's the canary in the coal mine.

The 'broken code' I meant is this

>for f in "$HOME"/.guix-profile/etc/bash_completion.d/* ; do
>        . "$f"
>done

Origin aside, it's broken.  Completion files aren't written to be sourced this way.  They'll get none of the library functions normally available to them–such as 'have'.  Hence the error.  There is no bug.

The correct solution is to let the bash-completion package take care of bash completion, by sourcing etc/profile.d/bash_completion.sh at shell startup.

Guix System *does* explictly check for it!  I'd missed that.  Well spotted: <https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system.scm#n1134>

You'll have to do the same, but with $HOME/.guix-profile substituted for /run/current-system/profile.

Kind regards,

T G-R

Sent on the go.  Excuse or enjoy my brevity.


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

* Re: bash: have: command not found
  2024-12-06 14:14 bash: have: command not found Einar Largenius
  2024-12-06 19:17 ` Tobias Geerinckx-Rice
@ 2024-12-07  4:01 ` Nils Landt
  2024-12-07  5:44   ` [PATCH] gnu: libsixel: Fix bash completion Hilton Chain
  1 sibling, 1 reply; 9+ messages in thread
From: Nils Landt @ 2024-12-07  4:01 UTC (permalink / raw)
  To: Einar Largenius, help-guix

> Einar Largenius <einar.largenius@gmail.com> hat am 06.12.2024 15:14 CET geschrieben:
> 
>  
> Hello,
> 
> For a while now every time I start a terminal I get the following message, right before my prompt:
> 
>     bash: have: command not found
> 
> It doesn't appear to impact the functionality of the shell.
> 

This was reported a few months ago, see https://issues.guix.gnu.org/73142 (includes patch and link to upstream issue).
Personally, I added the following to my bashrc:

# libsixel uses have instead of _have, leading to an error.
# /usr/share/bash-completion/bash_completion defines have, but undefines it after completions are set up.
# This means it's not available for guix / nix packages.
have()
{
  _have $1 && have=yes
}


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

* [PATCH] gnu: libsixel: Fix bash completion.
  2024-12-07  4:01 ` Nils Landt
@ 2024-12-07  5:44   ` Hilton Chain
  2024-12-09  9:20       ` bug#73142: " Einar Largenius
  0 siblings, 1 reply; 9+ messages in thread
From: Hilton Chain @ 2024-12-07  5:44 UTC (permalink / raw)
  To: 73142
  Cc: Nils Landt, Einar Largenius, help-guix, Tobias Geerinckx-Rice,
	elaexuotee


* gnu/packages/image.scm (libsixel)[source]: Fix bash completion.

Fixes: https://issues.guix.gnu.org/73142
Reported-By: elaexuotee@wilsonb.com
Fixes: https://mail.gnu.org/archive/html/help-guix/2024-12/msg00029.html
Reported-by: Einar Largenius <einar.largenius@gmail.com>
Change-Id: I7e30bfa4ad6efcf27b2e89a42c34802b53bd30e0
---

Does this patch fix the issue?

 gnu/packages/image.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 7337a27b88..0367c08994 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -2831,7 +2831,12 @@ (define-public libsixel
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1nny4295ipy4ajcxmmh04c796hcds0y7z7rv3qd17mj70y8j0r2d"))))
+        (base32 "1nny4295ipy4ajcxmmh04c796hcds0y7z7rv3qd17mj70y8j0r2d"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; https://github.com/libsixel/libsixel/issues/81
+        #~(substitute* "converters/shell-completion/bash/img2sixel"
+            (("have") "_have")))))
     (build-system meson-build-system)
     (arguments
      (list

base-commit: 006679d1e6ca7acea0629b4f019c8cf89cde08be
prerequisite-patch-id: f132b4af7b85df465998e4f459bf729f8b66f320
prerequisite-patch-id: 71423f8b55ad6f04c3f3d647cbd9d42c6c332e06
prerequisite-patch-id: be124126488f174ea7e3bff735083a3edc09619a
prerequisite-patch-id: 244ca7d9a3430a90876970592a78d05207ee1893
prerequisite-patch-id: 53dc53cf4e9f0bb6e2f2c55194f3bc75a7381106
--
2.46.0


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

* Re: bash: have: command not found
  2024-12-06 22:58     ` Tobias Geerinckx-Rice
@ 2024-12-09  9:16       ` Einar Largenius
  0 siblings, 0 replies; 9+ messages in thread
From: Einar Largenius @ 2024-12-09  9:16 UTC (permalink / raw)
  To: help-guix

fredag den 06 december 2024 skrev Tobias Geerinckx-Rice:

> libsixel, through mpv, but you misunderstand me, there's nothing
> wrong with it. It's the canary in the coal mine.
>
> The 'broken code' I meant is this
>
>>for f in "$HOME"/.guix-profile/etc/bash_completion.d/* ; do
>>        . "$f"
>>done
>
> Origin aside, it's broken. Completion files aren't written to be
> sourced this way. They'll get none of the library functions normally
> available to them–such as 'have'. Hence the error. There is no bug.
>
> The correct solution is to let the bash-completion package take care
> of bash completion, by sourcing etc/profile.d/bash_completion.sh at
> shell startup.
>
> Guix System *does* explictly check for it! I'd missed that. Well
> spotted:
> <https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system.scm#n1134>
>
> You'll have to do the same, but with $HOME/.guix-profile substituted
> for /run/current-system/profile.

That seems to have resolved the issue. I added the above lines to have access to completion for the packages I have installed in my user-profile.

I changed my config to:

    # Profile-specific completion
    if [ -f  "$HOME"/.guix-profile/etc/profile.d/bash_completion.sh ]; then
        source "$HOME"/.guix-profile/etc/profile.d/bash_completion.sh
    fi

Its unfortunate that this needs to be added manually on foreign distros.

-- 
Med vänliga hälsningar Einar


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

* Re: [PATCH] gnu: libsixel: Fix bash completion.
  2024-12-07  5:44   ` [PATCH] gnu: libsixel: Fix bash completion Hilton Chain
@ 2024-12-09  9:20       ` Einar Largenius
  0 siblings, 0 replies; 9+ messages in thread
From: Einar Largenius @ 2024-12-09  9:20 UTC (permalink / raw)
  To: Hilton Chain
  Cc: 73142, Nils Landt, help-guix, Tobias Geerinckx-Rice, elaexuotee

Hi,

It turned out I sourced my completion incorrectly. When I changed my setup as per Nilss suggestion the issue stopped. I assume by sourcing it this way this issue is already taken into account and resolved elsewhere.

lördag den 07 december 2024 skrev Hilton Chain:

> * gnu/packages/image.scm (libsixel)[source]: Fix bash completion.
>
> Fixes: https://issues.guix.gnu.org/73142
> Reported-By: elaexuotee@wilsonb.com
> Fixes: https://mail.gnu.org/archive/html/help-guix/2024-12/msg00029.html
> Reported-by: Einar Largenius <einar.largenius@gmail.com>
> Change-Id: I7e30bfa4ad6efcf27b2e89a42c34802b53bd30e0
> ---
>
> Does this patch fix the issue?

-- 
Med vänliga hälsningar Einar


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

* bug#73142: [PATCH] gnu: libsixel: Fix bash completion.
@ 2024-12-09  9:20       ` Einar Largenius
  0 siblings, 0 replies; 9+ messages in thread
From: Einar Largenius @ 2024-12-09  9:20 UTC (permalink / raw)
  To: Hilton Chain
  Cc: Tobias Geerinckx-Rice, 73142, Nils Landt, help-guix, elaexuotee

Hi,

It turned out I sourced my completion incorrectly. When I changed my setup as per Nilss suggestion the issue stopped. I assume by sourcing it this way this issue is already taken into account and resolved elsewhere.

lördag den 07 december 2024 skrev Hilton Chain:

> * gnu/packages/image.scm (libsixel)[source]: Fix bash completion.
>
> Fixes: https://issues.guix.gnu.org/73142
> Reported-By: elaexuotee@wilsonb.com
> Fixes: https://mail.gnu.org/archive/html/help-guix/2024-12/msg00029.html
> Reported-by: Einar Largenius <einar.largenius@gmail.com>
> Change-Id: I7e30bfa4ad6efcf27b2e89a42c34802b53bd30e0
> ---
>
> Does this patch fix the issue?

-- 
Med vänliga hälsningar Einar




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

end of thread, other threads:[~2024-12-11  7:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 14:14 bash: have: command not found Einar Largenius
2024-12-06 19:17 ` Tobias Geerinckx-Rice
2024-12-06 21:59   ` Einar Largenius
2024-12-06 22:58     ` Tobias Geerinckx-Rice
2024-12-09  9:16       ` Einar Largenius
2024-12-07  4:01 ` Nils Landt
2024-12-07  5:44   ` [PATCH] gnu: libsixel: Fix bash completion Hilton Chain
2024-12-09  9:20     ` Einar Largenius
2024-12-09  9:20       ` bug#73142: " Einar Largenius

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.