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

bash-completion: fix sha256 hash #107736

Closed
wants to merge 1 commit into from
Closed

bash-completion: fix sha256 hash #107736

wants to merge 1 commit into from

Conversation

rb2k
Copy link
Contributor

@rb2k rb2k commented Dec 27, 2020

Motivation for this change

When building from source, this currently fails

trying https://github.com/scop/bash-completion/archive/2.11.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   126  100   126    0     0    281      0 --:--:-- --:--:-- --:--:--   281
100  349k    0  349k    0     0   258k      0 --:--:--  0:00:01 --:--:-- -5575
unpacking source archive /private/var/folders/1c/pv33w80d0_n7w14hwrj92p30000xbj/T/nix-build-source.drv-0/2.11.tar.gz
hash mismatch in fixed-output derivation '/opt/facebook/nix/store/mcll1q71rick2kpk0pldabmfby6c9jr6-source':
  wanted: sha256:0m3brd5jx7w07h8vxvvcmbyrlnadrx6hra3cvx6grzv6rin89liv
  got:    sha256:1kyj62wp4sd8629r1gx5ggnkkjfkwvggj98d6cwlx14y3iri0l87

Confirming with nix-prefetch-git you can see that the hash is indeed different

mseeger@mseeger-mbp ~ % nix-shell -p nix-prefetch-git
these paths will be fetched (1.40 MiB download, 6.37 MiB unpacked):
  /nix/store/a3gnmvpalpa8xy4ravxzdymxxqk3wibj-nix-2.3.9-man
  /nix/store/l7afg8w5c647ackdib6sjkl1sg0wjal3-nix-prefetch-git
  /nix/store/rhar968059hphm65x1snpp95qhfzj4dw-nix-2.3.9
copying path '/nix/store/a3gnmvpalpa8xy4ravxzdymxxqk3wibj-nix-2.3.9-man' from 'https://cache.nixos.org'...
copying path '/nix/store/rhar968059hphm65x1snpp95qhfzj4dw-nix-2.3.9' from 'https://cache.nixos.org'...
copying path '/nix/store/l7afg8w5c647ackdib6sjkl1sg0wjal3-nix-prefetch-git' from 'https://cache.nixos.org'...

[nix-shell:~]$ nix-prefetch-git https://github.com/scop/bash-completion 2.11
Initialized empty Git repository in /private/tmp/git-checkout-tmp-O9EBQo1o/bash-completion/.git/
remote: Enumerating objects: 1404, done.
remote: Counting objects: 100% (1404/1404), done.
remote: Compressing objects: 100% (1164/1164), done.
remote: Total 1404 (delta 686), reused 369 (delta 173), pack-reused 0
Receiving objects: 100% (1404/1404), 501.41 KiB | 1.93 MiB/s, done.
Resolving deltas: 100% (686/686), done.
From https://github.com/scop/bash-completion
 * tag               2.11       -> FETCH_HEAD
Switched to a new branch 'fetchgit'
removing `.git'...

git revision is b12639a6becec13a0a2c06173ba40fb3bbe972e1
path is /nix/store/bv8p05zsilary8lylwfmqw1bc6bhwmrl-bash-completion
git human-readable version is -- none --
Commit date is 2020-07-25 11:25:49 +0300
hash is 1kyj62wp4sd8629r1gx5ggnkkjfkwvggj98d6cwlx14y3iri0l87
{
  "url": "https://github.com/scop/bash-completion",
  "rev": "b12639a6becec13a0a2c06173ba40fb3bbe972e1",
  "date": "2020-07-25T11:25:49+03:00",
  "path": "/nix/store/bv8p05zsilary8lylwfmqw1bc6bhwmrl-bash-completion",
  "sha256": "1kyj62wp4sd8629r1gx5ggnkkjfkwvggj98d6cwlx14y3iri0l87",   <---------- Here
  "fetchSubmodules": false,
  "deepClone": false,
  "leaveDotGit": false
}
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@rb2k
Copy link
Contributor Author

rb2k commented Dec 27, 2020

Oh wait... I see my colleague actually tried to address this in https://github.com/NixOS/nixpkgs/pull/107511/files

I'm trying to understand the comment in there that says "The checksum you have provided will work on your computer, as the output checksum matches something that was already fetched".

I still get this error on newly provisioned machines when trying to build from source. I guess we somehow add a package that has the same name but a different hash somehow?

@rb2k
Copy link
Contributor Author

rb2k commented Dec 27, 2020

Even when I move the path that it complains about beforehand:

[root@host ~]# mv /opt/facebook/nix/store/mcll1q71rick2kpk0pldabmfby6c9jr6-source /opt/facebook/nix/store/ignorethis

I get this:

Installing bash-completion
warning: there are multiple derivations named 'bash-completion-2.11'; using the first one
installing 'bash-completion-2.11'
these derivations will be built:
  /opt/facebook/nix/store/97d8xqazgby3ixs3nwh7zkxvvvvd81h5-source.drv
  /opt/facebook/nix/store/0a47s51fyw0iymyli5y7009r49z80lfp-bash-completion-2.11.drv
building '/opt/facebook/nix/store/97d8xqazgby3ixs3nwh7zkxvvvvd81h5-source.drv'...

trying https://github.com/scop/bash-completion/archive/2.11.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   126  100   126    0     0    402      0 --:--:-- --:--:-- --:--:--   402
100  349k    0  349k    0     0   232k      0 --:--:--  0:00:01 --:--:--  738k
unpacking source archive /private/var/folders/1c/pv33w80d0_n7w14hwrj92p30000xbj/T/nix-build-source.drv-0/2.11.tar.gz
hash mismatch in fixed-output derivation '/opt/facebook/nix/store/mcll1q71rick2kpk0pldabmfby6c9jr6-source':
  wanted: sha256:0m3brd5jx7w07h8vxvvcmbyrlnadrx6hra3cvx6grzv6rin89liv
  got:    sha256:1kyj62wp4sd8629r1gx5ggnkkjfkwvggj98d6cwlx14y3iri0l87
cannot build derivation '/opt/facebook/nix/store/0a47s51fyw0iymyli5y7009r49z80lfp-bash-completion-2.11.drv': 1 dependencies couldn't be built
error: build of '/opt/facebook/nix/store/0a47s51fyw0iymyli5y7009r49z80lfp-bash-completion-2.11.drv' failed

I wonder if the issue is the "warning: there are multiple derivations named 'bash-completion-2.11'; using the first one" line?

@rb2k
Copy link
Contributor Author

rb2k commented Dec 27, 2020

I'll actually collect a bit more information and take this to the forums / IRC :)

@rb2k rb2k closed this Dec 27, 2020
@KamilaBorowska
Copy link
Member

KamilaBorowska commented Dec 27, 2020

/nix/store is not designed to modified outside of Nix tooling - doing so will corrupt the store causing weird, hard to debug issues. Use nix-store --delete /path instead. You may want to repair your store with nix-store --verify --check-contents --repair considering you have done operations outside of Nix tooling.

You can use nix-prefetch-url to prefetch GitHub repository if that may help debugging.

nix-prefetch-url --unpack https://github.com/scop/bash-completion/archive/2.11.zip

This provides 0m3brd5jx7w07h8vxvvcmbyrlnadrx6hra3cvx6grzv6rin89liv hash on my computer.

Also, something I find interesting is that /nix/store is in /opt/facebook. While alternate nix store locations should work, they are mostly untested, so this could cause issues, there is a possibility fetchzip incorrectly computes hash of nix store path (which would be a bug, but one that should be fixed in fetchzip).

@rb2k
Copy link
Contributor Author

rb2k commented Dec 27, 2020

@xfix that command is pretty angry on my (macOS) laptop (which has regular /nix):

mseeger@mseeger-mbp ~ % nix-prefetch-url --unpack https://github.com/scop/bash-completion/archive/2.11.zip
unpacking...
[0.8 MiB DL]checkdir error:  cannot create /private/tmp/nix-48190-0/unpacked/bash-completion-2.11/test/fixtures/_filedir/a+?
                 Illegal byte sequence
                 unable to process bash-completion-2.11/test/fixtures/_filedir/a+?/.
checkdir error:  cannot create /private/tmp/nix-48190-0/unpacked/bash-completion-2.11/test/fixtures/_filedir/a+?
                 Illegal byte sequence
                 unable to process bash-completion-2.11/test/fixtures/_filedir/a+?/g.
error:  cannot create /private/tmp/nix-48190-0/unpacked/bash-completion-2.11/test/fixtures/_get_cword/+?+?+?+?-?
        Illegal byte sequence
replace /private/tmp/nix-48190-0/unpacked/bash-completion-2.11/test/fixtures/evince/.DVI.bz2? [y]es, [n]o, [A]ll, [N]one, [r]ename: 

on my linux box:

marc@thesilence:~> nix-prefetch-url --unpack https://github.com/scop/bash-completion/archive/2.11.zip
unpacking...
[0.8 MiB DL]
path is '/nix/store/ikhzx6piqwl5q1nrnk0drj8nlk46rpnr-2.11.zip'
0m3brd5jx7w07h8vxvvcmbyrlnadrx6hra3cvx6grzv6rin89liv

It seems they have a history of 'can't have this weird character sequence on operating system x'. My laptop (and our produciton systems) are APFS, I wonder if that causes issues with this. Any chance hydra is HFS+ still?

@rb2k
Copy link
Contributor Author

rb2k commented Dec 27, 2020

Filed this as issue #107768

@rb2k rb2k deleted the patch-1 branch December 28, 2020 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants