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

nix/search: no error for empty search results if json is enabled #3570

Merged
merged 1 commit into from May 6, 2020

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented May 6, 2020

  • result list will be always empty if --json is passed
  • for scripts an empty search result is not really an error,
    we rather want to distinguish between evaluation errors and empty results

- result list will be always empty if --json is passed
- for scripts an empty search result is not really an error,
  we rather want to distinguish between evaluation errors and empty results
@Mic92
Copy link
Member Author

Mic92 commented May 6, 2020

Snippet for quick testing:

{}: {
  nix.package = pkgs.nix.overrideAttrs (old: {
    patches = [
      (pkgs.fetchpatch {
        url = "https://github.com/Mic92/nix-1/commit/e60dc42caa659985aa689958c656f26dc51eae56.patch";
        sha256 = "19cg2q34sir0q83ni6jqvxlglqsz1xld57gizqzvs8g5m5ckb806";
      })
    ];
  });
}

Before:

[nix-shell:~/git/nixpkgs]$ nix search --json > /dev/null
warning: using cached results; pass '-u' to update the cache
error: no results for the given search term(s)!

After

$ nix search --json >/dev/null
warning: using cached results; pass '-u' to update the cache

@domenkozar domenkozar merged commit 6729855 into NixOS:master May 6, 2020
@Mic92 Mic92 deleted the nix-search branch May 6, 2020 14:30
@edolstra
Copy link
Member

edolstra commented May 6, 2020

Note that it's not really worth fixing bugs in the nix search cache because it has been completely rewritten on the flakes branch.

@domenkozar
Copy link
Member

@edolstra sorry for that, do you want to revert?

@Mic92
Copy link
Member Author

Mic92 commented May 7, 2020

No need to revert. The bug is present in both branches. I fixed the flakes branch in #3572

@Mic92 Mic92 mentioned this pull request May 7, 2020
@edolstra
Copy link
Member

edolstra commented May 7, 2020

Ah sorry, I was confused with the JSON cache in the old nix search. I forgot it also has a --json flag for output :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants