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

Re: [PATCH/RFC] gitweb: Fix actionless dispatch for non-existent objects

From
Jakub Narebski <jnareb@gmail.com>
Date
Jan 9, 2012, 22:05 UTC
Message-ID
<201201092305.10517.jnareb@gmail.com>
In-Reply-To
<7v8vlgef7o.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 10 quoted lines
> 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".
 
Show 10 quoted lines
> 
> 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
Previous: Junio C Hamano
Message 3 of 3 in “gitweb: Fix actionless dispatch for non-existent objects”
  1. gitweb: Fix actionless dispatch for non-existent objectsJakub Narebski, Jan 7, 2012
  2. Junio C HamanoJan 9, 2012
  3. Jakub NarebskiJan 9, 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.