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
common-updater-scripts: incorrect handling of latest nix's hash mismatch messages #54962
Comments
--- a/pkgs/common-updater/scripts/update-source-version
+++ b/pkgs/common-updater/scripts/update-source-version
@@ -96,7 +96,7 @@ fi
if [ -z "$newHash" ]; then
nix-build --no-out-link -A "$attr.src" 2>"$attr.fetchlog" >/dev/null || true
# FIXME: use nix-build --hash here once https://github.com/NixOS/nix/issues/1172 is fixed
- newHash=$(egrep -v "killing process|dependencies couldn't be built" "$attr.fetchlog" | tail -n2 | sed "s~output path .* has .* hash ‘\(.*\)’ when .* was expected\|fixed-output derivation produced path '.*' with .* hash '\(.*\)' instead of the expected hash '.*'~\1\2~" | head -n1)
+ newHash=$(egrep -v "killing process|dependencies couldn't be built|wanted: " "$attr.fetchlog" | tail -n2 | sed "s~output path .* has .* hash ‘\(.*\)’ when .* was expected\|fixed-output derivation produced path '.*' with .* hash '\(.*\)' instead of the expected hash '.*'\| got: .*:\(.*\)~\1\2\3~" | head -n1)
fi
if [ -z "$newHash" ]; then
It is increasingly messy, perhaps we can drop the old regexes, most people probably set |
What about adding a flag to nix, which turns on machine readable error messages with a guaranty that those messages will not change in a backward incompatible way? |
Alternatively, if the build fails, I think we could do something like:
|
On Thu, 31 Jan 2019 09:21:25 -0800, Jan Tojnar ***@***.***> wrote:
```
--- a/pkgs/common-updater/scripts/update-source-version
+++ b/pkgs/common-updater/scripts/update-source-version
@@ -96,7 +96,7 @@ fi
if [ -z "$newHash" ]; then
nix-build --no-out-link -A "$attr.src" 2>"$attr.fetchlog" >/dev/null || true
# FIXME: use nix-build --hash here once NixOS/nix#1172 is fixed
- newHash=$(egrep -v "killing process|dependencies couldn't be built" "$attr.fetchlog" | tail -n2 | sed "s~output path .* has .* hash ‘\(.*\)’ when .* was expected\|fixed-output derivation produced path '.*' with .* hash '\(.*\)' instead of the expected hash '.*'~\1\2~" | head -n1)
+ newHash=$(egrep -v "killing process|dependencies couldn't be built|wanted: " "$attr.fetchlog" | tail -n2 | sed "s~output path .* has .* hash ‘\(.*\)’ when .* was expected\|fixed-output derivation produced path '.*' with .* hash '\(.*\)' instead of the expected hash '.*'\| got: .*:\(.*\)~\1\2\3~" | head -n1)
fi
if [ -z "$newHash" ]; then
```
It is increasingly messy, perhaps we can drop the old regexes, most people probably set `nix.package` instead of changing nix in overlays so this would not be affected.
I'm not sure I follow, but FWIW I ran into this and I set `nix.package`
and don't set it via overlay. Looks like the new behavior is in 2.2,
the current default for `nix`:
```
$ nix run -f channel:nixos-unstable nix -i -c nix eval '(builtins.fetchurl { url = https://nixos.org; sha256 = "1111111111111111111111111111111111111111111111111111"; })'
error: hash mismatch in file downloaded from 'https://nixos.org':
wanted: sha256:1111111111111111111111111111111111111111111111111111
got: sha256:1q7rksf170b1zhy54b5cwig77ycgdiaibcbh47aq8rrw3szra24w
```
(err formatting might not work for email responses, maybe? sorry :))
I think it's reasonable to drop support for nix older than what's in the tree--
especially since you'd have to overlay to replace it and as you say
would likely do via `nix.package` anyway.
Oh... that's probably what you meant! :D
…
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#54962 (comment) part: text/html
|
Can we do that on a path that isn't valid? I was going to try |
Courtesy of @jtojnar, thanks! See NixOS#54962 (comment)
Courtesy of @jtojnar, thanks! See NixOS#54962 (comment)
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
Any updates on this? |
I marked this as stale due to inactivity. → More info |
Should have been fixed by #55605 |
Thanks! |
Issue description
When used with latest Nix the "new" hash is extracted incorrectly,
sha256 = "got: sha256:hashgoeshere
or thereabouts. This seems to be due to Nix changing the message used to be more friendly to humans:NixOS/nix#2574
Steps to reproduce
Use an update script invoking common-updater-scripts. Sorry, LMK if repro is needed.
Technical details
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste theresults.
I don't expect this to be helpful but happy to provide anyway!
"x86_64-linux"
Linux 4.20.5, NixOS, 19.03.git.06b6bb8 (Koi)
yes
yes
nix-env (Nix) 2.3dtz6739_232d967
"nur-nopkgs, testing, unstable-19.03pre166987.bc41317e243, nixos-1609-16.09.1943.25f4906da6"
"nixos-18.09.1922.97e0d53d669"
/nix/var/nix/profiles/per-user/root/channels/nixos
The text was updated successfully, but these errors were encountered: