Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-1477

provider command throws exception on unicode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Cannot Reproduce
    • Affects Version/s: PUP 3.4.1
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
    • Template:
    • Team:
      Coremunity

      Description

      I have a provider for pbis configuration (linux and ad integration) and a command for '/opt/pbis/bin/config':

      commands :pbis_config => '/opt/pbis/bin/config'

      which I use it like so:

      output = pbis_config(setting, value)

      Sometimes the command from pbis returns a string that has a unicode character inside (a "zero-width space"). If this happens an exception is thrown with the following message:

      Debug: Executing '/opt/pbis/bin/config --show LoginShellTemplate'
      Debug: Joindomain[join_domain](provider=pbis): Execution of '/opt/pbis/bin/config --show LoginShellTemplate' returned 1: Error: Out of memory
      

      I tested the output of the command from the console and used perl to decode the strings:

      perl -e 'print sprintf("\\x{%x}", $_) foreach (unpack("C*", "/bin/bash​"));print"\n"'
      \x{2f}\x{62}\x{69}\x{6e}\x{2f}\x{62}\x{61}\x{73}\x{68}\x{e2}\x{80}\x{8b}
      

      The last 3 bytes are the unicode characters for zero-width space.

      Full output of the command:

      /opt/pbis/bin/config --show LoginShellTemplate
      string
      /bin/bash​
      local policy
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              falcas cristi falcas
              QA Contact:
              Narmadha Perumal Narmadha Perumal
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support