Jira (FACT-3206) Facter::Core::Execution.exec strips leading and trailing NULL bytes
Title: Message Title Kai Burghardt created an issue Facter / FACT-3206 Facter::Core::Execution.exec strips leading and trailing NULL bytes Issue Type: Bug Assignee: Unassigned Created: 2023/06/03 11:23 AM Priority: Normal Reporter: Kai Burghardt (on the puppet master) create a custom fact Facter.add('test') do setcode do # This makes # Error: Facter: Error while resolving custom fact fact='sysctl', resolution='': invalid byte sequence in UTF-8 # go away: Encoding.default_external = Encoding::ASCII_8BIT
Jira (FACT-3206) Facter::Core::Execution.exec strips leading and trailing NULL bytes
Title: Message Title Kai Burghardt updated an issue Facter / FACT-3206 Facter::Core::Execution.exec strips leading and trailing NULL bytes Change By: Kai Burghardt Acceptance Criteria: {{puppet facts test}} reports {{4}} ({_}four{_} bytes) Remaining Estimate: 1 hour Original Estimate: 1 hour # (on the puppet master) create a custom fact {code: java ruby } Facter.add('test') do setcode do # This makes # Error: Facter: Error while resolving custom fact fact='sysctl', resolution='': invalid byte sequence in UTF-8 # go away: Encoding.default_external = Encoding::ASCII_8BITvalue = Facter::Core::Execution.execute('/bin/cat /tmp/null')value.bytesize endend {code} # (on the node) create some content containing leading and/or trailing NULL bytes {code: java shell } echo -en "\x00\x00\x00\x00" > /tmp/null {code} # (on the node) synchronize so the {{test}} fact becomes available # (on the node) query the new fact {code: java shell } puppet facts test{code} This reports {{0}} (zero) Add Comment
Jira (FACT-3206) Facter::Core::Execution.exec strips leading and trailing NULL bytes
Title: Message Title Kai Burghardt updated an issue Facter / FACT-3206 Facter::Core::Execution.exec strips leading and trailing NULL bytes Change By: Kai Burghardt # (on the puppet master) create a custom fact{code:ruby}Facter.add('test') do setcode do # This makes # Error: Facter: Error while resolving custom fact fact=' sysctl test ', resolution='': invalid byte sequence in UTF-8 # go away: Encoding.default_external = Encoding::ASCII_8BITvalue = Facter::Core::Execution.execute('/bin/cat /tmp/null')value.bytesize endend{code} # (on the node) create some content containing leading and/or trailing NULL bytes{code:shell}echo -en "\x00\x00\x00\x00" > /tmp/null{code} # (on the node) synchronize so the {{test}} fact becomes available # (on the node) query the new fact{code:shell}puppet facts test{code}This reports {{0}} (zero) Add Comment This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
Jira (FACT-3206) Facter::Core::Execution.exec strips leading and trailing NULL bytes
Title: Message Title Kai Burghardt updated an issue Facter / FACT-3206 Facter::Core::Execution.exec strips leading and trailing NULL bytes Change By: Kai Burghardt Acceptance Criteria: {{puppet facts test --value-only }} reports {{4}} ({_}four{_} bytes) # (on the puppet master) create a custom fact{code:ruby}Facter.add('test') do setcode do # This makes # Error: Facter: Error while resolving custom fact fact='test', resolution='': invalid byte sequence in UTF-8 # go away: Encoding.default_external = Encoding::ASCII_8BITvalue = Facter::Core::Execution.execute('/bin/cat /tmp/null')value.bytesize endend{code} # (on the node) create some content containing leading and/or trailing NULL bytes{code:shell}echo -en "\x00\x00\x00\x00" > /tmp/null{code} # (on the node) synchronize so the {{test}} fact becomes available # (on the node) query the new fact{code:shell}puppet facts test --value-only {code}This reports {{0}} (zero) . Add Comment This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8)
Jira (FACT-3206) Facter::Core::Execution.exec strips leading and trailing NULL bytes
Title: Message Title Kai Burghardt updated an issue Facter / FACT-3206 Facter::Core::Execution.exec strips leading and trailing NULL bytes Change By: Kai Burghardt Method Found: Needs Assessment Manual Test Affects Version/s: FACT 4.2.14 Add Comment This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.486429.1685816622000.4536.1685817540024%40Atlassian.JIRA.
Jira (FACT-3206) Facter::Core::Execution.exec strips leading and trailing NULL bytes
Title: Message Title Kai Burghardt commented on FACT-3206 Re: Facter::Core::Execution.exec strips leading and trailing NULL bytes I see. Thank you for linking the other issue. This is grabbing data (a set of numbers) via a binary interface. The information is also available in human-readable form. It is just less of a hassle to take and process four 8-byte sequences (if they were available via Facter::Core::Execution.exec), instead of processing the human-readable output and separating textual labels/suffixes etc. from the actual numbers, and let’s not forget the round-trip conversion (binary number → string → back to a binary number). Add Comment This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.486429.1685816622000.5254.1686084420075%40Atlassian.JIRA.