From dfea64c75961ffe12e2f3a0ba9abd675e878add3 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 9 Jul 2026 13:16:28 +0000 Subject: [PATCH] test/zdtm: avoid overwriting superclass attributes in userns_flavor Pass name and uns as parameters to ns_flavor.__init__() instead of overwriting them after the super constructor sets them. This avoids the attribute-overwrite pattern flagged by CodeQL while keeping the same behavior. Assisted-by: Claude Code (claude-opus-4-6) Signed-off-by: Adrian Reber --- test/zdtm.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/zdtm.py b/test/zdtm.py index dedd8fe54..a6fba88c8 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -222,10 +222,10 @@ class ns_flavor: ] __dev_dirs = ["pts", "net"] - def __init__(self, opts): - self.name = "ns" + def __init__(self, opts, name="ns", uns=False): + self.name = name self.ns = True - self.uns = False + self.uns = uns self.root, self.devpath = make_tests_root() self.root_mounted = False @@ -357,9 +357,7 @@ class ns_flavor: class userns_flavor(ns_flavor): def __init__(self, opts): - ns_flavor.__init__(self, opts) - self.name = "userns" - self.uns = True + ns_flavor.__init__(self, opts, name="userns", uns=True) def init(self, l_bins, x_bins): # To be able to create roots_yard in CRIU