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

-- (double dash) should be treated as "end of flags" | Allow launching Rizin without a <file> #615

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

Comments

@caribpa
Copy link
Contributor

caribpa commented Feb 13, 2021

Is your feature request related to a problem? Please describe.
After discussing in #593, and concluding with #614, it occurred to me that there's no reason for forcing the user to specify something as <file> parameter when launching Rizin.

Moreover, currently the "open without file/plugin" behavior is achieved by passing -- as <file> parameter to Rizin.
According to the POSIX Utility Syntax - Guideline 10:

The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character.

Meaning: rz -- -test, rz -d -- -test, etc shall treat -test as <file> instead of just parsing -- and ignoring -test.

Try it with any non-built-in POSIX utility:

$ touch -- -test
$ ls -- -test
# -test
$ echo hi | tee -- -test
# hi
$ cat -- -test
# hi

Describe the solution you'd like

  • -- is used to signal "end of flags" to be consistent with the standard command line utilities syntax.
  • The user shouldn't be forced to pass a <file> to Rizin
$ rz
# Starts Rizin like if the current -- (and not -, a.k.a malloc://512) was passed

$ rz --
# Starts Rizin exactly in the same way as described above

$ rz -test
# Starts Rizin in the same way as described above and attempts to parse the '-t' flag with 'est' as value

$ rz -- -test
# Starts Rizin and opens the -test file

$ rz -d -- -test
# Starts Rizin with the -test file in debug mode

Describe alternatives you've considered
💔
Honestly, one could always use ./ or full/relative path to work around this:

$ rz ./-test
# Starts Rizin and opens the -test file

But there's still no reason for not allowing launching Rizin without <file>.

Additional context
This limitation is also present in radare2.

@ret2libc
Copy link
Member

It seems actually reasonable and that it makes sense!

@XVilka
Copy link
Member

XVilka commented Feb 24, 2021

The files to change are:

  • librz/main/rizin.c
  • rest of librz/main/*.c if we want to have the same behaviour for all Rizin tools.

This was referenced Mar 29, 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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Finished
Development

Successfully merging a pull request may close this issue.

3 participants