dpkg reports invalid character in version number on package 'compiz'

Bug #1701756 reported by Steven Flintham on 2017-07-01
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
Undecided
Unassigned

Bug Description

When performing package related operations I get a warning about an invalid character in version number. For example:

$ dpkg -l compiz
dpkg-query: warning: parsing file '/var/lib/dpkg/status' near line 8322 package 'compiz':
 error in 'Version' field string '1:0.9.12.2+6.04.20160823-0ubuntu1': invalid character in version number
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================-==============-==============-============================================
ii compiz 1:0.9.12.2+ all OpenGL window and compositing manager

$ sudo aptitude upgrade
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
dpkg-query: warning: parsing file '/var/lib/dpkg/status' near line 8322 package 'compiz':
 error in 'Version' field string '1:0.9.12.2+6.04.20160823-0ubuntu1': invalid character in version number
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 8322 package 'compiz':
 error in 'Version' field string '1:0.9.12.2+6.04.20160823-0ubuntu1': invalid character in version number

I am running 16.04:
$ lsb_release -rd
Description: Ubuntu 16.04.2 LTS
Release: 16.04

Please let me know if you need any more information.

tags: added: xenial
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in compiz (Ubuntu):
status: New → Confirmed

it would be nice if at least the problematic characters will see reporting.
other than that - where is the naming convention that this rule set arises from?

tracked it down to this lines in the file dpkg-1.18.4ubuntu1/lib/dpkg/parsehelp.c at the end of function parseversion() at line #186:

  /* XXX: Would be faster to use something like cisversion and cisrevision. */
  ptr = rversion->version;
  if (*ptr && !c_isdigit(*ptr++))
    return dpkg_put_warn(err, _("version number does not start with digit"));
  for (; *ptr; ptr++) {
    if (!c_isdigit(*ptr) && !c_isalpha(*ptr) && strchr(".-+~:", *ptr) == NULL)
      return dpkg_put_warn(err, _("invalid character in version number"));
  }
  for (ptr = rversion->revision; *ptr; ptr++) {
    if (!c_isdigit(*ptr) && !c_isalpha(*ptr) && strchr(".+~", *ptr) == NULL)
      return dpkg_put_warn(err, _("invalid character in revision number"));
  }

quick rationale:
no underscores/colon(revision only)/special-chars/others allowed at present for neither version number nor the revision number.

valid design as of now for version item:
* start with a digit.
* continue with digit, alpha or ".-+~:" chars.
* terminate with a zero char.

valid design as of now for revision item:
* start/continue with digit, alpha or ".+~" chars.
* terminate with a zero char.

a sequence of "x86_64" would not work for any these strings => underscore!
a sequence of "3.4.5@home" would not work for any these strings => at-sign!

a sequence of "3:1.45" would not work for the revision string => colon!
a sequence of "3-4-5" would not work for the revision string => any dash! (the warn message would be raised for the first occurrence)

your sequence of "1:0.9.12.2+6.04.20160823-0ubuntu1" does not work => special char included! rectangular box here in the view. it might be some extended OEM char or a UTF-8 char or an unicode char or whatever. either it sneaked in originally, or it was added later on - even a backspace, CTRL+C or line break might be the root cause. You should be able to trace it down on your own.

affects: compiz (Ubuntu) → dpkg (Ubuntu)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers