`gh` crashes with a stack overflow when an alias expands to itself
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 76/100
Piste de recherche
Commencez dans pkg/cmd/root/alias.go, où la trace de pile montre que l’expansion de l’alias se réappelle elle-même, et lisez les tests d’alias à proximité pour voir comment les alias sont testés. Reproduisez l’échec avec un alias autoréférentiel, puis ajoutez des tests couvrant le comportement d’erreur attendu et vérifiez que l’exécution de l’alias se termine sans plantage.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
gh crashes with a stack overflow when an alias expands to itself.
An alias whose expansion resolves back to the same alias is accepted without complaint, and running it re-enters the alias forever until the Go runtime aborts the process.
Affected version
$ gh version
gh version 2.103.3-71-g736c68f67 (2026-11-07)
https://github.com/cli/cli/releases/latest
This is a build of trunk.
Steps to reproduce the behavior
-
Create an alias that expands to itself:
gh alias set 'issue mine' 'issue mine'This is accepted and exits 0.
-
Run the alias:
gh issue mine -
See error
The same happens when the alias arrives through gh alias import, which is how a shared alias file would carry it:
$ cat aliases.yml
pr mine: pr mine
$ gh alias import aliases.yml
$ gh pr mine
Expected vs actual behavior
Expected: gh should either refuse to create an alias that expands to itself, or report an error when the alias is run.
Actual: gh recurses until the runtime aborts the process with fatal error: stack overflow, after about 30 seconds and roughly 1 GB of goroutine stack.
Logs
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x184c88b003a8 stack=[0x184c88b00000, 0x184ca8b00000]
fatal error: stack overflow
runtime stack:
runtime/panic.go:1243 +0x48
runtime/stack.go:1207 +0x5dd
runtime/asm_amd64.s:650 +0x7b
goroutine 1 gp=0x184c62f4a1e0 m=23 mp=0x184c74808008 [running]:
regexp/syntax.(*compiler).rune(...)
regexp/syntax/compile.go:272 +0x2d3
...
regexp.MustCompile({0x14effea, 0x4})
regexp/regexp.go:310 +0x2c
github.com/cli/cli/v2/pkg/cmd/root.expandAlias({0x184c6349faa0?, 0x184c633e2ab0?}, {0x2b1f980?, 0x0, 0x14f3f6a?})
github.com/cli/cli/v2/pkg/cmd/root/alias.go:91 +0x28a
github.com/cli/cli/v2/pkg/cmd/root.NewCmdAlias.func1(0x184c6372d808, {0x2b1f980?, 0x4?, 0x14efff2?})
github.com/cli/cli/v2/pkg/cmd/root/alias.go:58 +0x35
github.com/spf13/cobra.(*Command).execute(0x184c6372d808, {0x2b1f980, 0x0, 0x0})
github.com/spf13/[email protected]/command.go:1015 +0xb3c
github.com/spf13/cobra.(*Command).ExecuteC(0x184c6372d808)
github.com/spf13/[email protected]/command.go:1148 +0x450
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/[email protected]/command.go:1071
github.com/cli/cli/v2/pkg/cmd/root.NewCmdAlias.func1(...)
github.com/cli/cli/v2/pkg/cmd/root/alias.go:64 +0xb2
github.com/spf13/cobra.(*Command).execute(...)
github.com/spf13/[email protected]/command.go:1015 +0xb3c
github.com/spf13/cobra.(*Command).ExecuteC(...)
github.com/spf13/[email protected]/command.go:1148 +0x450
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/[email protected]/command.go:1071
github.com/cli/cli/v2/pkg/cmd/root.NewCmdAlias.func1(...)
github.com/cli/cli/v2/pkg/cmd/root/alias.go:64 +0xb2
... and the same two frames repeat until the stack limit is hit
exit status 2
- Langage dominant
- Go
- Étoiles
- 47.4k
- Forks
- 9.5k
- Merge moyen
- 18 h 34 min
- PR mergées (30 j)
- 70
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de cli/cli
-
`gh search prs --locked=false` silently ignores the requested search filterPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouvertebug gh-search priority-3
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
cli/cli#15188 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
`gh run watch` drops annotations for jobs that are queued on the first pollPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouvertebug gh-run priority-3
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
cli/cli#15186 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
gh skill update reports success when a repository cannot be resolvedPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouvertebug gh-skill priority-3
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
cli/cli#15092 · 4 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
`gh label list --json` prints nothing instead of `[]` when the repository has no labelsPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverteblocked bug gh-label needs-investigation priority-3
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
cli/cli#15066 · 4 commentaires · 2 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
`gh search code '"term"'` sends the typed quotes escaped (`q="\"term\""`) and finds nothingPeut-être à nouveau libre @Daiyuanranfeng l’a pris il y a 17 jours, et aucune pull request n’est ouverte. Ouverteauto-bugfix-fixing bug gh-search priority-3
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
cli/cli#15060 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
seriousm4x/UpSnap#1786 ·
-
bug feedback ui/ux
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
peasant-labs/peasant#1307 ·
Les mainteneurs répondent en général sous 1 jour
-
Reformat test names for single-protocol tests to start with Protocol/, i.e. gRPC/ or Websocket/Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
connectrpc/conformance#1211 ·
Les mainteneurs répondent en général sous 1 jour
-
bug effort:s impact:med raised-by:desk risk:low
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
medici-finance/assay#8342 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
hardening
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
inference-sim/inference-sim#2821 ·
Les mainteneurs répondent en général sous 1 jour