Skip to content

Comments

ytop: Add "ytop" to ytop's error message#101098

Merged
samueldr merged 1 commit intoNixOS:masterfrom
9999years:patch-1
Oct 20, 2020
Merged

ytop: Add "ytop" to ytop's error message#101098
samueldr merged 1 commit intoNixOS:masterfrom
9999years:patch-1

Conversation

@9999years
Copy link
Contributor

Right now, running nixos-rebuild gives an obscure error:

$ nixos-rebuild switch
building Nix...
building the system configuration...
error: Abandoned by upstream. Consider switching to bottom instead
(use '--show-trace' to show detailed location information)

(And --show-trace adds no useful information.)

The error message doesn't indicate that ytop is what's causing the problem.
By adding ytop to the error message, configurations that still reference ytop will be easier to debug and fix.

Right now, running `nixos-rebuild` gives an obscure error:
```
$ nixos-rebuild switch
building Nix...
building the system configuration...
error: Abandoned by upstream. Consider switching to bottom instead
(use '--show-trace' to show detailed location information)
```

(And `--show-trace` adds no useful information.)

The error message doesn't indicate that `ytop` is what's causing the problem.
By adding `ytop` to the error message, configurations that still reference
`ytop` will be easier to debug and fix.
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Oct 19, 2020
Copy link
Member

@cole-h cole-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff LGTM. Just ran into this when bumping nixos-unstable. Thanks!

@samueldr samueldr merged commit ae2cea4 into NixOS:master Oct 20, 2020
@xaverdh
Copy link
Contributor

xaverdh commented Oct 20, 2020

Actually in that file there are some other occurrences like this, maybe we can fix them all?

@berbiche
Copy link
Member

Sorry, this is a mistake on my end. I had assumed that aliasing a package to throw an error would also give the attribute that failed to evaluate.

@9999years
Copy link
Contributor Author

No worries, @berbiche — it's a reasonable assumption and the stack-trace feature really could use some improvement. I'll see if I can fix the others @xaverdh.

@xaverdh
Copy link
Contributor

xaverdh commented Oct 20, 2020

No worries, @berbiche — it's a reasonable assumption and the stack-trace feature really could use some improvement. I'll see if I can fix the others @xaverdh.

Something like #101174 ?

@xaverdh
Copy link
Contributor

xaverdh commented Oct 20, 2020

Still as this seems a common and easy enough mistake to make, we should probably think about some form of automation.

@berbiche
Copy link
Member

berbiche commented Oct 20, 2020

Linking the RFC mentioned on IRC: NixOS/rfcs#33

9999years added a commit to 9999years/nixpkgs that referenced this pull request Oct 20, 2020
aliases.nix: errors should include package names

In `pkgs/top-level/aliases.nix`, `throw` was used to make packages that
were removed error with a more useful message than "attribute 'foobar'
missing, at <location>".

However, if the error message doesn't include the package's attribute
name, it can be difficult to determine what caused it. For example,
here's what building a configuration that referenced `ytop` looked like
recently (see NixOS#101098):

```
$ nixos-rebuild switch
building Nix...
building the system configuration...
error: Abandoned by upstream. Consider switching to bottom instead
(use '--show-trace' to show detailed location information)
```

Therefore, we modify string values in `aliases.nix` to prefix `Attribute
foobar in <nixpkgs> has been removed` to the reason message. This makes
the removed reasons a bit shorter and provides a place to unilaterally
improve these error messages in the future, rather than with one-off
changes or large sets of manual fixes.
@9999years 9999years deleted the patch-1 branch October 20, 2020 20:04
@9999years
Copy link
Contributor Author

9999years commented Oct 20, 2020

Opened #101210 to automatically add attr names, so this mistake can't be made manually any more.

$ nix repl
Welcome to Nix version 2.3.7. Type :? for help.

nix-repl> :l .
Added 12609 variables.

nix-repl> ag
«derivation /nix/store/maa4dn0d0jf96n0ir04lcw37l2x19lv6-silver-searcher-2.2.0.drv»

nix-repl> ytop
error: Attribute ytop in <nixpkgs> has been removed; abandoned by upstream. Consider switching to bottom instead

nix-repl> deepin
error: Attribute deepin in <nixpkgs> has been removed; it was a work in progress that has been canceled. See: https://github.com/NixOS/nixpkgs/issues/94870

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants