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-store 2.3 incompatible with nix-daemon 2.4pre #5299

Closed
ck3d opened this issue Sep 27, 2021 · 5 comments
Closed

nix-store 2.3 incompatible with nix-daemon 2.4pre #5299

ck3d opened this issue Sep 27, 2021 · 5 comments
Labels
bug protocol Things involving the daemon protocol & compatibility issues

Comments

@ck3d
Copy link

ck3d commented Sep 27, 2021

Using nix-store 2.3 on a system where nix-daemon 2.4pre is running results in unexpected behavior.

Steps To Reproduce

Following script

#!/usr/bin/env nix-shell
#!nix-shell -i sh -p nix

nix-store --version
echo hello > test.txt
STORE=$(nix-store --add-fixed sha256 test.txt)
hexdump -C "$STORE"

produces following output:

warning: unknown setting 'experimental-features'
nix-store (Nix) 2.3.15
warning: unknown setting 'experimental-features'
00000000  68 65 6c 6c 6f 0a 00 00  00 00 00 00 00 00 00 00  |hello...........|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00010000  00 00 00 00 00 00                                 |......|
00010006

The host system runs nix version 2.4pre20210908_3c56f62.

Expected behavior

nix-store shall not add 65536 zeros at the end of the file.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-2-4-and-what-s-next/16257/1

@thufschmitt thufschmitt added the protocol Things involving the daemon protocol & compatibility issues label Nov 26, 2021
@thufschmitt
Copy link
Member

I can indeed reproduce it. It’s a bit hard to understand what’s going on because the messages exchanged when using the 2.3 and 2.4 clients are very different. I bisected it however to be introduced by bc10964, which should narrow the scope of the possible culprits quite a bit.

/cc @Ericson2314

@Ericson2314
Copy link
Member

Thanks @regnat! There was some confusions about whether the protocol was using raw dump vs nar dump vs raw dump with references, that might be related too.

@Ericson2314
Copy link
Member

I am taking a look.

ElvishJerricco added a commit to obsidiansystems/nix that referenced this issue Nov 30, 2021
No matter what, we need to resize the buffer to not have any scratch
space after we do the `read`. In the end of file case, `got` will be 0
from it's initial value.

Before, we forgot to resize in the EOF case with the break. Yes, we know
we didn't recieve any data in that case, but we still have the scatch
space to undo.

Co-Authored-By: Will Fancher <Will.Fancher@Obsidian.Systems>
edolstra added a commit that referenced this issue Dec 1, 2021
Fix #5299 and remove uncesssary unbounded buffer
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/22-05-call-for-release-managers-and-editor/17663/16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug protocol Things involving the daemon protocol & compatibility issues
Projects
None yet
Development

No branches or pull requests

4 participants