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

Re: Gitweb giving me some warnings in Apache's error_log

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 7, 2009, 14:14 UTC
Message-ID
<m3my6bpv6v.fsf@localhost.localdomain>
In-Reply-To
<533D6DDF-4DAC-4A86-A6F7-95B54B77E48B@gmail.com>
Mark A Rada <markrada26@gmail.com> writes:
Show 11 quoted lines
> It doesn't seem to cause any other problems, but I don't know if it is
> significant or not.
> 
> [Fri Aug  7 08:51:13 2009] gitweb.cgi: Variable "$project_maxdepth"
> may be unavailable at /var/www/private/gitweb/cgi-bin/gitweb.cgi line
> 2296.
> [Fri Aug  7 08:51:13 2009] gitweb.cgi: Variable "$projectroot" may be
> unavailable at /var/www/private/gitweb/cgi-bin/gitweb.cgi line 2304.
> 
> 
> Apache 2.2.12/ mod_perl 2.04/ perl 5.8.8
>From perldiag(1) manpage:
  Variable "%s" may be unavailable
    (W closure) An inner (nested) anonymous subroutine is inside a
    named subroutine, and outside that is another subroutine; and the
    anonymous (innermost) subroutine is referencing a lexical variable
    defined in the outermost subroutine.  For example:
      sub outermost { my $a; sub middle { sub { $a } } }
    If the anonymous subroutine is called or referenced (directly or
    indirectly) from the outermost subroutine, it will share the
    variable as you would expect.  But if the anonymous subroutine is
    called or referenced when the outermost subroutine is not active,
    it will see the value of the shared variable as it was before and
    during the *first* call to the outermost subroutine, which is
    probably not what you want.
    In these circumstances, it is usually best to make the middle
    subroutine anonymous, using the "sub {}" syntax.  Perl has
    specific support for shared variables in nested anonymous
    subroutines; a named subroutine in between interferes with this
    feature.

The warning is about 'wanted' anonymous subroutine passed to File::Find::find. The "middle" subroutine is git_get_projects_list, and the "outermost" is mod_perl / ModPerl::Registry request loop.

We can't make git_get_projects_list anonymous, but anonymous subroutine is not called or referenced outside git_get_projects_list, nor it is called or referenced outside mod_perl request/event loop.

This warning is harmless... but I do not know how to silence it.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Mark A RadaNext: Mark Rada
Message 2 of 4 in “Gitweb giving me some warnings in Apache's error_log”
  1. Mark A RadaAug 7, 2009
  2. Jakub NarebskiAug 7, 2009
  3. Mark RadaAug 7, 2009
  4. Jakub NarebskiAug 10, 2009

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.