fluent / fluent-package-builder

td-agent (Fluentd) Building and Packaging System
Apache License 2.0
21 stars 23 forks source link

Windows: a garbage character is sometimes placed at the end of 'fluentdopt' registry value (fluent-package) #619

Closed daipom closed 4 months ago

daipom commented 4 months ago

Abst

Details

I feel like 100 characters would be easy to reproduce. (I am not sure if the number of characters really has anything to do with the ease of reproduction.)

> fluentd --reg-winsvc-fluentdopt aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

2024-02-16_12h09_16

Confirm the value:

 require "win32/registry"

 Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM\\CurrentControlSet\\Services\\fluentdwinsvc") do |reg|
   p reg.read("fluentdopt")[1] # A
   type, data = Win32::Registry::API.QueryValue(reg.hkey, "fluentdopt")
   p data.encode(Encoding::UTF_8, Encoding::UTF_16LE) # B
   p data.encode(Encoding::UTF_8, Encoding::UTF_16LE).bytes #C
 end

A:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

B:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaꘀ"

C:[97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 234, 152, 128]

The garbage character can be different.

ashie commented 4 months ago

We confirmed that it's completely harmless because:

  * However, it does not impact the Fluentd's behavior since [Ruby chops the character regardless of the content](https://github.com/ruby/ruby/blob/v3_2_2/ext/win32/lib/win32/registry.rb#L652)

We suspected it might be the cause of #618, but we've confirmed that it's not applicable too. So we no longer need to track this issue.

daipom commented 4 months ago

Agreed. It will be fixed when updating the Ruby. We don't need to track this issue.