diff mbox series

[autotest-client-tests] UBUNTU SAUCE: ubuntu_ltp_syscalls: properly handle SIGXFSZ

Message ID 20201029185259.GA89655@xps-13-7390
State New
Headers show
Series [autotest-client-tests] UBUNTU SAUCE: ubuntu_ltp_syscalls: properly handle SIGXFSZ | expand

Commit Message

Andrea Righi Oct. 29, 2020, 6:52 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1902118

python is redefining the SIGXFSZ signal handler internally, blocking the
delivery of this signal to all the children tasks. This can break some
tests (like kill11 for example) that are expecting to find the default
signal handler and properly receive the signal.

Make sure to restore the default signal handler for SIGXFSZ before
running any test.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
---
 ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Colin Ian King Oct. 29, 2020, 6:54 p.m. UTC | #1
On 29/10/2020 18:52, Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1902118
> 
> python is redefining the SIGXFSZ signal handler internally, blocking the
> delivery of this signal to all the children tasks. This can break some
> tests (like kill11 for example) that are expecting to find the default
> signal handler and properly receive the signal.
> 
> Make sure to restore the default signal handler for SIGXFSZ before
> running any test.
> 
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> ---
>  ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py b/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py
> index 8d01186b..dac16692 100644
> --- a/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py
> +++ b/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py
> @@ -6,9 +6,19 @@ import platform
>  import re
>  import sys
>  import time
> +import signal
>  from autotest.client                        import test, utils
>  from autotest.client.shared     import error
>  
> +# python is redefining the SIGXFSZ handler internally, blocking the delivery of
> +# this signal to any forked task. Make sure to restore the default signal
> +# handler for SIGXFSZ before running any test.
> +try:
> +    signal.signal(signal.SIGXFSZ, signal.SIG_DFL)
> +except Exception, e:
> +    print(e)
> +    sys.stdout.flush()
> +
>  class ubuntu_ltp_syscalls(test.test):
>      version = 1
>  
> 

Nice catch. Looks sane to me. Thanks Andrea.

Acked-by: Colin Ian King <colin.king@canonical.com>
Po-Hsu Lin Oct. 30, 2020, 3:17 a.m. UTC | #2
Nice catch +1!

Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Applied and pushed.

Thanks
Sam
diff mbox series

Patch

diff --git a/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py b/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py
index 8d01186b..dac16692 100644
--- a/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py
+++ b/ubuntu_ltp_syscalls/ubuntu_ltp_syscalls.py
@@ -6,9 +6,19 @@  import platform
 import re
 import sys
 import time
+import signal
 from autotest.client                        import test, utils
 from autotest.client.shared     import error
 
+# python is redefining the SIGXFSZ handler internally, blocking the delivery of
+# this signal to any forked task. Make sure to restore the default signal
+# handler for SIGXFSZ before running any test.
+try:
+    signal.signal(signal.SIGXFSZ, signal.SIG_DFL)
+except Exception, e:
+    print(e)
+    sys.stdout.flush()
+
 class ubuntu_ltp_syscalls(test.test):
     version = 1