4

I installed and configured git, gitolite and gitweb on a personal sever it works fine at the begining and I had my web view on my repositories. but when I tried to install BugZilla (with all perl dependencies) I had a an error message on the racine of my gitweb URL:

XML Parsing Error: XML or text declaration not at start of entity Location: http://xxx.xxx.xx.xx/gitweb/ Line Number 22, Column 1:

The generated web page (firebug):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<!-- git web interface version 1.7.10.4, (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>, Christian Gierke -->
<!-- git core binaries version 1.7.10.4 -->
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
<meta name="generator" content="gitweb/1.7.10.4 git/1.7.10.4"/>
<meta name="robots" content="index, nofollow"/>
<title>xxx.xxx.xx.xx Git</title>
<link rel="stylesheet" type="text/css" href="static/gitweb.css"/>
<link rel="alternate" title="xxx.xxx.xx.xx Git projects list" href="/gitweb/?a=project_index" type="text/plain; charset=utf-8" />
<link rel="alternate" title="xxx.xxx.xx.xx Git projects feeds" href="/gitweb/?a=opml" type="text/x-opml" />
<link rel="shortcut icon" href="static/git-favicon.png" type="image/png" />
</head>
<body>
<div class="page_header">
<a href="http://git-scm.com/" title="git homepage"><img alt="git" class="logo" height="27" src="static/git-logo.png" width="72" /></a><a href="/gitweb/">projects</a> / </div>
<div class="projsearch">
Content-type: text/html

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<!-- git web interface version 1.7.10.4, (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>, Christian Gierke -->
<!-- git core binaries version 1.7.10.4 -->
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
<meta name="generator" content="gitweb/1.7.10.4 git/1.7.10.4"/>
<meta name="robots" content="index, nofollow"/>
<title>xxx.xxx.xx.xx Git</title>
<link rel="stylesheet" type="text/css" href="static/gitweb.css"/>
<link rel="shortcut icon" href="static/git-favicon.png" type="image/png" />
</head>
<body>
<div class="page_header">
<a href="http://git-scm.com/" title="git homepage"><img alt="git" class="logo" height="27" src="static/git-logo.png" width="72" /></a><a href="/gitweb/">projects</a> / </div>
<div class="page_body">
<br /><br />
500 - Internal Server Error
<br />
<hr />
Can't locate object method &quot;startform&quot; via package &quot;CGI&quot; at /usr/share/gitweb/index.cgi line 5267.

</div>
<div class="page_footer">
<a class="rss_logo" href="/gitweb/?a=opml">OPML</a> <a class="rss_logo" href="/gitweb/?a=project_index">TXT</a>
</div>
<script type="text/javascript" src="static/gitweb.js"></script>
<script type="text/javascript">
window.onload = function () {
    var tz_cookie = { name: 'gitweb_tz', expires: 14, path: '/' };
    onloadTZSetup('local', tz_cookie, 'datetime');
};
</script>
</body>
</html>

I think that this error is due to the perl modules installed when I tried to install BugZilla.

How to de-install all perl modules and re-install default modules?

I use Apache as web server.

Does anyone have any idea on how to solve this?

UPDATE1:

My perl version is : v5.14.2

CGI version: 4.21

  • 2
    That looks like you are missing CGI. Did you install the latest Perl, which is 5.22 right now? [CGI got removed from the Perl core with that release](http://perldoc.perl.org/perl5220delta.html#Removed-Modules-and-Pragmata), so you need to install it from [CPAN](https://metacpan.org/pod/distribution/CGI/lib/CGI.pod). – simbabque Jul 21 '15 at 08:10
  • Using CPAN: Database was generated on Mon, 20 Jul 2015 12:29:02 GMT CGI is up to date (4.21). My perl version: v5.14.2 – Mohamed Amjad LASRI Jul 21 '15 at 08:37
  • What version of gitweb is that? In the newest version there is no `gitweb/index.cgi`, there is only a `index.perl` file, and te string `startform` is not in that file. Also [line 5267 is something else entirely](http://repo.or.cz/w/git.git/blob/HEAD:/gitweb/gitweb.perl#l5267). – simbabque Jul 21 '15 at 12:06
  • Maybe relevant, though I didn't read all of it: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=767960 - is your gitweb up to date? – simbabque Jul 21 '15 at 12:10
  • I installed gitweb using apt-get install gitweb. I ll install the latest stable version. https://git-scm.com/book/en/v2/Git-on-the-Server-GitWeb – Mohamed Amjad LASRI Jul 21 '15 at 12:57

4 Answers4

2

Had the same error message for gitweb with apache on Ubuntu after upgrading to 16.04. As stated by Slion, changing the two instances of "startform" to "start_form" in gitweb.cgi worked and I could use gitweb as before.

djoerch
  • 36
  • 4
1

In my case, the commands below worked like a charm on Arch Linux.

$ sudo pacman -Rs perl-cgi #uninstalls
$ sudo pacman -S perl #updates to the latest version
$ sudo pacman -S perl-cgi #installs

(You may think this is the same as sudo pacman -S perl-cgi but, in my case, perl-cgi was already latest. Though perhaps just upgrading perl will do, the commands above are what I did anyway.)

I found this solution because I encountered the error on my server (with perl 5.30.2) after succeeding a simple test on my main desktop computer (with perl 5.30.3).

ynn
  • 3,386
  • 2
  • 19
  • 42
  • This solved my problem (_within three hours?_), although I believe this is why they recommend you always do a system upgrade when installing packages. (Full disclosure: _I didn't_) – lowq Jul 15 '20 at 21:23
0

On Windows with either ActivePerl or Strawberry 5.22 I was getting that same error. Installing CGI module and replacing both "startform" instances in gitweb.cgi with "start_form" fixed the problem.

However I still could not get gitweb to list my projects for some reason. Git version is 1.9.5.

Slion
  • 2,558
  • 2
  • 23
  • 27
0

This error () might not be present with Git 2.36 (Q2 2022, seven years later), which removes the unneeded <meta http-equiv=content-type...> from gitweb output.

See commit a262585, commit 943fd02 (08 Mar 2022) by Jason Yundt (Jayman2000).
(Merged by Junio C Hamano -- gitster -- in commit bc3838b, 21 Mar 2022)

gitweb: remove invalid http-equiv="content-type"

Signed-off-by: Jason Yundt

Before this change, gitweb would generate pages which included:

<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>

When a meta's http-equiv equals "content-type", the http-equiv is said to be in the "Encoding declaration state".
According to the HTML Standard:

The Encoding declaration state may be used in HTML documents, but elements with an http-equiv attribute in that state must not be used in XML documents.

(Source)

This change removes that meta element since gitweb always generates XML documents.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250