smartctl verify fails due to Unicode in Disk Vendor Name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Medium
|
Alberto Donato | ||
3.1 |
Fix Released
|
Medium
|
Alberto Donato | ||
3.2 |
Fix Released
|
Medium
|
Alberto Donato | ||
3.3 |
Fix Released
|
Medium
|
Alberto Donato |
Bug Description
When running a test against a disk that has a Unicode character in the Vendor's name, the smartctl_validate script is unable to parse the output and marks the test as failed;
INFO: Veriying SMART support for the following drive: /dev/sdc
INFO: Running command: sudo -n smartctl --all /dev/sdc
Traceback (most recent call last):
File "/tmp/user_
sys.
File "/tmp/user_
check_
File "/tmp/user_
match = smart_support_
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 377: invalid start byte
Specifically, the Additional Product ID field has a ▒ character after "DELL":
Add. Product Id: DELL▒
I must admit, I don't know *why* this character is present in smartctl's output, however it does cause MAAS to fail testing for the disk despite otherwise perfectly fine SMART data.
I've attached the full smartctl output.
Related branches
- Alberto Donato: Approve
-
Diff: 63 lines (+16/-4)2 files modifiedsrc/metadataserver/builtin_scripts/testing_scripts/smartctl.py (+8/-4)
src/metadataserver/builtin_scripts/testing_scripts/tests/test_smartctl.py (+8/-0)
- Alberto Donato: Approve
-
Diff: 63 lines (+16/-4)2 files modifiedsrc/metadataserver/builtin_scripts/testing_scripts/smartctl.py (+8/-4)
src/metadataserver/builtin_scripts/testing_scripts/tests/test_smartctl.py (+8/-0)
- Alberto Donato: Approve
-
Diff: 63 lines (+16/-4)2 files modifiedsrc/metadataserver/builtin_scripts/testing_scripts/smartctl.py (+8/-4)
src/metadataserver/builtin_scripts/testing_scripts/tests/test_smartctl.py (+8/-0)
- MAAS Lander: Needs Fixing
- Adam Collard (community): Approve
-
Diff: 63 lines (+16/-4)2 files modifiedsrc/metadataserver/builtin_scripts/testing_scripts/smartctl.py (+8/-4)
src/metadataserver/builtin_scripts/testing_scripts/tests/test_smartctl.py (+8/-0)
Changed in maas: | |
milestone: | none → 2.5.0 |
status: | New → Triaged |
Changed in maas: | |
assignee: | nobody → Lee Trager (ltrager) |
status: | Triaged → In Progress |
importance: | Undecided → High |
importance: | High → Medium |
Changed in maas: | |
milestone: | 2.5.0 → 2.5.x |
summary: |
- [2.4.0~rc1] smartctl verify fails due to Unicode in Disk Vendor Name + smartctl verify fails due to Unicode in Disk Vendor Name |
Changed in maas: | |
milestone: | none → 3.3.0 |
Changed in maas: | |
milestone: | 3.3.0 → 3.4.0 |
Changed in maas: | |
assignee: | nobody → Alberto Donato (ack) |
status: | Triaged → In Progress |
Changed in maas: | |
status: | In Progress → Fix Committed |
Changed in maas: | |
milestone: | 3.4.0 → 3.4.0-beta1 |
Changed in maas: | |
status: | Fix Committed → Fix Released |
I'm having some trouble reproducing this. I download the output uploaded and was able to read it with
import re regex.search( output. decode( 'utf-8' )
smart_support_regex = re.compile('SMART support is:\s+Available')
output = open('smartctl unicode.txt', 'rb').read()
match = smart_support_
match is not None
True
If you modify
match = smart_support_ regex.search( output. decode( 'utf-8' ))
To
match = smart_support_ regex.search( output. decode( 'utf-8' , 'replace'))
Does the smartctl test pass?