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

internal/flags: fix "flag redefined" bug for alias on custom flags #30796

Merged
merged 1 commit into from
Nov 24, 2024

Conversation

gzliudan
Copy link
Contributor

If we define an alias for any of DirectoryString and BigFlag, geth or make test will panic with message flag redefined. For example:

	AncientFlag = &flags.DirectoryFlag{
		Name:     "datadir.ancient",
		Aliases:  []string{"datadir-ancient"},
		Usage:    "Root directory for ancient data (default = inside chaindata)",
		Category: flags.EthCategory,
	}

The geth will panic with the following message

geth flag redefined: datadir.ancient
panic: geth flag redefined: datadir.ancient

Some of test cases will fail with the following message when we run make test:

    test_cmd.go:261: (stderr:1) geth-test flag redefined: datadir.ancient
    test_cmd.go:261: (stderr:1) panic: geth-test flag redefined: datadir.ancient

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

Nice catch, thanks!

@holiman holiman changed the title internal/flags: fix flag redefined bug for DirectoryString and BigFlag internal/flags: fix "flag redefined" bug for alias on custom flags Nov 24, 2024
@holiman holiman added this to the 1.14.13 milestone Nov 24, 2024
@holiman holiman merged commit 5e1a39d into ethereum:master Nov 24, 2024
2 checks passed
@gzliudan gzliudan deleted the fix-flag-redefined branch November 25, 2024 00:00
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 25, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Nov 25, 2024
JukLee0ira pushed a commit to JukLee0ira/XDPoSChain that referenced this pull request Nov 25, 2024
JukLee0ira pushed a commit to JukLee0ira/XDPoSChain that referenced this pull request Nov 27, 2024
JukLee0ira pushed a commit to JukLee0ira/XDPoSChain that referenced this pull request Nov 27, 2024
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.

2 participants