jtojnar / nixpkgs-hammering

Beat your package expressions into a shape
MIT License
245 stars 14 forks source link

'called with unexpected argument 'hash'' #73

Open rmcgibbo opened 3 years ago

rmcgibbo commented 3 years ago

at 8aafc3a382b396bf1cf7a156702254b18e2a6ba3

# bzip2 builds okay
[nix-shell:~/projects/nixpkgs]$ nix build -f . bzip2 && echo "Success"
Success

# but hammer crashes
[nix-shell:~/projects/nixpkgs]$ nix run -f /home/mcgibbon/projects/nixpkgs-hammering -c nixpkgs-hammer -f . --json bzip2
error: --- TypeError ------------------------------------------------------------------------------------------------------------- nix-instantiate
at: (26:6) in file: /home/mcgibbon/projects/nixpkgs/pkgs/development/interpreters/python/fetchpypi.nix

    25|     url = computeUrl (builtins.removeAttrs attrs ["sha256" "hash"]) ;
    26|   in fetchurl {
      |      ^
    27|     inherit url sha256 hash;

anonymous function at /home/mcgibbon/projects/nixpkgs/pkgs/build-support/fetchurl/boot.nix:5:1 called with unexpected argument 'hash'
(use '--show-trace' to show detailed location information)
Traceback (most recent call last):
  File "/nix/store/dnma1329bwy5fn4id4v1i9w4bdkdws7h-nixpkgs-hammer/bin/.nixpkgs-hammer-wrapped", line 318, in <module>
    main(args)
  File "/nix/store/dnma1329bwy5fn4id4v1i9w4bdkdws7h-nixpkgs-hammer/bin/.nixpkgs-hammer-wrapped", line 238, in main
    overlay_data = nix_eval_json(all_messages_nix, args.show_trace)
  File "/nix/store/dnma1329bwy5fn4id4v1i9w4bdkdws7h-nixpkgs-hammer/bin/.nixpkgs-hammer-wrapped", line 70, in nix_eval_json
    result = subprocess.check_output(args, encoding="utf-8", input=expr)
  File "/nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-instantiate', '--strict', '--json', '--eval', '-']' returned non-zero exit status 1.
rmcgibbo commented 3 years ago

It seems completely unrelated to nixpkgs-hammering -- like there's a bug in how fetchpypi.nix calls fetchurl, but I'm not sure.

jtojnar commented 3 years ago

Yeah, I have seen that in nixpkgs with flakes sometimes (e.g. https://github.com/NixOS/nixpkgs/issues/97176). The bootstrapping fetchurl defined in boot.nix does not accept all the arguments fetchurl does. Not sure how to avoid triggering that though.

rmcgibbo commented 3 years ago

This is another attr that triggers this crash:

nixpkgs-hammer -f . --json --exclude attribute-ordering --exclude explicit-phases --exclude attribute-typo --exclude no-build-output gccForLibs
error: --- TypeError ------------------------------------------------------------------------------------------------------------- nix-instantiate
at: (17:2) in file: /home/mcgibbon/projects/nixpkgs/pkgs/build-support/fetchzip/default.nix

    16| 
    17| (fetchurl ({
      |  ^
    18|   inherit name;

anonymous function at /home/mcgibbon/projects/nixpkgs/pkgs/build-support/fetchurl/boot.nix:5:1 called with unexpected argument 'meta'
(use '--show-trace' to show detailed location information)
Traceback (most recent call last):
  File "/nix/store/sgyxvyzm85siv7ivwv6cca7v29hf430l-nixpkgs-hammer/bin/.nixpkgs-hammer-wrapped", line 399, in <module>
    main(args)
  File "/nix/store/sgyxvyzm85siv7ivwv6cca7v29hf430l-nixpkgs-hammer/bin/.nixpkgs-hammer-wrapped", line 326, in main
    overlay_data = nix_eval_json(all_messages_nix, args.show_trace)
  File "/nix/store/sgyxvyzm85siv7ivwv6cca7v29hf430l-nixpkgs-hammer/bin/.nixpkgs-hammer-wrapped", line 136, in nix_eval_json
    json_text = subprocess.check_output(args, text=True, input=expr)
  File "/nix/store/yl69v76azrz4daiqksrhb8nnmdiqdjg9-python3-3.8.8/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/nix/store/yl69v76azrz4daiqksrhb8nnmdiqdjg9-python3-3.8.8/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-instantiate', '--strict', '--json', '--eval', '-']' returned non-zero exit status 1.