<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/psutil.git/psutil/tests, branch master</title>
<subtitle>github.com: giampaolo/psutil.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/'/>
<entry>
<title>fix typos and some other minor bugs (#2253)</title>
<updated>2023-05-09T10:03:08+00:00</updated>
<author>
<name>cui fliter</name>
<email>imcusg@gmail.com</email>
</author>
<published>2023-05-09T10:03:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=49aba759744c06fb3a6fa998155428520f161734'/>
<id>49aba759744c06fb3a6fa998155428520f161734</id>
<content type='text'>
Signed-off-by: cui fliter &lt;imcusg@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: cui fliter &lt;imcusg@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>skip who CLI related test if necessary</title>
<updated>2023-05-02T11:01:20+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-05-02T11:01:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=5c52826e7eac9648006392f5d491f6fdf6ff50a8'/>
<id>5c52826e7eac9648006392f5d491f6fdf6ff50a8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>SunOS: fix some C compilation warnings</title>
<updated>2023-04-22T20:00:03+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-22T20:00:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=12fe73d2ed9c10ee5fa9b2e9fe00a2a27fe77e22'/>
<id>12fe73d2ed9c10ee5fa9b2e9fe00a2a27fe77e22</id>
<content type='text'>
Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fix failing users() test; update HISTORY; give CREDITS to @0-wiz-0 for #2241</title>
<updated>2023-04-19T22:22:49+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-19T22:22:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=3287ea328f76da7e5ff6cc148fdbd5afe33099dd'/>
<id>3287ea328f76da7e5ff6cc148fdbd5afe33099dd</id>
<content type='text'>
Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>C refact: remove useless cmdline / cwd / environ layers. Call direct functions</title>
<updated>2023-04-18T11:05:04+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-18T11:05:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=efd7ed3d2c4aca57226572b2a81e5d7ebb9f3b8b'/>
<id>efd7ed3d2c4aca57226572b2a81e5d7ebb9f3b8b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add CI testing for OpenBSD and NetBSD (#2240)</title>
<updated>2023-04-17T17:58:47+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-17T17:58:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=190059c69d0aa01b3f17ba5191d0a6e6d9669841'/>
<id>190059c69d0aa01b3f17ba5191d0a6e6d9669841</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix #2239 / proc name(): don't fail with ZombieProcess on cmdline()</title>
<updated>2023-04-17T00:51:06+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-17T00:51:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=aa42066eacc5b1a2135d1737d16138de3511868a'/>
<id>aa42066eacc5b1a2135d1737d16138de3511868a</id>
<content type='text'>
A recent failure observed on OpenBSD led me to an interesting consideration.

```
======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_long_name
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/psutil/psutil/_psbsd.py", line 566, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 684, in cmdline
    return cext.proc_cmdline(self.pid)
ProcessLookupError: [Errno 3] No such process

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/test_process.py", line 751, in test_long_name
    self.assertEqual(p.name(), os.path.basename(testfn))
  File "/vagrant/psutil/psutil/__init__.py", line 628, in name
    cmdline = self.cmdline()
  File "/vagrant/psutil/psutil/__init__.py", line 681, in cmdline
    return self._proc.cmdline()
  File "/vagrant/psutil/psutil/_psbsd.py", line 569, in wrapper
    raise ZombieProcess(self.pid, self._name, self._ppid)
psutil.ZombieProcess: PID still exists but it's a zombie (pid=48379)
----------------------------------------------------------------------
```

The exception above occurs sporadically. It originates from `sysctl
(KERN_PROC_ARGV)`:
https://github.com/giampaolo/psutil/blob/0a81fa089fd4b25b4b7ee71ed39213b83f73c052/psutil/arch/openbsd/proc.c#L149
The error per se does not represent a bug in the OpenBSD `cmdline
()` implemention because the process **really** is a zombie at that point
(I'm not sure why it's a zombie - this seems only to occur only on OpenBSD for
this specific test case - but that's not the point).

The interesting thing is that the test calls process `name()` (which succeeds,
despite it's a zombie process), but since the process name is too long it gets
truncated to 15 chars (this is a UNIX thing) so psutil tries to guess the
remaining characters from the process `cmdline()`, which fails:
https://github.com/giampaolo/psutil/blob/0a81fa089fd4b25b4b7ee71ed39213b83f73c052/psutil/__init__.py#L623-L630

The problem to fix here is that, if `name()` succeeds but `cmdline()` fails, we
should not raise `ZombieProcess`: we should simply return the
(truncated) process `name()` instead, because that is better than nothing.
Not on OpenBSD but on all platforms.

Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A recent failure observed on OpenBSD led me to an interesting consideration.

```
======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_long_name
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/psutil/psutil/_psbsd.py", line 566, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 684, in cmdline
    return cext.proc_cmdline(self.pid)
ProcessLookupError: [Errno 3] No such process

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/test_process.py", line 751, in test_long_name
    self.assertEqual(p.name(), os.path.basename(testfn))
  File "/vagrant/psutil/psutil/__init__.py", line 628, in name
    cmdline = self.cmdline()
  File "/vagrant/psutil/psutil/__init__.py", line 681, in cmdline
    return self._proc.cmdline()
  File "/vagrant/psutil/psutil/_psbsd.py", line 569, in wrapper
    raise ZombieProcess(self.pid, self._name, self._ppid)
psutil.ZombieProcess: PID still exists but it's a zombie (pid=48379)
----------------------------------------------------------------------
```

The exception above occurs sporadically. It originates from `sysctl
(KERN_PROC_ARGV)`:
https://github.com/giampaolo/psutil/blob/0a81fa089fd4b25b4b7ee71ed39213b83f73c052/psutil/arch/openbsd/proc.c#L149
The error per se does not represent a bug in the OpenBSD `cmdline
()` implemention because the process **really** is a zombie at that point
(I'm not sure why it's a zombie - this seems only to occur only on OpenBSD for
this specific test case - but that's not the point).

The interesting thing is that the test calls process `name()` (which succeeds,
despite it's a zombie process), but since the process name is too long it gets
truncated to 15 chars (this is a UNIX thing) so psutil tries to guess the
remaining characters from the process `cmdline()`, which fails:
https://github.com/giampaolo/psutil/blob/0a81fa089fd4b25b4b7ee71ed39213b83f73c052/psutil/__init__.py#L623-L630

The problem to fix here is that, if `name()` succeeds but `cmdline()` fails, we
should not raise `ZombieProcess`: we should simply return the
(truncated) process `name()` instead, because that is better than nothing.
Not on OpenBSD but on all platforms.

Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fix #2238 if cwd() cannot be determined always return "" instead of None</title>
<updated>2023-04-16T23:01:44+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-16T23:01:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=0e3f6c465181734181f2428b4a99429a82f3fc45'/>
<id>0e3f6c465181734181f2428b4a99429a82f3fc45</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix #2237, OpenBSD, cwd(): return None instead of FileNotFoundError</title>
<updated>2023-04-16T00:31:37+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-16T00:31:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=b070015104ea01689fee9f7c91709c0e2d35a9a8'/>
<id>b070015104ea01689fee9f7c91709c0e2d35a9a8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix NetBSD test failure + add test for cached mem</title>
<updated>2023-04-13T20:52:09+00:00</updated>
<author>
<name>Giampaolo Rodola</name>
<email>g.rodola@gmail.com</email>
</author>
<published>2023-04-13T20:52:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psutil.git/commit/?id=59d8550c147795c6ab89535f719fbf6c8c40d2d5'/>
<id>59d8550c147795c6ab89535f719fbf6c8c40d2d5</id>
<content type='text'>
Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Giampaolo Rodola &lt;g.rodola@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
