On 01.06.2019 12:52, Leonardo Taccari wrote: > Kamil Rytarowski writes: >> [...] >> Change the definition of psutil_cwd() to one that works. >> [...] >> +$NetBSD: patch-terminatorlib_cwd.py,v 1.1 2019/06/01 01:17:12 kamil Exp $ >> + >> +Use syntax of .cwd() that works, as_dict()['cwd'] faults. >> +Fixes terminator on NetBSD. >> + >> +--- terminatorlib/cwd.py.orig 2019-06-01 01:01:46.535724473 +0000 >> ++++ terminatorlib/cwd.py >> +@@ -82,6 +82,6 @@ def sunos_get_pid_cwd(pid): >> + >> + def psutil_cwd(pid): >> + """Determine the cwd using psutil which also supports Darwin""" >> +- return psutil.Process(pid).as_dict()['cwd'] >> ++ return psutil.Process(pid).cwd() >> + >> + # vim: set expandtab ts=4 sw=4: >> > > JFTR, it seems that the problem is not specific to py-terminator > but a sysutils/py-psutil one. > > E.g.: > > | % python3.7 > | Python 3.7.3 (default, May 3 2019, 17:54:14) > | [GCC 7.4.0] on netbsd8 > | Type "help", "copyright", "credits" or "license" for more information. > | >>> import psutil > | >>> psutil.Process(1).as_dict() > | Traceback (most recent call last): > | File "<stdin>", line 1, in <module> > | File "/usr/pkg/lib/python3.7/site-packages/psutil/__init__.py", line 638, in as_dict > | ret = meth() > | File "/usr/pkg/lib/python3.7/site-packages/psutil/__init__.py", line 790, in cmdline > | return self._proc.cmdline() > | File "/usr/pkg/lib/python3.7/site-packages/psutil/_psbsd.py", line 562, in wrapper > | return fun(self, *args, **kwargs) > | File "/usr/pkg/lib/python3.7/site-packages/psutil/_psbsd.py", line 666, in cmdline > | return cext.proc_cmdline(self.pid) > | MemoryError > > The MemoryError is from > psutil/arch/netbsd/specific.c:psutil_get_cmd_args() (that is called > via psutil_proc_cmdline() -> psutil_get_cmdline() -> > psutil_get_cmd_args()) and, unfortunately, adding debugging printf() > seems to interfere with that (i.e. calling .as_dict() succeed). > > Attaching `gdb' against the Python process and trying to set a > `breakpoint' unfortunately doesn't work (i.e. the breakpoint to > psutil_get_cmd_args is set but never hit). > > If anyone has any idea how to debug this further or can spot anything > please let me know! > This failure predates my workaround in terminator and my kernel patch for KERN_PROC_CWD. I miss some expertise in Python, but this bug is likely from C module code or less likely Python C code. Terminator used to work so this is a regression.
Attachment:
signature.asc
Description: OpenPGP digital signature