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

Sourcehut usernames can contain underscores #2581

Closed
jpluscplusm opened this issue Nov 19, 2022 · 2 comments · Fixed by #2582
Closed

Sourcehut usernames can contain underscores #2581

jpluscplusm opened this issue Nov 19, 2022 · 2 comments · Fixed by #2582
Labels
bug Something isn't working

Comments

@jpluscplusm
Copy link

Describe the bug

Chezmoi doesn't recognise Sourcehut (sr.ht) usernames as being valid when they contain (at least) underscores. This results in the low-friction setup failing when given an otherwise valid sr.ht/~user_name parameter.

To reproduce

$ chezmoi init --ssh sr.ht/~user_name
fatal: repository 'sr.ht/~user_name' does not exist
chezmoi: exit status 128

Expected behavior

$ chezmoi init --dry-run --ssh sr.ht/~username  
Cloning into '/home/user/.local/share/chezmoi'...

Output of command with the --verbose flag

$ chezmoi --verbose init --ssh sr.ht/~user_name
fatal: repository 'sr.ht/~user_name' does not exist
chezmoi: exit status 128

Output of chezmoi doctor

$ chezmoi doctor
RESULT   CHECK                MESSAGE
ok       version              v2.27.1, commit b6039e787dfffe970fec4f9165ec9ebe1b3ceaa6, built at 2022-11-13T20:30:23Z, built by goreleaser
ok       latest-version       v2.27.1
ok       os-arch              linux/amd64 (Debian GNU/Linux 11 (bullseye))
ok       uname                Linux penguin 5.10.142-19739-g5899aa8f604c #1 SMP PREEMPT Tue Oct 25 18:21:49 PDT 2022 x86_64 GNU/Linux
ok       go-version           go1.19.3 (gc)
ok       executable           ~/.software/asdf/installs/chezmoi/2.27.1/bin/chezmoi
ok       upgrade-method       replace-executable
ok       config-file          no config file found
ok       source-dir           ~/.local/share/chezmoi is a directory
ok       suspicious-entries   no suspicious entries
ok       working-tree         ~/.local/share/chezmoi is a directory
ok       dest-dir             ~ is a directory
ok       umask                022
ok       cd-command           found /bin/bash
ok       cd-args              /bin/bash
info     diff-command         not set
ok       edit-command         found /usr/bin/vi
ok       edit-args            /usr/bin/vi
ok       git-command          found /usr/bin/git, version 2.34.1
[... secret-related stuff removed; definitely not relevant! ]

Additional context

I've tracked down the Sourcehut username constraints, but only the human-readable error message that's given on signup failure: Username must use only lowercase letters, digits, underscores, and dashes, and must start with a letter or underscore. (https://git.sr.ht/~sircmpwn/meta.sr.ht/tree/master/item/api/graph/schema.resolvers.go#L624).

The current quick-start regex doesn't include the underscore (https://github.com/twpayne/chezmoi/blob/758249eeb6db73a2b516a7afbe2a56972d94f0d5/pkg/cmd/initcmd.go).

@twpayne twpayne added the bug Something isn't working label Nov 19, 2022
@bradenhilton
Copy link
Collaborator

Also https://git.sr.ht/~sircmpwn/meta.sr.ht/tree/master/item/api/graph/resolver.go#L23

@jpluscplusm
Copy link
Author

TVVM for the quick fix @twpayne! ❤️

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants