Coder Social home page Coder Social logo

Comments (5)

eLvErDe avatar eLvErDe commented on July 27, 2024 1

Good 'ol iso8859 :D

I'll send you a patch to try tomorrow

from hwraid.

eLvErDe avatar eLvErDe commented on July 27, 2024

It seems your megacli outputs some characters in a non-utf8 charset, that's very weird.
Can you send the output to a file and run "file" on it to see what charset it detects ?

from hwraid.

Delido avatar Delido commented on July 27, 2024
/usr/sbin/megacli -LDInfo -l0 -a0 -NoLog > /tmp/mega
❯ file -0 /tmp/mega
/tmp/mega: ISO-8859 text, with CR, LF line terminators

on another working Server:

file -0 /tmp/mega
/tmp/mega: ASCII text, with CR, LF line terminators

from hwraid.

Delido avatar Delido commented on July 27, 2024

why is the output iso8859? all locale Settings between the Servers are the same and UTF-8 are default. Can / must i change something?

from hwraid.

krietvel avatar krietvel commented on July 27, 2024

We are running a bunch of old PERC 5/i adapters, for which MegaCLI 8.07.14 gives non-UTF8 and non-ASCII output (classified as "data" by the file command). I ended up using the patch below to get megaclisas-status to work with Python 3.9 on bullseye. It replaces popen with subprocess.Popen to be able to ignore the conversion errors ...

diff a/wrapper-scripts/megaclisas-status b/wrapper-scripts/megaclisas-status
--- a/wrapper-scripts/megaclisas-status
+++ b/wrapper-scripts/megaclisas-status
@@ -11,6 +11,7 @@ import sys
 import pdb
 import inspect
 import argparse
+from subprocess import Popen, PIPE, STDOUT
 
 if sys.platform == "win32":
     import ctypes
@@ -144,8 +145,10 @@ def getOutput(cmd):
         lines = Outputs[cmd]
     else:
         dbgprint("Not a Cached value: " + str(cmd))
-        output = os.popen(cmd)
-        for line in output:
+        process = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, text=True, errors='ignore')
+        process.wait()
+        output = process.stdout.read()
+        for line in output.split("\n"):
             if not re.match(r"^$", line.strip()):
                 lines.append(line.strip())
         Outputs[cmd] = lines

from hwraid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.