Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1020170

Summary: markdown.markdown fails with leading '<' character
Product: Red Hat Enterprise Linux 6 Reporter: Nick Coghlan <ncoghlan>
Component: python-markdownAssignee: Lumír Balhar <lbalhar>
Status: CLOSED ERRATA QA Contact: Jan Kepler <jkejda>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: bnater, cstratak, dcallagh, ebaak, jkejda, lbalhar, ncoghlan, pviktori, qwan, tools-bugs, xtian
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-markdown-2.0.1-4.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1020153 Environment:
Last Closed: 2017-03-21 11:42:46 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 Nick Coghlan 2013-10-17 07:56:29 UTC
+++ This bug was initially created as a clone of Bug #1020153 +++

Beaker (http://beaker-project.org) recently started supporting the use of markdown in system note fields. HSS QE discovered that starting a note with a "<" caused a 500 internal server error, and traced it back to this failure in the markdown renderer on RHEL6:

Python 2.6.6 (r266:84292, May 27 2013, 05:35:12) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from markdown import markdown
>>> markdown('<')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/markdown/__init__.py", line 587, in markdown
    return md.convert(text)
  File "/usr/lib/python2.6/site-packages/markdown/__init__.py", line 386, in convert
    self.lines = prep.run(self.lines)
  File "/usr/lib/python2.6/site-packages/markdown/preprocessors.py", line 128, in run
    left_tag = self._get_left_tag(block)
  File "/usr/lib/python2.6/site-packages/markdown/preprocessors.py", line 82, in _get_left_tag
    return block[1:].replace(">", " ", 1).split()[0].lower()
IndexError: list index out of range
>>> 
-bash-4.1$ rpm -qa python-markdown
python-markdown-2.0.1-3.1.el6.noarch

On Fedora, the more recent version of python-markdown handles this correctly:

Python 2.7.3 (default, Aug  9 2012, 17:23:57) 
[GCC 4.7.1 20120720 (Red Hat 4.7.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from markdown import markdown
>>> markdown("<")
u'<p>&lt;</p>'
>>> 
[ncoghlan@dhcp-41-79 beaker]$ rpm -qa python-markdown
python-markdown-2.2.1-1.fc18.noarch

The relevant issue and patch appear to be:

* https://github.com/waylan/Python-Markdown/issues/70
* https://github.com/waylan/Python-Markdown/commit/07bc7a4c8f2e834e0f8150de004c1f8fd98a3d60

Comment 8 errata-xmlrpc 2017-03-21 11:42:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0773.html