Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-27092

Windows - services that have non-ASCII characters do not work with activeCodePage=UTF8

    XMLWordPrintable

Details

    Description

      That's a Windows bug for which I could not find a reference anywhere else.
      Service functions, e.g CreateService/OpenService, do not handle activeCodePage=UTF8 correctly
      i.e if either service name, or the command line contain non-ASCIIs, it would produce a mojibake.

      It affects us since we actually want to use activeCodePage=UTF8 , and need to ensure that as much as possible would work here, too

      To reproduce, one will need reasonably new Windows (10 1903+).
      1. Unpack the repro zip in the attachment
      2. build the test executable
      3. Call path\to\service_test.exe <string_with_non-ASCII_character>. It should create service with that name, but it does not happen, as we see later-
      4. call "sc query <string_from_>" to see that service was not created, see below for demonstration

      The fix/workaround we can do , is not to use those functions directly, but write a wrapper that actually does what is expected (convert string parameters from ANSI to wide, call wide function)

      C:\work\repro\xxx\Debug>service_test.exe sörvis
       
      C:\work\repro\xxx\Debug>sc query sörvis
      [SC] EnumQueryServicesStatus:OpenService FAILED 1060:
       
      The specified service does not exist as an installed service.
       
      C:\work\repro\xxx\Debug> sc query sörvis
       
      SERVICE_NAME: sörvis
              TYPE               : 10  WIN32_OWN_PROCESS
              STATE              : 1  STOPPED
              WIN32_EXIT_CODE    : 1077  (0x435)
              SERVICE_EXIT_CODE  : 0  (0x0)
              CHECKPOINT         : 0x0
              WAIT_HINT          : 0x0
       
      C:\work\repro\xxx\Debug> sc delete sörvis
      [SC] DeleteService SUCCESS
      

      Attachments

        Issue Links

          Activity

            People

              wlad Vladislav Vaintroub
              wlad Vladislav Vaintroub
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.