Package: dh-python
Version: 2.20170125
Severity: normal

The parsing of ‘pydist’ configuration files currently fails if there
is leading or trailing whitespace, such as a U+000C FORM FEED, on the
line.

This is because the parser strips only line-end characters from the
input line. That causes any remaining leading or trailing space to
count as “not an empty line”::

    >>> line = ' \f\n'
    >>> line = line.strip('\r\n')
    >>> if line.startswith('#') or not line:
    ...     print('line is empty')
    ...
    >>> if not PYDIST_RE.match(line):
    ...     print('invalid line')
    ...
    invalid line

Instead, the line should be stripped of *any* leading or trailing
whitespace, before checking whether the line is empty::

    >>> line = ' \f\n'
    >>> line = line.strip()
    >>> if line.startswith('#') or not line:
    ...     print('line is empty')
    ...
    line is empty

This will need to change in, at least:

* dhpython.pydist.validate
* dhpython.pydist.load

-- 
 \        “No matter how cynical you become, it's never enough to keep |
  `\                                up.” —Jane Wagner, via Lily Tomlin |
_o__)                                                                  |
Ben Finney <bign...@debian.org>

Attachment: signature.asc
Description: PGP signature

Reply via email to