Skip to content

improve toFile error message when containing potential drv path #3447

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

Merged
merged 1 commit into from
Apr 11, 2020

Conversation

DavHau
Copy link
Member

@DavHau DavHau commented Mar 25, 2020

closes #2274

In case a potential derivation path is found in the content passed to toFile, the new error message will be:
error: in 'toFile': the file named 'test-file' must not contain a sub-string referring to a potential derivation path (!out!/nix/store/h24qmnnbcbj84pimrg55pd3yjq0gpfra-python3-3.7.5.drv), at /home/user/some_expr.nix:3:1

@domenkozar
Copy link
Member

What does potential mean in this context? It's not clear to me reading the message.

@DavHau
Copy link
Member Author

DavHau commented Mar 27, 2020

I'm actually not sure myself. I wrote this error message based on the proposal in issue #2274 .
I'm not sure why it is not allowed to put derivation paths in the content of toFile.

Would it be better to say ...must not contain a sub-string referring to a derivation output ?

The original error message just didn't help me at all without googling. Therefore I'd like to change it.

@domenkozar
Copy link
Member

must not a reference to a derivation

@domenkozar
Copy link
Member

@DavHau happy to merge this if you fix the error :)

@domenkozar domenkozar added the error-messages Confusing messages and better diagnostics label Apr 9, 2020
@DavHau DavHau force-pushed the improve-tofile-error-msg branch from d1c1899 to 7694bd9 Compare April 11, 2020 10:49
@DavHau DavHau force-pushed the improve-tofile-error-msg branch from 7694bd9 to fc14213 Compare April 11, 2020 10:54
@DavHau
Copy link
Member Author

DavHau commented Apr 11, 2020

I changed it to print the error like this:
error: in 'toFile': the file named 'test-file' must not contain a reference to a derivation but contains (!out!/nix/store/p0bfb4qrs2fq3mv4zin6jjfq8c6mszb1-python3-3.7.5.drv), at /home/user/some_expr.nix:3:1

You think this is fine?

@domenkozar domenkozar merged commit fc14424 into NixOS:master Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-messages Confusing messages and better diagnostics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

builtins.toFile Error message should be more explicit
2 participants