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

Handle incompatible encodings in Puppet::Util::Log when rendering to console

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.0.0
    • Component/s: None
    • Template:
    • Acceptance Criteria:
      Hide
      • Puppet::Util::Log can handle a variety of encoded strings without crashing the console and successfully printing the characters.
      • Should work on Japanese Windows, German Windows, and French Windows, and non-unicode German Linux.
      Show
      Puppet::Util::Log can handle a variety of encoded strings without crashing the console and successfully printing the characters. Should work on Japanese Windows, German Windows, and French Windows, and non-unicode German Linux.
    • Team:
      Agent
    • Story Points:
      5
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Prior to Puppet 5.0.0, when printing values to the console that were in a character encoding incompatible with UTF-8 or contained invalid byte sequences, puppet would fail, usually with an `incompatible encodings` error. In Puppet 5.0.0 and later, Puppet will log in UTF-8, and issue a warning upon encountering invalid strings with their content and the backtrace leading up to the log event.
      Show
      Prior to Puppet 5.0.0, when printing values to the console that were in a character encoding incompatible with UTF-8 or contained invalid byte sequences, puppet would fail, usually with an `incompatible encodings` error. In Puppet 5.0.0 and later, Puppet will log in UTF-8, and issue a warning upon encountering invalid strings with their content and the backtrace leading up to the log event.
    • QA Risk Assessment:
      Needs Assessment

      Description

      When showing the results of Puppet::Util::Execution.execute in the console, for example, to log to the console the results of diff -u, (https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/diff.rb#L18), we return a result string in Encoding.default_external, i.e., perhaps ISO-8859-1 (from https://github.com/puppetlabs/puppet/blob/master/lib/puppet/type/file/data_sync.rb#L44). This ultimately makes its way to Puppet::Util::Log::Destinations https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/log/destinations.rb#L167 where we try to concatenate it with a UTF-8 string, and fail.

      I think this is likely the root cause of PUP-1441, and relates to PUP-6432.

      Beyond the concatenation issue, there is perhaps a deeper issue, which is - what should we do when the console is not capable of rendering the content? Should we use replacement characters? Just print and hope for the best?

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  moses Moses Mendoza
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support