-
Notifications
You must be signed in to change notification settings - Fork 952
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
[WIP] Convert Bash scripts to Python #147 #338
Conversation
What's the right way to run python 3 code? Running the install-share script with |
Both are python.exe on Windows, and with a default install, that will get you the last one installed. The standard windows way is "py -2" or "py -3" (a shortcut which resides in the windows folder) when people haven't manually renamed it. |
Compilable decompiler version
Still not quite working, but a lot closer. Fixed most of the bugs, now I need to dig in and see why the backend isn't working right for me. The .log is actually a .diff, but you can't upload those here. If I keep working on this I'll just clone and submit a pull request. |
Reuploading to remove a debugging line I left in. |
@silverbacknet Thanks for the help. Some of your fixes I had already fixed locally. But I will integrate the rest of your changes as soon as possible. |
That's always the tough part about having a public repo. But I'm stoked it's getting there, I'll be so happy when MSYS isn't needed anymore! |
Small fixes and cleanup Early out if an error occurs
So for some reason the generated json config file is a lot shorter than the one generated by the bash script. As a result, the |
add retdec_tests_runner.py
…convention and some other fixes
… type_extractor/gen_windows_and_windrivers_jsons.py version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you forgot about adding ".py" files.
scripts/retdec_tests_runner.py
Outdated
|
||
for file in os.listdir(path): | ||
file_name = os.path.basename(file) | ||
if file_name.startswith('retdec-tests-') and not file.endswith('.sh'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you forgot about adding ".py" files
if file_name.startswith('retdec-tests-') and not file.endswith('.sh') and not file.endswith('.py'):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the help however I'm not quite sure if the code I wrote is even equivalent to what the original bash code intended to do:
find "$1" -name "retdec-tests-*" -type f $EXECUTABLE_FLAG | grep -v '\.sh$' | sort
Sadly there are also some other problems that prevent retdec_test_runner from working, because I'm currently running the executables incorrectly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes because you added python files to the folder we should skip them when searching for tests.
i have used this and seems okay to me, i did not compiled the tests but tested manually putting some test files on macOS and it runs. |
Current status and things that need to be done:
|
First of all, thanks, great work. 👍 I'm just looking into this and trying to run regression tests. The latest run (I hacked
One question related to that: How/why did the More important thing I'm thinking about is how to best collaborate on this. Other repositories ( |
I noticed that in the beginning, but somehow lost track of it and implemented it without it.
That's still a relict from using Bash2Py. It uses the parameter for every external programm call. So I left it like this, as it seemed to work for me. The decompiler script uses the
I'm fine with both. The latter however seems like the better option, as I don't have that much time the next few weeks. Also I think what's still left converting needs to be done by someone who has a better understanding of bash. If I (or others) would like to do some changes, we can still apply a pull request to the dedicated branch. |
If anyone would like to play with this, I did the following:
I will try to finish this as soon as possible. |
Hello, i may help with this later am currently using it also as base because bash on macOS is not working.
|
@Maroc-OS this can easily be fixed. if int(ranges[0]) > int(ranges[1]): with: start_range = int(ranges[0], 16 if ranges[0].startswith('0x') else 10)
end_range = int(ranges[1], 16 if ranges[1].startswith('0x') else 10)
if start_range > end_range: This however only fixes the runtime error. The bash scripts produces different code, which means that the ranges are passed incorrectly to the underlying program. [EDIT] |
I started the process of converting the Bash Scripts found in
scripts
to bash(#147)All files compile without a problem, but there could be some runtime problems that I haven't found or tested yet.
The scripts should behave like their bash counterpart, as they are more or less a 1 to 1 translation that started off by using the Bash2Py tool and then fixing errors and applying some Python concepts