Skip to content

ksud: skip Parser when using resetprop as an Subcommand#3315

Closed
AlexLiuDev233 wants to merge 10 commits into
tiann:mainfrom
AlexLiuDev233:ksud-resetprop-parser
Closed

ksud: skip Parser when using resetprop as an Subcommand#3315
AlexLiuDev233 wants to merge 10 commits into
tiann:mainfrom
AlexLiuDev233:ksud-resetprop-parser

Conversation

@AlexLiuDev233

Copy link
Copy Markdown
Contributor

Old impl let user pass "args" to ksud resetprop Subcommand, it cause user execute "ksud resetprop --help" are not print the real help information of resetprop command.
This pr let when resetprop work as ksud's subcommand, skip the parser, directly execute logic, it would fix this issue.

Before:

Resetprop - Magisk-compatible system property tool

Usage: libksud.so resetprop [ARGS]...

Arguments:
  [ARGS]...  Arguments passed to resetprop

Options:
  -h, --help  Print help

After:

Resetprop - Magisk-compatible system property tool

Usage: ksud resetprop [OPTIONS] [NAME] [VALUE]

Arguments:
  [NAME]   Property name
  [VALUE]  Property value (for set or wait-for-value)

Options:
  -n, --skip-svc           Skip property_service (force direct mmap operation)
  -p, --persistent         Also operate on persistent property storage (persist.* files)
  -P                       Only read persistent properties from storage
  -d, --delete             Delete the named property
  -v, --verbose            Verbose output
  -w, --wait               Wait for a property to exist or match a value
      --timeout <TIMEOUT>  Timeout in seconds for --wait (default: wait forever)
  -f, --file <FILE>        Load and set properties from FILE
  -c, --compact            Compact property area memory (reclaim holes left by deleted properties). Optionally pass a SELinux context name to compact only that area
  -Z                       Show SELinux context when listing properties
  -h, --help               Print help

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts how resetprop is invoked from ksud so that ksud resetprop --help shows the real resetprop help output, by avoiding a secondary “pass-through args” parsing layer and instead parsing resetprop options as a normal subcommand.

Changes:

  • Refactors resetprop argument handling to be reusable via a new execute(Args) entrypoint.
  • Updates the ksud CLI to model resetprop as a typed subcommand (Resetprop(crate::resetprop::Args)) instead of forwarding trailing raw arguments.
  • Introduces a small dedicated ResetPropParser for the standalone/multicall resetprop_main path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
userspace/ksud/src/resetprop.rs Splits clap parsing from resetprop execution and adds a dedicated multicall parser wrapper.
userspace/ksud/src/cli.rs Switches ksud resetprop from raw-args forwarding to direct clap-parsed resetprop::Args and calls execute.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread userspace/ksud/src/resetprop.rs
Comment thread userspace/ksud/src/resetprop.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread userspace/ksud/src/cli.rs Outdated
Comment thread userspace/ksud/src/resetprop.rs Outdated
@AlexLiuDev233 AlexLiuDev233 force-pushed the ksud-resetprop-parser branch from 6f46759 to 1ab140f Compare March 22, 2026 08:24
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
@AlexLiuDev233 AlexLiuDev233 force-pushed the ksud-resetprop-parser branch from 1ab140f to 128f3be Compare March 22, 2026 08:26
AlexLiuDev233 and others added 3 commits March 22, 2026 16:27
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
5ec1cff added a commit that referenced this pull request Mar 24, 2026
5ec1cff added a commit that referenced this pull request Mar 24, 2026
- Allows parameter values ​prefixed with `-` be matched by value,
enabling some commands like `resetprop dalvik.vm.dex2oat-flags
--inline-max-code-unit=0` to work correctly.
- Disables help options for the resetprop subcommand, allowing the
`--help` option to be passed from the ksud subcommand to the resetprop
command-line tool. Solves #3315.
KOWX712 pushed a commit to KOWX712/KernelSU that referenced this pull request Mar 24, 2026
- Allows parameter values ​prefixed with `-` be matched by value,
enabling some commands like `resetprop dalvik.vm.dex2oat-flags
--inline-max-code-unit=0` to work correctly.
- Disables help options for the resetprop subcommand, allowing the
`--help` option to be passed from the ksud subcommand to the resetprop
command-line tool. Solves tiann#3315.
@aviraxp aviraxp closed this Mar 24, 2026
AlexLiuDev233 added a commit to ReSukiSU/ReSukiSU that referenced this pull request Mar 28, 2026
- Allows parameter values ​prefixed with `-` be matched by value,
enabling some commands like `resetprop dalvik.vm.dex2oat-flags
--inline-max-code-unit=0` to work correctly.
- Disables help options for the resetprop subcommand, allowing the
`--help` option to be passed from the ksud subcommand to the resetprop
command-line tool. Solves tiann/KernelSU#3315.

AlexLiuDev233:
Reintroduce my rejected pr in upstream to my fork....
From 5ec1cff's say, she don't apply my pr simple because code paths were split
But it can be simple fix by move checks to run_from_args() function
And it also avoid multiple parse the command line

[partially cherry-picked from upstream reject pull request tiann/KernelSU#3315]
[cherry-picked from upstream commit tiann/KernelSU@5ce7e08]

Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
AlexLiuDev233 added a commit to ReSukiSU/ReSukiSU that referenced this pull request Mar 28, 2026
- Allows parameter values ​prefixed with `-` be matched by value,
enabling some commands like `resetprop dalvik.vm.dex2oat-flags
--inline-max-code-unit=0` to work correctly.
- Disables help options for the resetprop subcommand, allowing the
`--help` option to be passed from the ksud subcommand to the resetprop
command-line tool. Solves tiann/KernelSU#3315.

AlexLiuDev233:
Reintroduce my rejected pr in upstream to my fork....
From 5ec1cff's say, she don't apply my pr simple because code paths were split
But it can be simple fix by move checks to run_from_args() function
And it also avoid multiple parse the command line

[partially cherry-picked from upstream reject pull request tiann/KernelSU#3315]
[cherry-picked from upstream commit tiann/KernelSU@5ce7e08]

Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
AlexLiuDev233 added a commit to ReSukiSU/ReSukiSU that referenced this pull request Mar 29, 2026
- Allows parameter values ​prefixed with `-` be matched by value,
enabling some commands like `resetprop dalvik.vm.dex2oat-flags
--inline-max-code-unit=0` to work correctly.
- Disables help options for the resetprop subcommand, allowing the
`--help` option to be passed from the ksud subcommand to the resetprop
command-line tool. Solves tiann/KernelSU#3315.

AlexLiuDev233:
Reintroduce my rejected pr in upstream to my fork....
From 5ec1cff's say, she don't apply my pr simple because code paths were split
But it can be simple fix by move checks to run_from_args() function
And it also avoid multiple parse the command line

[partially cherry-picked from upstream reject pull request tiann/KernelSU#3315]
[cherry-picked from upstream commit tiann/KernelSU@5ce7e08]

Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Apr 12, 2026
- Allows parameter values ​prefixed with `-` be matched by value,
enabling some commands like `resetprop dalvik.vm.dex2oat-flags
--inline-max-code-unit=0` to work correctly.
- Disables help options for the resetprop subcommand, allowing the
`--help` option to be passed from the ksud subcommand to the resetprop
command-line tool. Solves tiann#3315.
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.

4 participants