Skip to content

Commit

Permalink
update patches
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf committed Oct 14, 2024
1 parent ddda071 commit a7ef7e4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 5c0c0893c7565a39f1ac3f9c286fd1e1c58a7cd6 Mon Sep 17 00:00:00 2001
From 6ba9b4ebe51d4ef706256a223d03406b90192225 Mon Sep 17 00:00:00 2001
From: Sam Gross <[email protected]>
Date: Mon, 24 Jun 2024 17:51:07 +0000
Subject: [PATCH 1/2] Fix GIL warnings and a few thread-safety issues in
Expand All @@ -22,7 +22,7 @@ Signed-off-by: Sam Gross <[email protected]>
9 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/psutil/_psutil_aix.c b/psutil/_psutil_aix.c
index ce89a7bd7c..42f921188e 100644
index ce89a7b..42f9211 100644
--- a/psutil/_psutil_aix.c
+++ b/psutil/_psutil_aix.c
@@ -1080,6 +1080,9 @@ void init_psutil_aix(void)
Expand All @@ -36,7 +36,7 @@ index ce89a7bd7c..42f921188e 100644
PyModule_AddIntConstant(module, "version", PSUTIL_VERSION);

diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c
index 6517d5800a..facaba831f 100644
index 6517d58..facaba8 100644
--- a/psutil/_psutil_bsd.c
+++ b/psutil/_psutil_bsd.c
@@ -143,6 +143,10 @@ static PyMethodDef mod_methods[] = {
Expand All @@ -51,7 +51,7 @@ index 6517d5800a..facaba831f 100644
// process status constants

diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c
index 292e1c5524..46244c5792 100644
index 292e1c5..46244c5 100644
--- a/psutil/_psutil_linux.c
+++ b/psutil/_psutil_linux.c
@@ -78,6 +78,10 @@ static PyMethodDef mod_methods[] = {
Expand All @@ -66,7 +66,7 @@ index 292e1c5524..46244c5792 100644
if (PyModule_AddIntConstant(mod, "DUPLEX_HALF", DUPLEX_HALF)) INITERR;
if (PyModule_AddIntConstant(mod, "DUPLEX_FULL", DUPLEX_FULL)) INITERR;
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index 4aa11d1700..09fa267a98 100644
index 4aa11d1..09fa267 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -91,6 +91,10 @@ static PyMethodDef mod_methods[] = {
Expand All @@ -81,7 +81,7 @@ index 4aa11d1700..09fa267a98 100644
INITERR;

diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c
index 24628afc78..8ced7beaac 100644
index 24628af..8ced7be 100644
--- a/psutil/_psutil_posix.c
+++ b/psutil/_psutil_posix.c
@@ -913,6 +913,10 @@ static PyMethodDef mod_methods[] = {
Expand All @@ -96,7 +96,7 @@ index 24628afc78..8ced7beaac 100644
defined(PSUTIL_OSX) || \
defined(PSUTIL_SUNOS) || \
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 54f353c106..d21f59c618 100644
index 54f353c..d21f59c 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -1721,6 +1721,10 @@ void init_psutil_sunos(void)
Expand All @@ -111,7 +111,7 @@ index 54f353c106..d21f59c618 100644
INITERROR;

diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index bb6e12ff80..0c221bdc23 100644
index bb6e12f..0c221bd 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -165,6 +165,10 @@ void init_psutil_windows(void)
Expand All @@ -126,7 +126,7 @@ index bb6e12ff80..0c221bdc23 100644
INITERROR;
if (psutil_set_se_debug() != 0)
diff --git a/psutil/arch/freebsd/cpu.c b/psutil/arch/freebsd/cpu.c
index a15d96efc1..9fa1a7dbe6 100644
index a15d96e..9fa1a7d 100644
--- a/psutil/arch/freebsd/cpu.c
+++ b/psutil/arch/freebsd/cpu.c
@@ -26,7 +26,7 @@ For reference, here's the git history with original(ish) implementations:
Expand All @@ -139,7 +139,7 @@ index a15d96efc1..9fa1a7dbe6 100644
int ncpu;
size_t len;
diff --git a/psutil/arch/openbsd/proc.c b/psutil/arch/openbsd/proc.c
index 96b85bc502..bec2c42ea7 100644
index 96b85bc..bec2c42 100644
--- a/psutil/arch/openbsd/proc.c
+++ b/psutil/arch/openbsd/proc.c
@@ -147,7 +147,7 @@ PyObject *
Expand All @@ -163,28 +163,6 @@ index 96b85bc502..bec2c42ea7 100644
Py_XDECREF(py_arg);
Py_DECREF(py_retlist);
return NULL;
--
2.44.0

From 69c74c63a322fae4a763bf8347f9e5e3202d5ecf Mon Sep 17 00:00:00 2001
From: Sam Gross <[email protected]>
Date: Mon, 24 Jun 2024 18:26:00 +0000
Subject: [PATCH 2/2] Add `if (argv != NULL)` check

Signed-off-by: Sam Gross <[email protected]>
---
psutil/arch/openbsd/proc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/psutil/arch/openbsd/proc.c b/psutil/arch/openbsd/proc.c
index bec2c42ea7..0881ccd555 100644
--- a/psutil/arch/openbsd/proc.c
+++ b/psutil/arch/openbsd/proc.c
@@ -193,7 +193,8 @@ psutil_proc_cmdline(PyObject *self, PyObject *args) {
return py_retlist;

error:
- free(argv);
+ if (argv != NULL)
+ free(argv);
Py_XDECREF(py_arg);
Py_DECREF(py_retlist);
return NULL;
27 changes: 27 additions & 0 deletions recipe/0002-Add-if-argv-NULL-check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From ad34a0bfbd75e2b5a21c0cfc0fee77529e0d2319 Mon Sep 17 00:00:00 2001
From: Sam Gross <[email protected]>
Date: Mon, 24 Jun 2024 18:26:00 +0000
Subject: [PATCH 2/2] Add `if (argv != NULL)` check

Signed-off-by: Sam Gross <[email protected]>
---
psutil/arch/openbsd/proc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/psutil/arch/openbsd/proc.c b/psutil/arch/openbsd/proc.c
index bec2c42..0881ccd 100644
--- a/psutil/arch/openbsd/proc.c
+++ b/psutil/arch/openbsd/proc.c
@@ -193,7 +193,8 @@ psutil_proc_cmdline(PyObject *self, PyObject *args) {
return py_retlist;

error:
- free(argv);
+ if (argv != NULL)
+ free(argv);
Py_XDECREF(py_arg);
Py_DECREF(py_retlist);
return NULL;
--
2.44.0

4 changes: 3 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ source:
url: https://pypi.io/packages/source/p/psutil/psutil-{{ version }}.tar.gz
sha256: {{ sha256 }}
patches:
- gh2428.patch
# These two patches are from gh2428
- 0001-Fix-GIL-warnings-and-a-few-thread-safety-issues-in-f.patch
- 0002-Add-if-argv-NULL-check.patch

build:
number: 2
Expand Down

0 comments on commit a7ef7e4

Please sign in to comment.