Bug 1349316

Summary: uncaught OSError exception causes pyobd to crash
Product: [Fedora] Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: pyserialAssignee: Paul P Komkoff Jr <i>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: i
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-28 08:44:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dominik 'Rathann' Mierzejewski 2016-06-23 08:29:16 UTC
Description of problem:
When doing serial port detection in pyobd, it crashes due to uncaught OSError exception in /usr/lib/python2.7/site-packages/serial/serialposix.py when non-existent port access is attempted.

Version-Release number of selected component (if applicable):
pyserial-2.7-2.fc23.noarch
pyobd-0.9.3-1.fc23.noarch

How reproducible:
Always.

Steps to Reproduce:
1. run pyobd
2. select OBD-II/Configure

Actual results:
Traceback (most recent call last):
  File "/usr/bin/pyobd", line 643, in Configure
    ports = self.scanSerial()
  File "/usr/bin/pyobd", line 597, in scanSerial
    s = serial.Serial(i)
  File "/usr/lib/python2.7/site-packages/serial/serialutil.py", line 282, in __init__
    self.open()
  File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 289, in open
    self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
OSError: [Errno 2] No such file or directory: '/dev/ttyS32'

and pyobd crashes.

Expected results:
No traceback.

Additional info:
This patch fixes it:
--- /usr/lib/python2.7/site-packages/serial/serialposix.py	2013-10-16 17:49:05.000000000 +0200
+++ serialposix.py	2016-06-23 10:23:14.805143856 +0200
@@ -287,7 +287,7 @@
         # open
         try:
             self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
-        except IOError, msg:
+        except (IOError, OSError), msg:
             self.fd = None
             raise SerialException(msg.errno, "could not open port %s: %s" % (self._port, msg))
         #~ fcntl.fcntl(self.fd, FCNTL.F_SETFL, 0)  # set blocking

Comment 1 Dominik 'Rathann' Mierzejewski 2016-06-28 08:44:36 UTC

*** This bug has been marked as a duplicate of bug 1231476 ***