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

Fix builtins.path error handling #2167

Closed
wants to merge 1 commit into from
Closed

Conversation

picnoir
Copy link
Member

@picnoir picnoir commented May 18, 2018

Fixes #2075

Before

nix-repl> builtins.path { path = "/home/kmicklas/bar"; }
error: getting attributes of path '/home/kmicklas/bar': No such file or directory

nix-repl> builtins.path { path = "/home/kmicklas/foo"; }
error: bad archive: expected open tag

nix-repl> builtins.path { path = "/home/kmicklas/foo"; }
error: bad archive: expected open tag

nix-repl> builtins.path { path = "/home/kmicklas/foo"; }
error: unexpected end-of-file

nix-repl> builtins.path { path = "/home/kmicklas/foo"; }
"/nix/store/avva3pijyyj4bgrj1vcl3sj6hiadjxlj-foo"

After

nix-repl> builtins.path { path = "/home/minoulefou/bar"; }                                                  
error: getting attributes of path '/home/minoulefou/bar': No such file or directory

nix-repl> builtins.path { path = "/home/minoulefou/foo"; }                                                           

"/nix/store/avva3pijyyj4bgrj1vcl3sj6hiadjxlj-foo"

The nix-store client was basically sending an incomplete message. This PR adds an extra check before sending anything to the daemon's socket sink.

@edolstra
Copy link
Member

This doesn't comprehensively solve the problem, because any exception during the dump will still cause the daemon and client to become desynchronized. The proper solution is to use TunnelSink / TunnelSource but that does require a protocol change.

I started work on this a while ago but then I got bored and stopped. This is how far I got: https://pastebin.com/Q3xVE3ai

@picnoir
Copy link
Member Author

picnoir commented May 18, 2018

Aha, you're right.

I guess I need more time to get more familiar with the daemon protocol and I'll have a go.

In the meantime, is it ok for me to close this PR? I don't think it really makes sense to merge it.

@picnoir picnoir closed this May 19, 2018
@picnoir picnoir deleted the paths branch May 19, 2018 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants