Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Flags().Uin64P broken #1869

Open
blacktop opened this issue Dec 5, 2022 · 6 comments
Open

Flags().Uin64P broken #1869

blacktop opened this issue Dec 5, 2022 · 6 comments

Comments

@blacktop
Copy link

blacktop commented Dec 5, 2022

ToUintE() fails to parse uint bigger than math.MaxInt64 in the cast dependancy. This prevents people from using numbers like macOS kernel addresses as arguents to cobra:

example:

❯ ipsw macho disass test-caches/IPSWs/20C5058d__iPhone15,2/kernelcache.release.iPhone15,2 -a 0xFFFFFFF008493FE0 -V --fileset-entry com.apple.AGXFirmwareKextG15P_A0RTBuddy

fails because it thinks I entered 0 as the --vaddr (virtual address) to be disassembled

@marckhouzam
Copy link
Collaborator

Does this issue belong in https://github.com/spf13/pflag which does the flag parsing for Cobra?

@memreflect
Copy link

There are no issues with pflag's handling of uint64, nor Cobra's usage of pflag: Playground demo.
It is Viper that uses the cast package, which is probably why you are seeing a problem.
Here is a Playground demo that confirms the difference, though the build will likely time out due to Viper's dependency chain.

PR spf13/cast#155 just needs to be merged to fix Cobra CLIs that rely on Viper.

@memreflect
Copy link

I forgot to mention that if you need a temporary workaround until things get fixed, you can vendor your module's dependencies and swap the copy of caste.go in the vendor directory for the one in the PR.
You'll also want to commit the vendor directory to your repository.
That way, your packages and their dependencies that use cast will work as they should, even when they're installed using go install or go get.

@blacktop
Copy link
Author

blacktop commented Dec 6, 2022

@memreflect thank you SO much for taking the time to triage this!! ❤️ AND for writing such a clear and concise example PoC 👍

@github-actions
Copy link

github-actions bot commented Feb 5, 2023

The Cobra project currently lacks enough contributors to adequately respond to all issues. This bot triages issues and PRs according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied. - After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied and the issue is closed.
    You can:
  • Make a comment to remove the stale label and show your support. The 60 days reset. - If an issue has lifecycle/rotten and is closed, comment and ask maintainers if they'd be interested in reopening

@blacktop
Copy link
Author

blacktop commented Feb 5, 2023

ping

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants