crytic / rattle

evm binary static analysis
https://www.trailofbits.com/presentations/rattle/
344 stars 41 forks source link

No such file or directory: 'open' #15

Closed meyira closed 5 years ago

meyira commented 6 years ago

I tried to get rattle running (Linux 4.17.12-arch1-1-ARCH x86_64 GNU/Linux) and got FileNotFoundError: [Errno 2] No such file or directory: 'open': 'open'. Which open is used for rattle?

Also, as a side note: I had to fix the dot path from /usr/local/bin/dot to /usr/bin/dot, as this is where my dot is. Thanks

lojikil commented 6 years ago

@meyira is there any other stack trace information available? Can you post the full stack trace?

We could also probably use env for dot ala /usr/bin/env dot, thank you for that.

meyira commented 6 years ago

Identified Functions: _dispatch argument offsets:[(0, 32)] _unknown_0xee919d50() argument offsets:[(4, 36)] _fallthrough argument offsets:[]

Storage Locations: [0] Memory Locations: [64] Analyzing Memory Location: 64

0x4: MSTORE(#40, #80)

Function _dispatch storage: Function _unknown_0xee919d50() storage: Analyzing Storage Location: 0 0x77: SSTORE(#0, %30)

Function _fallthrough storage: [+] Contract can not send ether. [+] Contract calls: [+] Wrote _dispatch to output/_dispatch.png Traceback (most recent call last): File "../../tools/rattle/rattle-cli.py", line 191, in main() File "../../tools/rattle/rattle-cli.py", line 184, in main subprocess.call(['open', out_file]) File "/usr/lib/python3.7/subprocess.py", line 304, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib/python3.7/subprocess.py", line 756, in init restore_signals, start_new_session) File "/usr/lib/python3.7/subprocess.py", line 1499, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'open': 'open'

It runs well until it should save it, hope that helps

lojikil commented 6 years ago

ah! ok, I see what's happening; it's using the open command from OSX to open a file with the default viewer. On Ubuntu the analog to open is usually xdg-open or gnome-open, and as a current work around you may be able to alias or symlink xdg-open to open to make it work for you, or change that line locally to be xdg-open. I'd have to check the command line differences between the two.

Longer term, we'll have to change that to not assume certain commands exist and have work around for Linux and others. For now tho, can you try:

  1. Check that xdg-open, gnome-open, or the like exists on your install.
  2. Symlink, alias, or modify the code to use that.
  3. let us know if that works?

Thanks!

(note: edited to note gnome-open works too. I'm still ingesting coffee, apologies)

meyira commented 6 years ago

It's xdg-open, which is packed under xdg-utils (in case anybody comes across it!). It works beautifully now- looking forward working with it!

lojikil commented 6 years ago

Perfect, I'm glad! I'm just going to reopen the issue so we can track & fix it, but I'm glad that work around worked!

withzombies commented 5 years ago

A good first issue would be supporting more than my specific executable path to graphviz!

withzombies commented 5 years ago

Fixed in bee75db9