git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH (BUGFIX)] gitweb: Handle invalid regexp in regexp search

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Mar 2, 2012, 19:44 UTC
Message-ID
<4F512327.3050504@ramsay1.demon.co.uk>
In-Reply-To
<20120228183919.26435.86795.stgit@localhost.localdomain>
Jakub Narebski wrote:
Show 20 quoted lines
> When using regexp search ('sr' parameter / $search_use_regexp variable
> is true), check first that regexp is valid.
> 
> Without this patch we would get an error from Perl during search (if
> searching is performed by gitweb), or highlighting matches substring
> (if applicable), if user provided invalid regexp... which means broken
> HTML, with error page (including HTTP headers) generated after gitweb
> already produced some output.
> 
> Add test that illustrates such error: for example for regexp "*\.git"
> we would get the following error:
> 
>   Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE \.git/
>   at /var/www/cgi-bin/gitweb.cgi line 3084.
> 
> Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> See "Re: gitweb: (potential) problems with new installation"
> http://thread.gmane.org/gmane.comp.version-control.git/191746

This patch solves the problem for me when using a regex search (re checkbox checked), but *not* for a non-regex search.

If you have a leading '*' or '+', in the non-regex case, then you still get the above complaint (and xml error page etc.), although the line number has changed slightly from that given above.

ATB, Ramsay Jones

Previous: Jakub NarebskiNext: Jakub Narebski
Message 4 of 18 in “gitweb: Handle invalid regexp in regexp search”
  1. gitweb: Handle invalid regexp in regexp searchJakub Narebski, Feb 28, 2012
  2. Junio C HamanoFeb 28, 2012
  3. Jakub NarebskiFeb 29, 2012
  4. Ramsay JonesMar 2, 2012
  5. gitweb: Fix fixed string (non-regexp) project searchJakub Narebski, Mar 2, 2012
  6. Junio C HamanoMar 3, 2012
  7. Jakub NarebskiMar 3, 2012
  8. gitweb: Fix fixed string (non-regexp) project searchJakub Narebski, Mar 4, 2012
  9. Junio C HamanoMar 5, 2012
  10. Jakub NarebskiMar 5, 2012
  11. Junio C HamanoMar 5, 2012
  12. Junio C HamanoMar 5, 2012
  13. Jakub NarebskiMar 6, 2012
  14. Jakub NarebskiMar 4, 2012
  15. Junio C HamanoMar 4, 2012
  16. Jakub NarebskiMar 5, 2012
  17. Ramsay JonesMar 5, 2012
  18. Jakub NarebskiMar 6, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.