microsoft / omi

Open Management Infrastructure
Other
361 stars 115 forks source link

OMI fails with invalid character #767

Closed vaibhavgulhane closed 3 days ago

vaibhavgulhane commented 2 weeks ago

I am running command on Linux to get Win32_ComputerSystemProduct from Windows. Expected Output: image

If I store the output in a variable or any file, then some characters of xml data is changed. These characters are changed randomly. image

This issue is reproducing on

Same command works on CentOS 7.

locale is set to en_US.UTF-8 on all OS.

Please help me in resolving this issue.

JumpingYang001 commented 1 week ago

@vaibhavgulhane you use this in SCOM or Azure product? I don't see this scenario for supported products. can you try omicl ** > /tmp/yourresult.txt and then read the content from /tmp/yourresult.txt? from you description it seems be related to encoding of bash command.

vaibhavgulhane commented 6 days ago

@JumpingYang001 I am using this on Hyper-V. Redirecting to a file shows same behavior. Hexdump shows that characters are different every time. Below screenshots shows that string 32_Compu in Win32_ComputerSystem is changed with random characters. Changed characters are different in first and second screenshot: image

image

Using stdbuf -o0 cmd > file resolves the issue.

JumpingYang001 commented 3 days ago

glad to know you have work around, in fact, we don't have supported products that use that Linux omicli to query Windows now. :)