Bug 1349316 - uncaught OSError exception causes pyobd to crash
Summary: uncaught OSError exception causes pyobd to crash
Keywords:
Status: CLOSED DUPLICATE of bug 1231476
Alias: None
Product: Fedora
Classification: Fedora
Component: pyserial
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Paul P Komkoff Jr
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-23 08:29 UTC by Dominik 'Rathann' Mierzejewski
Modified: 2016-06-28 08:44 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-28 08:44:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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 ***


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