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

Swap - (single dash) and = (equal sign) meaning #616

Closed
caribpa opened this issue Feb 13, 2021 · 6 comments · Fixed by #930
Closed

Swap - (single dash) and = (equal sign) meaning #616

caribpa opened this issue Feb 13, 2021 · 6 comments · Fixed by #930

Comments

@caribpa
Copy link
Contributor

caribpa commented Feb 13, 2021

Is your feature request related to a problem? Please describe.
This issue follows the same trend as #615 to standardize the special command line flags recognized when launching Rizin.

According to the POSIX Utility Syntax - Guideline 13:

For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named -.

Meaning: rz -, rz -d -, etc, shall treat - as an indicator to start Rizin and process the data coming from stdin, instead of loading the malloc://512 plugin.

Try it with any utility that reads a file:

$ echo hi | cat - > test
$ sed 's/./\U&/g' - < test
# HI

It shall be noted that using -- (double dash) before - doesn't change the meaning of - as stdin (see #615):

$ echo hi | cat -- - > test
$ sed 's/./\U&/g' -- - < test
# HI

Surprisingly, Rizin is able to read (more or less) from the standard input, but uses the = special flag.

Describe the solution you'd like
Swap the = and the - special command line flags recognized by Rizin as <file> parameter:

  • - should read from stdin, following the standard for command line utilities
  • = should load the malloc://512 plugin
$ rz - < /bin/rizin
# Starts Rizin and reads /bin/rizin from stdin

$ rz =
# Starts Rizin and loads the malloc://512 plugin

It shall be noted that currently reading from stdin doesn't truly work and mangles the terminal, see #617 (a reset solves it).

Describe alternatives you've considered
💔

Additional context
This behavior is also present in radare2.

@caribpa
Copy link
Contributor Author

caribpa commented Feb 13, 2021

Due to the fact that = is used in Rizin's interactive command line to refer to the client/server family, maybe it is a good idea to either:

  • Remove the = special flag from Rizin's startup flags to avoid possible confusion with the client/server = meaning in interactive mode
  • Move the = special startup flag to --plugin m/-Pm (new) regular flags
  • Move the = interactive client/server family command to R (new) interactive family command (short for "Remote")

@ret2libc ret2libc added the rizin label Feb 13, 2021
@ret2libc
Copy link
Member

This also seems to be reasonable to me.

@XVilka
Copy link
Member

XVilka commented Feb 24, 2021

I think it would be a good fit for 0.2.0 to break things early and don't change the behavior later.

@XVilka XVilka added this to the 0.2.0 milestone Feb 24, 2021
@XVilka XVilka added the good first issue Good for newcomers label Feb 24, 2021
@XVilka XVilka modified the milestones: 0.2.0, 0.3.0 Mar 1, 2021
@wargio
Copy link
Member

wargio commented Mar 1, 2021

i like it

@XVilka XVilka added the RSoC label Mar 5, 2021
@fangxlmr
Copy link
Contributor

@seanachao This issue is asigned to you as RSoC micro-task, so you could work on this from now on. Feel free to ask questions and send Pull Requests.

In case for anyone who is not aware about RSoC.

CC @XVilka

@seanachao seanachao mentioned this issue Mar 29, 2021
4 tasks
@seanachao
Copy link
Contributor

There are some test question, I will continue to resolve it .

@seanachao seanachao mentioned this issue Mar 29, 2021
4 tasks
@wargio wargio linked a pull request Mar 29, 2021 that will close this issue
4 tasks
seanachao added a commit to seanachao/rizin that referenced this issue Apr 16, 2021
seanachao added a commit to seanachao/rizin that referenced this issue Apr 16, 2021
seanachao added a commit to seanachao/rizin that referenced this issue Apr 17, 2021
seanachao added a commit to seanachao/rizin that referenced this issue Apr 18, 2021
seanachao added a commit to seanachao/rizin that referenced this issue Apr 20, 2021
XVilka pushed a commit that referenced this issue Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants