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

checkStoreName: give more precise/verbose error information #2974

Merged
merged 1 commit into from Jul 2, 2019

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Jun 27, 2019

$ sudo ./inst/bin/nix-instantiate -E '"${./.git}"'
error: The path name '.git' is invalid: it is illegal to start the
name with a period. Path names are alphanumeric and can include the
symbols +-._?= and must not begin with a period. Note: If you cannot
rename '.git', builtins.path { name = ... } can be used to give it an
alternative name.

Close #2973

"Path names are alphanumeric and can include the symbols %1% "
"and must not begin with a period. "
"Note: If you cannot rename '%2%', builtins.path { name = ... } "
"can be used to give it an alternative name.") % validChars % name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That means that you can rename it :-) Also, the builtins.path advice is only applicable for sources.

$ sudo ./inst/bin/nix-instantiate -E '"${./.git}"'
error: The path name '.git' is invalid: it is illegal to start the
name with a period. Path names are alphanumeric and can include the
symbols +-._?= and must not begin with a period. Note: If '.git' is a
source file and you cannot rename it on disk,
builtins.path { name = ... } can be used to give it an alternative
name.
@@ -86,18 +86,25 @@ string storePathToHash(const Path & path)
void checkStoreName(const string & name)
{
string validChars = "+-._?=";

auto baseError = format("The path name '%2%' is invalid: %3%. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use fmt("<format-string>", args...) in new code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now I depend on the final substitution being "curried", is there a way to support that, or should I not do the partial application?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, didn't notice that.

@edolstra edolstra merged commit db700f7 into NixOS:master Jul 2, 2019
@grahamc grahamc deleted the invalid-name branch July 2, 2019 14:12
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.

request to clarify "illegal name" error
2 participants