From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC] gitweb: Fix actionless dispatch for non-existent objects
Date: Mon, 9 Jan 2012 23:05:09 +0100 [thread overview]
Message-ID: <201201092305.10517.jnareb@gmail.com> (raw)
In-Reply-To: <7v8vlgef7o.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
> > When gitweb URL does not provide action explicitly, e.g.
> >
> > http://git.example.org/repo.git/branch
> >
> > dispatch() tries to guess action (view to be used) based on remaining
> > parameters. Among others it is based on the type of requested object,
> > which gave problems when asking for non-existent branch or file (for
> > example misspelt name)
, because git_get_type() returns undef when
requested object does not exist, and $action was left undefined.
This resulted in Perl generating the "Use of unitialized value" warnings,
which made it in error.log. Additionally gitweb returned "400 Bad Request"
error instead of more informative "404 Not Found".
>
> Ok. "gave problems" is a bit unclear to see why explicitly calling
> die_error() is an improvement, though. What is the nature of the
> "problems"? Giving a server error 500 because later codepaths tried to
> call an undefined subroutine?
>
> > Now undefined $action from dispatch() should not result in problems.
>
> Again, unspecified "problems" here. I'd like this sentence to end with
> "should not result in X but gives an explicit '404 not found' error".
This is about second chunk of change to gitweb/gitweb.perl, which is
responsible about silencing this warning:
gitweb.perl: Use of uninitialized value in pattern match (m//) at ../gitweb.perl line 2397.
It was present even with the '$action or die_error(404,...)' short-circut,
as this was in the part responsible for generating page header, which is
the same for normal page and for error page.
Perhaps better solution would be to set action to 'object' if requested
object is not found (a valid action in itself). Hmmm...
--
Jakub Narebski
Poland
prev parent reply other threads:[~2012-01-09 22:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-07 10:47 [PATCH/RFC] gitweb: Fix actionless dispatch for non-existent objects Jakub Narebski
2012-01-09 21:30 ` Junio C Hamano
2012-01-09 22:05 ` Jakub Narebski [this message]
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=201201092305.10517.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).