lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_TtXaRnaU1zXbXv@pampelmuse>
Date: Tue, 8 Apr 2025 11:33:17 +0200
From: Gon Solo <gonsolo@...il.com>
To: Duje Mihanović <duje.mihanovic@...le.hr>
Cc: Thomas Gleixner <tglx@...utronix.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Ricardo Ribalda <ribalda@...omium.org>, linux-spdx@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts/spdxcheck: Limit the scope of git.Repo

> > checkpatch suddenly broke for me with the same error as shown here and the 
> > patch fixed it.
> > 
> > Tested-by: Duje Mihanović <duje.mihanovic@...le.hr>

Turns out, it was not enough; the variable is used later.
How about the following patch?

>From 763f25c8ca2e29f343bfd109a17501de71b38d43 Mon Sep 17 00:00:00 2001
From: Andreas Wendleder <gonsolo@...il.com>
Date: Tue, 8 Apr 2025 11:21:17 +0200
Subject: [PATCH] Fix spdxcheck.py.

As explained in Ricardo Ribalda's patch:

If the git.Repo object's scope extends to the Python interpreter's
shutdown phase, its destructor may fail due to the interpreter's state.

Exception ignored in: <function Git.AutoInterrupt.__del__ at 0x76e6b0148040>
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/git/cmd.py", line 790, in __del__
  File "/usr/lib/python3.13/site-packages/git/cmd.py", line 781, in _terminate
  File "/usr/lib/python3.13/subprocess.py", line 2227, in terminate
ImportError: sys.meta_path is None, Python is likely shutting down

Unfortunately, repo is used later at line 392 and 399, so we have to
keep it and manually delete it before exiting. This can be checked by
testing a directory instead of a file.

Signed-off--by: Andreas Wendleder <gonsolo@...il.com>
---
 scripts/spdxcheck.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 8d608f61bf37..6a89e2b2faba 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -448,6 +448,7 @@ if __name__ == '__main__':
                     for f in sorted(di.files):
                         sys.stderr.write('    %s\n' %f)
 
+            del repo
             sys.exit(0)
 
     except Exception as ex:
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ