rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.9k stars 1.15k forks source link

r2 console JSON output broken #1051

Closed qjerome closed 5 years ago

qjerome commented 5 years ago

Environment information

Describe the bug The r2 commands *.j** (supposed to return JSON) executed from a r2pipe do not return JSON deserializable output anymore.

To Reproduce Steps to reproduce the behavior:

  1. Open Cutter from a terminal to be able to read stdout/stderr
  2. Go to r2 console lower left corner, paste and execute #!pipe python3 -c "import r2pipe; r2 = r2pipe.open(); print(r2.cmd('pdj 1'))"
  3. See the result in the terminal from which cutter was opened, it seems to be a mix between JSON and HTML. This makes the scripts previously working, failing.

Expected behavior JSON output is expected.

Additional Context This was working perfectly on 1.7.2 so I think it is related to a recent change.

PS Thank you guys for your great job

xarkes commented 5 years ago

Hello, As far as I can tell, this is because e scr.html=true is set so you can get colorized output from the console. A temporary fix could be to detect if a command starts with #! and set scr.html to false.

qjerome commented 5 years ago

Hi,

Thanks, I did not know that env variable. I can simply disable the feature into my scripts using r2pipe.

I guess the issue can be closed since it is not really a bug ...

xarkes commented 5 years ago

Ok, if what you say fixes it then all good! However if you need to add a if() to disable scr.html when a command starts with #! feel free to open a PR or reopen the issue. Thanks.

qjerome commented 5 years ago

Yes it does work like this. Thank you for your time