netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iptables PATCH] tests: iptables-test: Fix command segfault reports
@ 2023-08-10 11:55 Phil Sutter
  2023-08-10 12:12 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2023-08-10 11:55 UTC (permalink / raw)
  To: netfilter-devel

Logging produced a stack trace due to undefined variable 'cmd'.

Fixes: 0e80cfea3762b ("tests: iptables-test: Implement fast test mode")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 iptables-test.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/iptables-test.py b/iptables-test.py
index ef0a35d3daa22..6f63cdbeda9af 100755
--- a/iptables-test.py
+++ b/iptables-test.py
@@ -136,7 +136,7 @@ STDERR_IS_TTY = sys.stderr.isatty()
     # check for segfaults
     #
     if proc.returncode == -11:
-        reason = "iptables-save segfaults: " + cmd
+        reason = command + " segfaults!"
         print_error(reason, filename, lineno)
         delete_rule(iptables, rule, filename, lineno, netns)
         return -1
@@ -333,8 +333,11 @@ STDERR_IS_TTY = sys.stderr.isatty()
     out, err = proc.communicate(input = restore_data)
 
     if proc.returncode == -11:
-        reason = iptables + "-restore segfaults: " + cmd
+        reason = iptables + "-restore segfaults!"
         print_error(reason, filename, lineno)
+        msg = [iptables + "-restore segfault from:"]
+        msg.extend(["input: " + l for l in restore_data.split("\n")])
+        print("\n".join(msg), file=log_file)
         return -1
 
     if proc.returncode != 0:
@@ -355,7 +358,7 @@ STDERR_IS_TTY = sys.stderr.isatty()
     out, err = proc.communicate()
 
     if proc.returncode == -11:
-        reason = iptables + "-save segfaults: " + cmd
+        reason = iptables + "-save segfaults!"
         print_error(reason, filename, lineno)
         return -1
 
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [iptables PATCH] tests: iptables-test: Fix command segfault reports
  2023-08-10 11:55 [iptables PATCH] tests: iptables-test: Fix command segfault reports Phil Sutter
@ 2023-08-10 12:12 ` Phil Sutter
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2023-08-10 12:12 UTC (permalink / raw)
  To: netfilter-devel

On Thu, Aug 10, 2023 at 01:55:23PM +0200, Phil Sutter wrote:
> Logging produced a stack trace due to undefined variable 'cmd'.
> 
> Fixes: 0e80cfea3762b ("tests: iptables-test: Implement fast test mode")
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Patch applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-10 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 11:55 [iptables PATCH] tests: iptables-test: Fix command segfault reports Phil Sutter
2023-08-10 12:12 ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).