This is because the GECOS field contains a string starting with a '+'
(for example a phone number) and the string that is replaced in the
regex to anonymize user name is not escaped.

The code below is an excerpt of apport.report.anonymize(self) that reproduces 
the issue:
==========
import re
p='My User-Name,12.123,+123456789,+123456789,'
replacements=[]
for s in p.split(','):
    s = s.strip()
    if len(s) > 2:
        print(s)
        replacements.append((re.compile('\\b%s\\b' % s), 'User Name'))
==========

The GECOS field should be escaped as it contains general information and
forbidden characters in regexp.

** Changed in: apport (Ubuntu)
   Importance: Medium => High

** Changed in: apport (Ubuntu)
       Status: Confirmed => Triaged

** Summary changed:

- apport-cli crashed with error in _compile(): nothing to repeat
+ apport-cli crashed with error in _compile(): nothing to repeat - Escape GECOS 
field in apport.report.anonymize()

** Description changed:

  I'm getting this bug, actually in just one system and one user, I don't
  get it for instance in the "guest" account. I don't get it either if i
  run the apport comment with "sudo".
  
  In the terminal I get:
  
  .Traceback (most recent call last):
-   File "/usr/bin/apport-cli", line 365, in <module>
-     if not app.run_argv():
-   File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 543, in run_argv
-     return self.run_report_bug()
-   File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 348, in 
run_report_bug
-     self.collect_info(symptom_script)
-   File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 912, in 
collect_info
-     anonymize_thread.exc_raise()
-   File "/usr/lib/python2.7/dist-packages/apport/REThread.py", line 34, in run
-     self._retval = self.__target(*self.__args, **self.__kwargs)
-   File "/usr/lib/python2.7/dist-packages/apport/report.py", line 1297, in 
anonymize
-     replacements.append((re.compile('\\b%s\\b' % s), 'User Name'))
-   File "/usr/lib/python2.7/re.py", line 190, in compile
-     return _compile(pattern, flags)
-   File "/usr/lib/python2.7/re.py", line 242, in _compile
-     raise error, v # invalid expression
+   File "/usr/bin/apport-cli", line 365, in <module>
+     if not app.run_argv():
+   File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 543, in run_argv
+     return self.run_report_bug()
+   File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 348, in 
run_report_bug
+     self.collect_info(symptom_script)
+   File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 912, in 
collect_info
+     anonymize_thread.exc_raise()
+   File "/usr/lib/python2.7/dist-packages/apport/REThread.py", line 34, in run
+     self._retval = self.__target(*self.__args, **self.__kwargs)
+   File "/usr/lib/python2.7/dist-packages/apport/report.py", line 1297, in 
anonymize
+     replacements.append((re.compile('\\b%s\\b' % s), 'User Name'))
+   File "/usr/lib/python2.7/re.py", line 190, in compile
+     return _compile(pattern, flags)
+   File "/usr/lib/python2.7/re.py", line 242, in _compile
+     raise error, v # invalid expression
  sre_constants.error: nothing to repeat
+ 
+ TEST CASE:
+ 1. Create a new user and set a phone number starting with a '+' in the Gecos 
field
+ 2. File a new bug report with apport
+ 
+ RESULT
+ The Crash above. 
  
  ProblemType: Crash
  DistroRelease: Ubuntu 12.04
  Package: apport 2.0.1-0ubuntu4
  ProcVersionSignature: Ubuntu 3.2.0-23.36-generic 3.2.14
  Uname: Linux 3.2.0-23-generic x86_64
  NonfreeKernelModules: nvidia
  ApportLog:
-  
+ 
  ApportVersion: 2.0.1-0ubuntu4
  Architecture: amd64
  CrashCounter: 1
  Date: Wed Apr 18 18:12:40 2012
  ExecutablePath: /usr/bin/apport-cli
  InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007)
  InterpreterPath: /usr/bin/python2.7
  PackageArchitecture: all
  ProcCmdline: /usr/bin/python /usr/bin/apport-cli -f -p cheese --save 
cheese.txt
  ProcCwd: /home/wgarcia
  PythonArgs: ['/usr/bin/apport-cli', '-f', '-p', 'cheese', '--save', 
'cheese.txt']
  SourcePackage: apport
  Title: apport-cli crashed with error in _compile(): nothing to repeat
  UpgradeStatus: Upgraded to precise on 2012-03-05 (44 days ago)
  UserGroups: adm admin audio cdrom dialout lp lpadmin plugdev sambashare video

** Tags added: rls-r-incoming

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/985049

Title:
  apport-cli crashed with error in _compile(): nothing to repeat -
  Escape GECOS field in apport.report.anonymize()

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/985049/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to