Bug 1645815 - hp-check --runtime crashes involving FileNotFoundError: [Errno 2] No such file or directory: '/usr/include/cups' and others
Summary: hp-check --runtime crashes involving FileNotFoundError: [Errno 2] No such fil...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: hplip
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zdenek Dohnal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1648445 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-04 01:23 UTC by Matt Fagnani
Modified: 2018-11-17 05:15 UTC (History)
4 users (show)

Fixed In Version: hplip-3.18.6-11.fc29
Clone Of:
Environment:
Last Closed: 2018-11-17 05:15:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
hp-check --runtime output showing cups errors and warnings (11.28 KB, text/plain)
2018-11-12 20:17 UTC, Matt Fagnani
no flags Details

Description Matt Fagnani 2018-11-04 01:23:50 UTC
Description of problem:

I ran hp-check --runtime to troubleshoot a scanner problem with a HP Officejet 6110 which I'll likely file another report about. hp-check crashed with the following trace indicating that /usr/include/cups was not found.

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 266, in walkFiles
    names = os.listdir(root)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/include/cups'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 268, in walkFiles
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/hp-check", line 861, in <module>
    dep.core.init()
  File "/usr/share/hplip/installer/core_install.py", line 500, in init
    self.check_dependencies(callback)
  File "/usr/share/hplip/installer/core_install.py", line 593, in check_dependencies
    self.have_dependencies[d] = self.dependencies[d][3]()
  File "/usr/share/hplip/installer/core_install.py", line 1139, in check_cups_image
    return check_file("raster.h", "/usr/include/cups")
  File "/usr/share/hplip/installer/dcheck.py", line 108, in check_file
    for w in utils.walkFiles(dir, recurse=True, abs_paths=True, return_folders=False, pattern=f):
RuntimeError: generator raised StopIteration

sudo dnf repoquery --whatprovides /usr/include/cups showed cups-devel-1:2.2.8-5.fc29.i686. After installing cups-devel, I ran hp-check --runtime which crashed with the following trace stating that /usr/include/libusb-1.0 wasn't found.

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 266, in walkFiles
    names = os.listdir(root)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/include/libusb-1.0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 268, in walkFiles
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/hp-check", line 861, in <module>
    dep.core.init()
  File "/usr/share/hplip/installer/core_install.py", line 500, in init
    self.check_dependencies(callback)
  File "/usr/share/hplip/installer/core_install.py", line 593, in check_dependencies
    self.have_dependencies[d] = self.dependencies[d][3]()
  File "/usr/share/hplip/installer/core_install.py", line 936, in check_libusb
    return len(locate_file_contains("libusb.h", '/usr/include/libusb-1.0', 'libusb_init'))
  File "/usr/share/hplip/installer/dcheck.py", line 137, in locate_file_contains
    for w in utils.walkFiles(dir, recurse=True, abs_paths=True, return_folders=False, pattern=f):
RuntimeError: generator raised StopIteration

sudo dnf repoquery --whatprovides /usr/include/libusb-1.0 showed libusbx-devel-0:1.0.22-1.fc29.i686. I installed libusbx-devel, then hp-check --runtime crashed with the following trace stating that /etc/PolicyKit wasn't found.

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 266, in walkFiles
    names = os.listdir(root)
FileNotFoundError: [Errno 2] No such file or directory: '/etc/PolicyKit'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 268, in walkFiles
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/hp-check", line 861, in <module>
    dep.core.init()
  File "/usr/share/hplip/installer/core_install.py", line 500, in init
    self.check_dependencies(callback)
  File "/usr/share/hplip/installer/core_install.py", line 593, in check_dependencies
    self.have_dependencies[d] = self.dependencies[d][3]()
  File "/usr/share/hplip/installer/core_install.py", line 1164, in check_policykit
    if check_file('PolicyKit.conf', "/etc/PolicyKit") and check_file('org.gnome.PolicyKit.AuthorizationManager.service', "/usr/share/dbus-1/services"):
  File "/usr/share/hplip/installer/dcheck.py", line 108, in check_file
    for w in utils.walkFiles(dir, recurse=True, abs_paths=True, return_folders=False, pattern=f):
RuntimeError: generator raised StopIteration

sudo dnf repoquery --whatprovides /etc/PolicyKit* didn't show any packages.
Running sudo dnf repoquery -l polkit* | less showed /etc/polkit-1 so /etc/PolicyKit might've been renamed to that.

Version-Release number of selected component (if applicable):
hplip-gui-3.18.6-9.fc29.i686
cups-devel-1:2.2.8-5.fc29.i686
libusbx-devel-0:1.0.22-1.fc29.i686
polkit-0:0.115-2.fc29.i686

How reproducible:
The hp-check crashes occurred each time I tried them.

Steps to Reproduce:
1. hp-check --runtime
2. sudo dnf install cups-devel
3. hp-check --runtime
4. sudo dnf install libusbx-devel
5. hp-check --runtime

Actual results:
hp-check --runtime crashed due to /usr/include/cups, /usr/include/libusb-1.0, and /etc/PolicyKit not being found.

Expected results:
hp-check completes normally with no crashes

Additional info:
hplip 3.18.10 is available according to
https://developers.hp.com/hp-linux-imaging-and-printing/release_notes
I don't see hp-check mentioned in the release notes between 3.18.10 and 3.18.6 though.

Comment 1 Zdenek Dohnal 2018-11-06 16:45:41 UTC
Hi Matt,

thank you for reporting the issue! 
I'm able to reproduce the issue on F29 - IMO it is caused by newer python3 version - hplip is the same version as on F28 where it doesn't suffer from tracebacks.
Other thing is why hp-check should even check these files as runtime dependencies - most of them are devel packages, not needed to for running hp tools.
I'll look into it.

Comment 2 Zdenek Dohnal 2018-11-12 09:25:29 UTC
*** Bug 1648445 has been marked as a duplicate of this bug. ***

Comment 3 Zdenek Dohnal 2018-11-12 15:13:39 UTC
The issue is connected to intentional python3.7 change https://www.python.org/dev/peps/pep-0479/

Comment 4 Zdenek Dohnal 2018-11-12 15:32:18 UTC
Reported upstream as https://bugs.launchpad.net/hplip/+bug/1802941 . The patch is attached.

Comment 5 Matt Fagnani 2018-11-12 16:02:27 UTC
Zdenek, I changed "/usr/share/hplip/base/utils.py", line 268 from raise StopIteration to return as suggested at https://www.python.org/dev/peps/pep-0479/ about 10 minutes before I saw your comment about your upstream report and patch. hp-check --runtime no longer crashed and completed normally, although it still seemed to check for the compile-time dependencies as follows.
...
--------------
| COMPILEDEP |
--------------

 libtool              libtool - Library building support services                  REQUIRED        -               2.4.6           OK         -
 gcc                  gcc - GNU Project C and C++ Compiler                         REQUIRED        -               8.2.1           OK         -
 make                 make - GNU make utility to maintain groups of programs       REQUIRED        3.0             4.2.1           OK         -

...

Thanks for finding the reason for the crashes and your patch.

Comment 6 Zdenek Dohnal 2018-11-12 16:10:37 UTC
Well, even if you want to check for runtime dependencies, the script checks for header files for 'general' dependencies, which are not needed for runtime... most of these dependency checks are more less useless (hplip upstream probably added these deps checks for the case when you manually compile the hplip project).
I'll probably remove these deps check in the future, but I'll leave it as it is for now.

Comment 7 Fedora Update System 2018-11-12 16:18:49 UTC
hplip-3.18.6-10.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-0b5b472f0b

Comment 8 Matt Fagnani 2018-11-12 20:15:43 UTC
hp-check might be ignoring the --runtime option or running the compile-time checks anyway due to some logic error. I upgraded to 3.18.6-10. When I ran hp-check --runtime I saw the following warnings 
warning: 5-29 version is not supported. Using 5-27 versions dependencies to verify and install...
warning: HPLIP-Installation: Auto installation is not supported for 5 distro  29 version

hp-check --runtime gave a 'CUPS may not be installed or not running' error even though I have cups-*1:2.2.8-6.fc29.i686 installed, cupsd was running when hp-check was run, and I could print properly.
error: cups          CUPS - Common Unix Printing System                           REQUIRED        1.1             -               INCOMPAT   'CUPS may not be installed or not running'

ps aux | grep cups
root       842  0.0  0.7  25436  9188 ?        Ss   14:04   0:00 /usr/sbin/cupsd -l

The 'CUPS may not be installed or not running' error message is in /usr/share/hplip/check.py at line 150. Why might that error be occurring?

hp-check --runtime showed warning: Failed to read /etc/cups/ppd/OfficeJet-6100-Series.ppd ppd file which might be related to the scanning problems I was originally having. I ran ls -l /etc/cups/ppd/OfficeJet-6100-Series.ppd
-rw-r-----. 1 root lp 24650 Nov 12 12:54 /etc/cups/ppd/OfficeJet-6100-Series.ppd

Given the root ownership and lack of read access for other users, I ran sudo hp-check --runtime which didn't show that warning but did show PPD Description: HP Officejet 6100, hpcups 3.18.6. Should other users be given read permission to files in /etc/cups/ppd/ ? I'll attach the output of hp-check --runtime for more details.

Comment 9 Matt Fagnani 2018-11-12 20:17:42 UTC
Created attachment 1504894 [details]
hp-check --runtime output showing cups errors and warnings

Comment 10 Fedora Update System 2018-11-13 04:49:33 UTC
hplip-3.18.6-10.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-0b5b472f0b

Comment 11 Fedora Update System 2018-11-13 17:37:07 UTC
hplip-3.18.6-11.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-aa9d943080

Comment 12 Fedora Update System 2018-11-14 06:02:20 UTC
hplip-3.18.6-11.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-aa9d943080

Comment 13 Fedora Update System 2018-11-17 05:15:43 UTC
hplip-3.18.6-11.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.