Skip to content

[Windows] PSUTIL service lookup having unicode issue with special characters - (Č) to be specific #2506

Open
@MrPippin66

Description

Summary

  • OS: Windows Server
  • Architecture: x86
  • Psutil version: 6.1.1
  • Python version: 3.6.8
  • Type: core

Description

From Nagios NCPA.

There is apparent Unicode issue with the service status check for psutil.

Service names that have a non-standard UTF character will fail a lookup in service status:

File "psutil_pswindows.py", line 628, in status
File "psutil_pswindows.py", line 558, in _query_status
File "contextlib.py", line 158, in exit
File "psutil_pswindows.py", line 583, in _wrap_exceptions
psutil.NoSuchProcess: service 'ČSOB Business Connector' does not exist (name='ČSOB Business Connector')

I note that PSUTIL in the service iteration is doing a Unicode conversion.

PyUnicode_FromWideChar(*)

But...when looking up a specific service, it's not doing the transverse, which may be what causes this problem

    def description(self):
        """Service long description."""
        return cext.winservice_query_descr(self.name())

AKA, converting self.name() via PyUnicode_AsWideChar(*) back to wchar format.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions