Skip to content

arcstat -p and fix for compatibility with py2/3 #12916

@justinpryzby

Description

@justinpryzby

System information

Type Version/Name
Distribution Name CentOS Linux
Distribution Version 7
Kernel Version 3.10.0-1160.11.1.el7
Architecture x86_64
OpenZFS Version 2.0.6 and .7

Describe the problem you're observing

arcstat -p doesn't work with either version of python:

Describe how to reproduce the problem

$ /usr/bin/python3.6 /usr/bin/arcstat -p
time read miss miss% dmis dm% pmis pm% mmis mm% size c avail
Traceback (most recent call last):
File "/usr/bin/arcstat", line 521, in
main()
File "/usr/bin/arcstat", line 506, in main
print_values()
File "/usr/bin/arcstat", line 260, in print_values
sys.stdout.write(sep.join(fmt(col) for col in hdr))
TypeError: sequence item 1: expected str instance, float found

Also, arcstat without -p shows rounded values with only one significant figure when run with py2.7.
The rounding behavior changed in py3 (/ means FP division, and integer division is now //).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions