Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arc_summary.py crashes with -d option when called with Python 3 #6849

Closed
scotws opened this issue Nov 8, 2017 · 1 comment
Closed

arc_summary.py crashes with -d option when called with Python 3 #6849

scotws opened this issue Nov 8, 2017 · 1 comment

Comments

@scotws
Copy link
Contributor

scotws commented Nov 8, 2017

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version 16.04 LTS
Linux Kernel 4.10.0-38-generic
Architecture amd64
ZFS Version 0.6.5.9-2
SPL Version 0.6.5.9-1

Describe the problem you're observing

arc_summary.py crashes when called with the option -d with Python 3. The problem does no occur with Python 2.

Describe how to reproduce the problem

Run python3 arc_summary.py -d

Include any warning/errors/backtraces from the system logs

Traceback (most recent call last):
  File "/usr/sbin/arc_summary.py", line 1148, in <module>
    main()
  File "/usr/sbin/arc_summary.py", line 1144, in main
    page(Kstat)
  File "/usr/sbin/arc_summary.py", line 1035, in _tunable_summary
    description_list = p.communicate()[0].strip().split('\0')
TypeError: a bytes-like object is required, not 'str'

Tentative Diagnosis

Python 3 changed the way encoding is handled with files (see https://docs.python.org/3.0/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit). It is probable that the pipe called here now returns the wrong sort of data.

@scotws
Copy link
Contributor Author

scotws commented Nov 8, 2017

After a bit of testing: Python2 returns a string as the first element of the tuple produced by p.communicate() here, but Python3 returns bytes. Will take a look at fixes and figure out a PR to fix this.

scotws added a commit to scotws/zfs that referenced this issue Nov 8, 2017
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3 (see issue openzfs#6849)

Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
scotws added a commit to scotws/zfs that referenced this issue Nov 9, 2017
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3 (see issue openzfs#6849). Rewrite of
call to "modinfo zfs -0". Removes variable type information from
description ("(uint)", "(int)", etc).

Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
scotws added a commit to scotws/zfs that referenced this issue Nov 10, 2017
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3 (see issue openzfs#6849)

Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
scotws added a commit to scotws/zfs that referenced this issue Nov 10, 2017
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3 (see issue openzfs#6849)

Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
scotws added a commit to scotws/zfs that referenced this issue Nov 10, 2017
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3 (see issue openzfs#6849)

Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jan 16, 2018
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes openzfs#6849 
Closes openzfs#6850
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jan 18, 2018
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes openzfs#6849 
Closes openzfs#6850
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jan 18, 2018
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes openzfs#6849 
Closes openzfs#6850
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jan 19, 2018
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes openzfs#6849 
Closes openzfs#6850
Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this issue Jan 29, 2018
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes openzfs#6849
Closes openzfs#6850
tonyhutter pushed a commit that referenced this issue Feb 6, 2018
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes #6849 
Closes #6850
Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this issue Feb 13, 2018
Prevents arc_summary.py crashing when called with parameter -d or
long form --description with Python3.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Scot W. Stevenson <scot.stevenson@gmail.com>
Closes openzfs#6849
Closes openzfs#6850
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant