SunLab-GMU / GraphSPD

The official repository of "GraphSPD: Graph-Based Security Patch Detection with Enriched Code Semantics". The paper will appear in the IEEE Symposium on Security and Privacy (S&P), San Francisco, CA, May 22-26, 2023.
https://github.com/SunLab-GMU/GraphSPD
Apache License 2.0
40 stars 7 forks source link

When running gen_cpg.py, there is an error : /usr/bin/env: 'bash\r': No such file or directory when I run "./joern xxx". #3

Closed suntianq closed 1 year ago

shuwang127 commented 1 year ago

Did you run the scripts under the folder GraphSPD/? The joern/ is the sub-folder under the main folder (need to chmod -R +x ./joern). All the operations in this repo should be run at the GraphSPD path.

shuwang127 commented 1 year ago

If you can provide the path/command and all the error info, that would be helpful for us to target the error reason.

suntianq commented 1 year ago

I have executed  chmod -R +x ./joern in ~/GraphSPD, there is an error when i run gen_cpg.py: @.***:/workspace/GraphSPD# python3 gen_cpg.py /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list /usr/bin/env: ‘bash\r’: No such file or directory /usr/bin/env: ‘bash\r’: No such file or directory Traceback (most recent call last): File "/workspace/GraphSPD/locate_and_align.py", line 122, in <module> idx = filename.index(funcInfo[i][0]) ValueError: 'c' is not in list

OS is ubuntu18.04.

------------------ 原始邮件 ------------------ 发件人: "SunLab-GMU/GraphSPD" @.>; 发送时间: 2023年6月26日(星期一) 上午10:42 @.>; @.**@.>; 主题: Re: [SunLab-GMU/GraphSPD] When running gen_cpg.py, there is an error : /usr/bin/env: 'bash\r': No such file or directory when I run "./joern xxx". (Issue #3)

If you can provide the path/command and all the error info, that would be helpful for us to target the error reason.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

shuwang127 commented 1 year ago

Can you simply run $ pyenv --version and provide the results?

shuwang127 commented 1 year ago

/usr/bin/env: ‘bash\r’: No such file or directory means your pyenv configuation file contains \r, which should be replaced with ''.

shuwang127 commented 1 year ago

Can you simply run $ pyenv --version and provide the results?

If you find:

$ pyenv --version
/usr/bin/env: ‘bash\r’: No such file or directory 

Use

$ cd ~/.pyenv && find . -type f | xargs sed -i $'s/\r$//' && cd -
suntianq commented 1 year ago

Thank you. I have a new question. I want to test my own commits. How to generate raw_patch file as  same as your type.

------------------ 原始邮件 ------------------ 发件人: "SunLab-GMU/GraphSPD" @.>; 发送时间: 2023年6月26日(星期一) 中午11:22 @.>; @.**@.>; 主题: Re: [SunLab-GMU/GraphSPD] When running gen_cpg.py, there is an error : /usr/bin/env: 'bash\r': No such file or directory when I run "./joern xxx". (Issue #3)

Can you simply run $ pyenv --version and provide the results?

If you find: $ pyenv --version /usr/bin/env: ‘bash\r’: No such file or directory

Use $ cd ~/.pyenv && find . -type f | xargs sed -i $'s/\r$//' && cd -

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

shuwang127 commented 1 year ago

If it is a GitHub commit, follow step 1.2 instead of 1.1: python3 get_ab_file.py [owner] [repository] [commitID].

If you test a private commit, you also need to copy the changed files only (both a and b versions) to “ab_files/a” and "ab_files/b". See get_ab_files.py and you can know how to place these files.