Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command-not-found gives wrong suggestion for dig #129713

Open
Kreyren opened this issue Jul 9, 2021 · 15 comments
Open

command-not-found gives wrong suggestion for dig #129713

Kreyren opened this issue Jul 9, 2021 · 15 comments
Labels
0.kind: bug Something is broken

Comments

@Kreyren
Copy link
Contributor

Kreyren commented Jul 9, 2021

Dig is currently packaged as a part of bind package which is not available:

[kreyren@leonid:~]$ dig
The program 'dig' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p bind

[kreyren@leonid:~]$ nix-shell -p bind

[nix-shell:~]$ dig
The program 'dig' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p bind

Having it packaged as a part of bind is also unexpected as it's used to check DNS records on systems that doesn't have bind running.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[kreyren@leonid:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.43, NixOS, 21.05.961.1f91fd10406 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.12`
 - channels(root): `"nixos-21.05.961.1f91fd10406"`
 - channels(kreyren): `"home-manager-21.05, master, nixos-21.05.1226.f77036342e2"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos

image

@Kreyren Kreyren added the 0.kind: bug Something is broken label Jul 9, 2021
@Kreyren
Copy link
Contributor Author

Kreyren commented Jul 9, 2021

CC @peti @globin

@7c6f434c
Copy link
Member

7c6f434c commented Jul 9, 2021 via email

@roberth
Copy link
Member

roberth commented Jul 9, 2021

Regarding command-not-found:

We do have aliases dig and dnsutils, but perhaps the problem is:

nix-repl> dig.meta.name 
"bind-9.16.16"

Maybe we could overrideAttrs to change the meta.name, but if dig uses meta.name in the first place, that'd be the root cause. It should use the attribute. All I could find just now is that it uses programs.sqlite from the channel, for which I haven't found docs yet. Considering that it relates to the channels feature, it's probably quite broken.

We could also switch to nix-index if that solves the problem. #39789

@Kreyren
Copy link
Contributor Author

Kreyren commented Jul 9, 2021

You do not need bind running locally for dig @7c6f434c

I am aware of that, but the concern is storage space on a system with limited memory like the one i use.

@roberth
Copy link
Member

roberth commented Jul 9, 2021

The dnsutils output (which is what the dig attribute points to) does reference the default output.

$ nix why-depends /nix/store/h1f78bsfigsfi4d3w2wlgir4nsl5dp3x-bind-9.16.16-dnsutils /nix/store/2i1w0fhbfvjdvs0rgzycal6sbvpzhpfz-bind-9.16.16
/nix/store/h1f78bsfigsfi4d3w2wlgir4nsl5dp3x-bind-9.16.16-dnsutils
└───bin/delv: …an be specified....../nix/store/2i1w0fhbfvjdvs0rgzycal6sbvpzhpfz-bind-9.16.16/etc/bind.keys..Inv…
    → /nix/store/2i1w0fhbfvjdvs0rgzycal6sbvpzhpfz-bind-9.16.16

$ strings /nix/store/h1f78bsfigsfi4d3w2wlgir4nsl5dp3x-bind-9.16.16-dnsutils/bin/delv | grep 2i1w0fh 
/nix/store/2i1w0fhbfvjdvs0rgzycal6sbvpzhpfz-bind-9.16.16/etc/bind.keys

So it seems to be a matter of avoiding or removing that reference. Or placing it in its own output I guess.

@asbachb
Copy link
Contributor

asbachb commented Jul 28, 2021

I'm falling in that trap quite often as well.

@7c6f434c
Copy link
Member

7c6f434c commented Aug 4, 2021

delv into its own output sounds good to me

@SuperSandro2000
Copy link
Member

I think the dig top-level alias should have solved this problem

@cyounkins
Copy link
Contributor

The problematic behavior described in the OP of the command-not-found handler suggesting nix-shell -p bind when dig is not installed, and that command not installing dig, is still present today on unstable:

craig@nixos-unstable ~> dig
The program 'dig' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p bind
craig@nixos-unstable ~ [127]> nix-shell -p bind
...
[nix-shell:~]$ dig
The program 'dig' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p bind

I frankly don't follow the discussion above about multi-outputs. Maybe this issue should be moved/refiled? This issue's name could be improved, maybe "command-not-found gives wrong suggestion for dig". I suggest re-opening the issue.

If anyone finds this via search, you can use nix-shell -p dig (not bind) to get dig.

@roberth roberth changed the title Command dig is wrongly packaged command-not-found gives wrong suggestion for dig Nov 14, 2021
@roberth
Copy link
Member

roberth commented Nov 14, 2021

I agree with @cyounkins.
Regarding multi-outputs, dig depends on bind, but bind is only 1.3MB. If someone considers this a problem, please open an issue or PR.

command-not-found suggests installing bind instead of dig. This seems to be a bigger problem.

@binarydigitz01
Copy link
Contributor

I have a similar problem, but with gitk. Gitk reports to install git-doc, but it's in gitFull.

@YellowOnion
Copy link
Contributor

Still broken, command-not-found is pretty shit script it has some hard coded stuff that break it on non-standard systems, which is annoying.

@SuperSandro2000
Copy link
Member

No surprise to me since no one fixed it.

command-not-found is pretty shit script it has some hard coded stuff that break it on non-standard systems, which is annoying.

That's the curse of a none standard system: Things might break because they where not being considered. Without more information that is the most useful answer I can give you to your problem.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/confusing-errors-suggestions/29473/2

vcunat added a commit to vcunat/nixpkgs that referenced this issue Jul 31, 2024
I *think* people expect to get the tools when:
 - adding `nss` to build inputs
 - doing `nix-shell -p nss`

And `command-not-found` is unhelpful there either: NixOS#129713

(.out still won't depend on .tools, of course)
@SpiderUnderUrBed

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

10 participants