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

do not raise an exception for a valid process status #80

Merged
merged 1 commit into from
May 30, 2023

Conversation

duanev
Copy link
Contributor

@duanev duanev commented May 25, 2023

On Linux traced processes can return a status of "255"; this is not invalid and should not cause the tracer "strace.py" to abort. This fix may be naive of other OS implementations of os.WIFEXITED(), I am unable to test on Windows or MacOS.

On Linux traced processes can return a status of "255"; this is not invalid and should not cause the tracer "strace.py" to abort.
@spoutn1k
Copy link
Collaborator

Could you provide an example where this comes into play ? I naively recreated the situation with the following:

$ cat test.sh 
#!/bin/bash

exit 255
$ chmod +x test.sh
$ bash test.sh
$ echo $?
255

With python-ptrace release 0.9.8:

$ strace.py ./test.sh
[...]
*** Process 6308 exited with code 255 ***

It does not seem like there is an exception being raised in my case, so I will need your use case to fully understand the PR.

@spoutn1k
Copy link
Collaborator

Looking through the code, this only applies to child processes returning with exit code 255 - this is shown with the following example:

#!/bin/bash

bash -c "exit 255"
exit 0

Merging the fix. Thank you !

@spoutn1k spoutn1k merged commit 401d9fd into vstinner:main May 30, 2023
@duanev
Copy link
Contributor Author

duanev commented May 30, 2023

Ah yes, children processes. Curious why the original code trapped on that specifically, unless WEXITSTATUS() can throw an error for some values of status...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants