Modify

Ticket #271 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

trailing spaces in date/name/address line for entry break parsing

Reported by: tim@… Owned by: thomas
Priority: minor Milestone: 0.2.6
Component: moap Version: TRUNK
Keywords: Cc:

Description

Take the following ChangeLog? entry:

2006-09-29 Philippe Kalaf <philippe.kalaf@…>

  • gst-libs/gst/rtp/gstbasertpaudiopayload.c: Removed empty * between paragraphs

moap will parse this as name="Philippe Kalaf <philippe.kalaf@…>" and address=None (there are also trailing space in that line, but I haven't checked whether they're important or not).

Attachments

moap-strip-header-line-1.diff Download (485 bytes) - added by tim@… 6 years ago.
patch (since trac seems to have screwed up the paste in the previous comment)

Change History

comment:1 Changed 6 years ago by tim@…

Indeed, the trailing spaces throw off the ChangeEntry? parser due to:

_addressRegex = re.compile('([<]*)<(.*)>$')

($ = end of line), so if there are spaces after the '>' there's no match.

Quick fix:

Index: moap/command/cl.py =================================================================== --- moap/command/cl.py (revision 321) +++ moap/command/cl.py (working copy) @@ -81,7 +81,7 @@

@type lines: list of str """ # first line is the "name" line

  • m = _nameRegex.search(lines[0])

+ m = _nameRegex.search(lines[0].strip())

self.date = m.expand("
1") self.name = m.expand("
2") m = _addressRegex.search(self.name)

Only works for spaces, not tabs, but so far I haven't encountered trailing tabs yet.

Changed 6 years ago by tim@…

patch (since trac seems to have screwed up the paste in the previous comment)

comment:2 Changed 5 years ago by thomas

  • Summary changed from minor changelog entry parsing issue to trailing spaces in date/name/address line for entry break parsing

comment:3 Changed 5 years ago by thomas

  • Status changed from new to closed
  • Resolution set to fixed

(In [346]) modified patch by: Tim Philipp-M?\195?\188ller <t.i.m at zen.co.uk>

  • moap/test/Makefile.am:
  • moap/test/ChangeLog/ChangeLog.gst-plugins-base.271:
  • moap/test/test_commands_cl.py: Add a test for trailing whitespace in the date/name/address line.
  • moap/command/cl.py: Fix parsing when there's trailing whitespace. Fixes #271.
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.