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

Useless error message in nix-build #5240

Closed
aragnon opened this issue Dec 6, 2014 · 10 comments
Closed

Useless error message in nix-build #5240

aragnon opened this issue Dec 6, 2014 · 10 comments

Comments

@aragnon
Copy link

aragnon commented Dec 6, 2014

I got the following message while trying to run a test:
in the Nix store is forbidden (are you running nix-build inside the store?)

To actually understand why this was a problem I had to read http://lists.science.uu.nl/pipermail/nix-dev/2007-June/000265.html .

Additionally, I was running nix-build inside the store, but it's rather silly for any system to ask the user about anything itself can also know in a few microseconds.

The correct solution is to either allow the behaviour in the first place, but write the output to some /tmp directory if there is more than enough space there, or alternatively, suggest that a user should first get nixpkgs checked out somewhere else before trying to do anything with nix-build.

@peti
Copy link
Member

peti commented Dec 6, 2014

The error message clearly points towards the fact that running nix-build inside of the nix store isn't supported. I agree that it's possible to improve that message and if you have any specific suggestion, then I'm sure it's no big deal to make change. The assertion that the message would be "useless", however, is too strong for my taste; that's certainly no accurate characterization of the situation.

I disagree with your assertion that it would be "correct" for Nix to automatically choose a different location for the output. I very much prefer nix-build to abort with an error.

@aragnon
Copy link
Author

aragnon commented Dec 6, 2014

@peti 1) I'd prefer you would actually read what I have written. 2) I'd also prefer you to don't waste time on discussions about what you would qualify as "useless". The only distinction which matters is whether or not it is already as good as it can be.

@7c6f434c
Copy link
Member

7c6f434c commented Dec 6, 2014

The only distinction which matters is whether or not it is already as good as it can be.

Actually, the one distinction that matters is whether the effort/benefit
ratio of the change is higher than for other changes.

Doing unexpectedly smart things can be a drawback for core tools, by the
way.

@wmertens
Copy link
Contributor

wmertens commented Dec 6, 2014

@aragnon please, your reply to @peti is rather aggressive in tone. This is github, not youtube.

Note that the end product of a nix-build is just a symlink to the result, so there will always be room in /tmp. The question is if it is desirable to have the normal API (create a result symlink in $PWD) suddenly change, I don't believe it is.

Your second solution, expanding the error message to suggest that the user check out nixpkgs somewhere else, makes a lot more sense and such a PR would most likely be accepted.

@peti
Copy link
Member

peti commented Dec 6, 2014

@aragnon, I discussed your choice of the word "useless" to provide you with a subtle clue that your message comes across as inappropriately emotional and over the top. Your communication style makes you appear like a hot-headed teenager who got super angry because he spent an hour trying to run nix-build and who's now venting this frustration on the bug tracker because he's lacking in other, more mature anger management strategies. That is probably not the image you want to convey if you're trying to make serious suggestions about Nix's architecture.

Now, nix-build has a flag --out-link / -o outlink that controls the path of the symlink that's created once the build is finished. By default, that path is result, i.e. it''s created in the current directory. For many reasons, we don't want users to create files in the Nix store. That directory hierarchy is supposed to be under the control of Nix -- and we usually mount the store read-only to guarantee that other programs and/or people don't mess with it. So, when you run nix-build in the Nix store and don't provide an alternative output path via -o, then you'll get an error message (that's quite clear and helpful, IMHO).

If you want the symlink to be created in /tmp, then running nix-build -o /tmp/result ... is the way to achieve that. You can maybe write a wrapper script or an alias that does this automatically?

@vcunat
Copy link
Member

vcunat commented Dec 6, 2014

IMHO it's more practical to cd into some work directory (in /tmp for example) and do nix-build /nix/store/foo-bar (you can create a symlink to the workdir, for example, if you want to avoid repetitive typing).

@aragnon
Copy link
Author

aragnon commented Dec 6, 2014

@peti Your communication style makes me label you as someone who whines too much. You sound like the kind of wife nobody wants to have.

@lucabrunox
Copy link
Contributor

I please anybody to stop replying to this discussion and ignore this troll guy, thanks. This kind of behavior is not accepted in our community.
Closing this issue because the message is quite clear: it's forbidden to write anything in the nix store like that. If anybody wants to improve the message, open a PR.

@vcunat
Copy link
Member

vcunat commented Dec 6, 2014

+1

@aragnon
Copy link
Author

aragnon commented Dec 6, 2014

@lethalman peti was the first to start talking about social issues and as such he is the troll. Additionally, labelling this issue as invalid is simply incorrect, as it was already established that my second proposed solution had some support (by @wmertens ).

So, unless you want to publically segregate the NixOS community into two parts, the "incrowd" and the "rest", you'd better reopen this issue again. OTOH, the damage to the NixOS brand has already been done; you don't operate on technical merit, you operate on nepotism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants