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

disallow package names with "words" consisting solely of numbers #1338

Merged

Conversation

kadoban
Copy link
Collaborator

@kadoban kadoban commented Nov 12, 2015

Fixes #1336, but now allows package names that cause a different error to happen when you try to build:

~/projects/test$ stack new "a-3o"
Downloading template "new-template" to create project "a-3o" in a-3o/ ...
[...]
Wrote project config to: [...]/projects/test/a-3o/stack.yaml
~/projects/test$ cd a-3o/
~/projects/test/a-3o$ stack build
Error parsing targets: Directory not found: a-3o

The error on attempting to build is of course not ideal.

It's caused by a "word" starting with a number, which is now allowed in my code. Cabal itself doesn't seem to care, but stack apparently does internally somewhere. It's related to the PackageIdentifier stuff of course, but I haven't looked deeper yet.

So, my question: should I just disallow that case, even though Cabal doesn't seem to care? Or should I actually attempt to fix the build error instead?

On another, only tangentially related note: are project names with underscores in them meant to be forbidden? They were by the old code and are by my change as well, but Cabal itself doesn't seem to care at all, and there's quite a few on Hackage that have underscores as well so it seems a bit odd to disallow them.
Edit: nevermind the strikeout part, turns out I was hallucinating the ones on hackage

The Cabal rule that each alphanumeric "word" between hyphens must include at
least one letter is now enforced.

fixes commercialhaskell#1336
@kadoban kadoban changed the title refactor packageNameParser and make it stricter disallow package names with "words" consisting solely of numbers Nov 12, 2015
mgsloan added a commit that referenced this pull request Nov 14, 2015
disallow package names with "words" consisting solely of numbers
@mgsloan mgsloan merged commit be39e62 into commercialhaskell:master Nov 14, 2015
@mgsloan
Copy link
Contributor

mgsloan commented Nov 14, 2015

Good stuff, thanks! I can't reproduce the issue with building an a-3o package.

@kadoban
Copy link
Collaborator Author

kadoban commented Nov 16, 2015

Ah, yes the problem with a-3o was apparently user error (using v0.1.6.0 to try to build, instead of the master branch version). Thanks.

@kadoban kadoban deleted the stricter_package_name_parse branch November 27, 2015 23:58
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.

"stack new" allows invalid package names
2 participants