NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.49k stars 12.99k forks source link

wireshark-qt fails to build from source #296804

Open sbourdeauducq opened 3 months ago

sbourdeauducq commented 3 months ago

Describe the bug

Can't build wireshark-qt due to source archive hash mismatch.

error: hash mismatch in fixed-output derivation '/nix/store/f7h76ivw219pz659wxa7ncdmqs3kmg3n-source.drv':
         specified: sha256-ooCJYmSOMOVnA82k3lOMWP4FL7ZHYUBqtl8MprD7rwo=
            got:    sha256-NmxDDsOC3JOsOuOT68H42v0LKBrTJ0XLXDbMVCT3BnQ=
error: 1 dependencies of derivation '/nix/store/2yvdcqxq56m8bbvwn7mwjnsvkg5284sl-wireshark-qt-4.0.12.drv' failed to build

Steps To Reproduce

Steps to reproduce the behavior:

  1. Disable the cache.nixos.org substituter
  2. nix-shell -p wireshark-qt

Additional context

nixpkgs 23.11.5408.8ac30a39abc5

Notify maintainers

@bjornfor @fpletz @paveloom

bjornfor commented 3 months ago

Can reproduce (on release-23.11 @ 5d39f83d536ca7b0cc495691c9b77a5a91389b6c):

$ nix-build -A wireshark-qt.src --check
this path will be fetched (40.95 MiB download, 281.35 MiB unpacked):
  /nix/store/4lm96g7plsv72504mvwxvy0r8sgya54h-source
copying path '/nix/store/4lm96g7plsv72504mvwxvy0r8sgya54h-source' from 'https://cache.nixos.org'...
copying path '/nix/store/sdwrgzn5rpzkyssapvmp9wzsaimm40jh-glibc-locales-2.38-44' from 'https://cache.nixos.org'...
checking outputs of '/nix/store/f7h76ivw219pz659wxa7ncdmqs3kmg3n-source.drv'...

trying https://gitlab.com/api/v4/projects/wireshark%2Fwireshark/repository/archive.tar.gz?sha=v4.0.12
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 53.1M    0 53.1M    0     0  7570k      0 --:--:--  0:00:07 --:--:-- 7162k
unpacking source archive /build/archive.tar.gz?sha=v4.0.12
error: hash mismatch in fixed-output derivation '/nix/store/f7h76ivw219pz659wxa7ncdmqs3kmg3n-source.drv':
         specified: sha256-ooCJYmSOMOVnA82k3lOMWP4FL7ZHYUBqtl8MprD7rwo=
            got:    sha256-NmxDDsOC3JOsOuOT68H42v0LKBrTJ0XLXDbMVCT3BnQ=
bjornfor commented 3 months ago

This seems to be the diff:

$ diff -uNr /nix/store/4lm96g7plsv72504mvwxvy0r8sgya54h-source /nix/store/4z0p3bi9hz25sx8zdxk5dh9a8gjgg5bc-source | less
diff -uNr /nix/store/4lm96g7plsv72504mvwxvy0r8sgya54h-source/tools/make-version.py /nix/store/4z0p3bi9hz25sx8zdxk5dh9a8gjgg5bc-source/tools/make-version.py
--- /nix/store/4lm96g7plsv72504mvwxvy0r8sgya54h-source/tools/make-version.py    1970-01-01 01:00:01.000000000 +0100
+++ /nix/store/4z0p3bi9hz25sx8zdxk5dh9a8gjgg5bc-source/tools/make-version.py    1970-01-01 01:00:01.000000000 +0100
@@ -45,7 +45,7 @@
 # git archive did not replace the $Format string, which
 # means that this not a git archive.
 GIT_EXPORT_SUBST_H = 'bf0886019de2cef8cd3e453de9606cbaa4471d3e'
-GIT_EXPORT_SUBST_D = 'tag: wireshark-4.0.12, tag: v4.0.12, refs/merge-requests/13888/head, refs/keep-around/bf0886019de2cef8cd3e453de9606cbaa4471d3e'
+GIT_EXPORT_SUBST_D = 'tag: wireshark-4.0.12, tag: v4.0.12, refs/keep-around/bf0886019de2cef8cd3e453de9606cbaa4471d3e'
 IS_GIT_ARCHIVE = not GIT_EXPORT_SUBST_H.startswith('$Format')
bjornfor commented 3 months ago

It's because of (impure) git archive substitutions: https://github.com/wireshark/wireshark/blob/bf0886019de2cef8cd3e453de9606cbaa4471d3e/tools/make-version.py#L39-L48.

I guess there's little sense in updating the source hash then, because it can change at any time?

Related issue being discussed in Nix (although this is about the nixpkgs fetcher): https://github.com/NixOS/nix/issues/5313#issuecomment-1780650439