git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: rajesh boyapati <boyapatisrajesh@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: Silence stderr in parse_commit*() subroutines
Date: Wed, 15 Feb 2012 11:04:54 +0100	[thread overview]
Message-ID: <201202151104.55348.jnareb@gmail.com> (raw)
In-Reply-To: <CA+EqV8w5jCHa2NY+NLaht901Qk=kQvALG3EA6BkePiGow3YFeQ@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:


>>> 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.
> 
> 
> Sorry for the typo error. I changed that and I am now seeing this error in
> Gerrit's error_log
> <<<<<<<<<<<<<
> [2012-02-13 13:45:35,201] ERROR
> com.google.gerrit.httpd.gitweb.GitWebServlet : CGI: fatal: Not a valid
> object name HEAD
> >>>>>>>>>>>>>

WTF, redirecting stderr (file descriptor number 2) to /dev/null should have
silenced git-rev-list in case of errors.

Compare

  $ git rev-list foo --
  fatal: bad revision 'foo'

with

  $ git rev-list foo -- 2>/dev/null

which gives no output.

I wonder what shell does gitweb use if run from com.google.gerrit.httpd
as servlet...

[...]
>> 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.
>>
> Yes, I agree with you.
>
> If the HEAD's in a git project are pointed to master branch, those are fine
> with Gerrits gitweb. Everything is working fine. (See the images in attached
> file "Master.zip")
> 
> For the HEAD's in the git projects that are pointed to a branch other than
> master (I mean if master branch is empty), I have the problem when I click
> on tabs (log, shortlog, commit, commitdiff, tree) after clicking "summary"
> tab.  (See the images in attched file "Unborn-branch.zip").

That is because those views defaults to HEAD, which doesn't point to
a valid commit because 'master' branch it does point to doesn't have any
commits on it.  They should probably be disabled (grayed-out, and made
ordinary text and not hyperlink) if HEAD is invalid.

But this would require more work than those patches.
>
> If I click other tabs before clicking "summary" tab, they are working fine.

That is because if you select some branch, then all those views use
currently selected branch (passed via URL, e.g. 'h' or 'hb' parameter
in case of query-params URL).

-- 
Jakub Narebski
Poland

  parent reply	other threads:[~2012-02-15 10:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5fa08a8b-f0a2-4796-bf0d-06a8f13bf703@b23g2000yqn.googlegroups.com>
2012-01-27 18:15 ` Fwd: Git-web error rajesh boyapati
2012-01-27 21:39   ` Fwd: Gitweb error Jakub Narebski
     [not found]     ` <CA+EqV8w5qz+iwg_PPB4M5Q-LS48B=yncR9UdR-r58BLtAEPPrA@mail.gmail.com>
2012-01-29  0:37       ` Jakub Narebski
     [not found]         ` <CA+EqV8xB6vcDrqM3EY7uRfu0c7sOj6FbMXci+5w2qgi5RSWrbw@mail.gmail.com>
2012-01-30 19:08           ` Jakub Narebski
     [not found]             ` <CA+EqV8y3dhR8+PJbMxMNEsGjDOx6dxtPYjn8kDvAZxCAO7iS5w@mail.gmail.com>
2012-02-03 21:33               ` [PATCH] gitweb: Deal with HEAD pointing to unborn branch in "heads" view Jakub Narebski
     [not found]                 ` <CA+EqV8w6k2VrEtMydhGKZHbQdXHxCE3WA_0rtS-AY4cmQvii=A@mail.gmail.com>
2012-02-07 16:53                   ` Jakub Narebski
2012-02-08 15:04                     ` [PATCH] gitweb: Harden parse_commit and parse_commits Jakub Narebski
     [not found]                       ` <CA+EqV8xiLYo8XE--c1QfuXdhentUFpHqfPYXHt72eCpEA_hCNQ@mail.gmail.com>
2012-02-09 20:14                         ` Jakub Narebski
2012-02-11 13:02                           ` [PATCH] gitweb: Silence stderr in parse_commit*() subroutines Jakub Narebski
     [not found]                             ` <CA+EqV8xTsavQFWsoijrt+0UcfxSZO2voL=CawrRPvDeB=qHQfg@mail.gmail.com>
2012-02-13 18:15                               ` Jakub Narebski
     [not found]                                 ` <CA+EqV8xin_ubOoGouhHz2qnzoHrpMMQsjUTXnrtmsxRTLPZtZQ@mail.gmail.com>
2012-02-13 19:04                                   ` Jakub Narebski
     [not found]                                     ` <CA+EqV8w5jCHa2NY+NLaht901Qk=kQvALG3EA6BkePiGow3YFeQ@mail.gmail.com>
2012-02-15 10:04                                       ` Jakub Narebski [this message]
2012-02-13 18:44                             ` Junio C Hamano
2012-02-13 19:12                               ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201202151104.55348.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=boyapatisrajesh@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).