Re: [viewvc-users] ViewVC "Query revision history" does not seem to support glob pattern matching

"C. Michael Pilato" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.user
Organization CollabNet, Inc.
Message-ID <4DED2E1A.6070402__951.813211622898$1307389479$gmane$org@collab.net>
On 06/05/2011 06:12 PM, Asd Asdasd wrote:
> Hi,
> 
> I have tried using the "Query revision history" form of viewvc.cgi and I get
> the following error when I initiate a search specifying a glob pattern for
> any of the "File", "Who" and "Comment" fields:
> 
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/viewvc/viewvc.py", line 4452, in main
>     request.run_viewvc()
>   File "/usr/lib/python2.7/site-packages/viewvc/viewvc.py", line 394, in run_viewvc
>     self.view_func(self)
>   File "/usr/lib/python2.7/site-packages/viewvc/viewvc.py", line 4157, in view_query
>     db.RunQuery(query)
>   File "/usr/lib/python2.7/site-packages/viewvc/cvsdb.py", line 463, in RunQuery
>     cursor.execute(sql)
>   File "/usr/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
>     self.errorhandler(self, exc, value)
>   File "/usr/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
>     raise errorclass, errorvalue
> OperationalError: (1139, "Got error 'repetition-operator operand invalid' from regexp")
> 
> I have tried using the standard "*" pattern matching specifier and even "%" as per SQL query sytax to no avail, for example, *.java for the "File" field with the "Glob pattern match" radio button selected.
> 
> Am I doing something wrong or is this a bug?

I'm seeing this, too.

Digging in a bit, I see that ViewVC uses the fnmatch.translate() function to
translate a glob (such as "*.java") into a regular expression (so it can
then use MySQL's REGEXP matching).  It appears that something has changed in
Python itself to make this not quite work the same as it did.  Observe the
following from my own system:

$ python2.4 -c 'import fnmatch ; print fnmatch.translate("*.java")'
.*\.java$
$ python2.5 -c 'import fnmatch ; print fnmatch.translate("*.java")'
.*\.java$
$ python2.6 -c 'import fnmatch ; print fnmatch.translate("*.java")'
.*\.java\Z(?ms)
$

Whoa!  Python 2.6 starts using some Python-specific regular expression
syntax.  And MySQL falls over as a result.

I've filed issue #486 (http://viewvc.tigris.org/issues/show_bug.cgi?id=486)
to track this.  Thanks for the report!

-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2759121

To unsubscribe from this discussion, e-mail: [[email protected]].
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk3tLhoACgkQokEGqRcG/W4eBACgqti0QeYO9vtz8MMIQz9xNBhV
bCUAoKcpQSOo1C2XxjsVv2gt1OEp2LL4
=q3Wx
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.