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

Re: [PATCH] gitweb: Silence stderr in parse_commit*() subroutines

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 13, 2012, 19:04 UTC
Message-ID
<201202132004.41991.jnareb@gmail.com>
In-Reply-To
<CA+EqV8xin_ubOoGouhHz2qnzoHrpMMQsjUTXnrtmsxRTLPZtZQ@mail.gmail.com>
On Mon, 13 Feb 2012, rajesh boyapati wrote:
> 2012/2/13 Jakub Narebski <jnareb@gmail.com>
>> On Mon, 13 Feb 2012, rajesh boyapati wrote:
Show 39 quoted lines
>>> I am getting this error with this patch
>>>>>>>>>>>>>>>>>>>>>
>>> [2012-02-13 11:20:19,268] ERROR
>>> com.google.gerrit.httpd.gitweb.GitWebServlet : CGI: usage: git rev-list
>>> [OPTION] <commit-id>... [ -- paths... ]
>>> [2012-02-13 11:20:19,268] ERROR
>>> com.google.gerrit.httpd.gitweb.GitWebServlet : CGI:   limiting output:
>>> [2012-02-13 11:20:19,268] ERROR
>>> com.google.gerrit.httpd.gitweb.GitWebServlet : CGI:     --max-count=nr
>> [...]
>>> [2012-02-13 11:20:27,913] ERROR
>>> com.google.gerrit.httpd.gitweb.GitWebServlet : CGI: fatal: bad flag '--2'
>>> used after filename
>>> [2012-02-13 11:20:32,579] ERROR
>>> com.google.gerrit.httpd.gitweb.GitWebServlet : CGI: fatal: bad flag '--2'
>>> used after filename
>>> <<<<<<<<<<<<<<<<<<<
>>
>> Strange, I cannot reproduce this with non-Gerrit gitweb.  It looks
>> like it somehow lost in between "... -- 2>/dev/null" at the end of
>> git-rev-list command, and fails at "--2" which is bad flag.
>>
> This is the patch I applied
>>>>>>>>>>>>>
> sub parse_commit {
>     my ($commit_id) = @_;
>     my %co;
> 
>         return unless defined $commit_id;
> 
>     local $/ = "\0";
> 
>     *open my $fd, "-|", quote_command(
>              git_cmd(), "rev-list",*
>         "--parents",
>         "--header",
>         "--max-count=1",
>         $commit_id,
>        * "--") . '2>/dev/null',*
                   ^^^^^^^^^^^^^

It should be ' 2>/dev/null', with space before redirection, and not '2>/dev/null'. This space is here necessary.

Show 9 quoted lines
> With this Patch, Gerrit's gitweb is not showing anything.
> I mean, I can access gitweb from gerrit, but if I click on Tabs(like log,
> commit, etc...which worked with previous patches), I cannot see any thing.
> 
> Even with previous patches also there is no improvement in Gerrit's gitweb,
> only some of the errors are gone in error_log.
> The improvement I am talking about is "If I click other tabs(log, shortlog,
> commit, tree,etc) after clicking "summary", Gerrit's gitweb is not showing
> anything".

Many views in gitweb do default to HEAD. If HEAD does not point to a valid commit, they would fail, in better or worse way.

Except for the first one those patches are more of band-aid and workaround than fixing underlying issue that gitweb assumes that HEAD is valid in non-empty repository. But fixing this will require more work.

-- 
Jakub Narebski
Poland
Previous: Jakub NarebskiNext: Jakub Narebski
Message 13 of 14 in “Fwd: Git-web error”
  1. rajesh boyapatiJan 27, 2012
  2. Jakub NarebskiJan 27, 2012
  3. Jakub NarebskiJan 29, 2012
  4. Jakub NarebskiJan 30, 2012
  5. gitweb: Deal with HEAD pointing to unborn branch in "heads" viewJakub Narebski, Feb 3, 2012
  6. Jakub NarebskiFeb 7, 2012
  7. gitweb: Harden parse_commit and parse_commitsJakub Narebski, Feb 8, 2012
  8. Jakub NarebskiFeb 9, 2012
  9. gitweb: Silence stderr in parse_commit*() subroutinesJakub Narebski, Feb 11, 2012
  10. Junio C HamanoFeb 13, 2012
  11. Jakub NarebskiFeb 13, 2012
  12. Jakub NarebskiFeb 13, 2012
  13. Jakub NarebskiFeb 13, 2012
  14. Jakub NarebskiFeb 15, 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.