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

gitweb: local configuration not found

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 5, 2018, 18:44 UTC
Message-ID
<20181205184404.GC246451@google.com>
In-Reply-To
<154401401074.29584.11169979442731329694.reportbug@gimli.ms.mff.cuni.cz>
Martin Mares wrote[1]:
Show 7 quoted lines
> After upgrade to Stretch, gitweb no longer finds the configuration file
> "gitweb_config.perl" in the current directory. However, "man gitweb" still
> mentions this as one of the possible locations of the config file (and
> indeed a useful one when using multiple instances of gitweb).
>
> It was probably broken by Perl dropping "." from the default search path
> for security reasons.
Indeed, perldelta(1) tells me that in 5.24.1 (and 5.26, etc),
  Core modules and tools no longer search "." for optional modules
gitweb.perl contains
 sub read_config_file {
         my $filename = shift;
         return unless defined $filename;
         # die if there are errors parsing config file
         if (-e $filename) {
                 do $filename;

which implies an @INC search but it is silly --- as the "-e" test illustrates, this never intended to search @INC.

Documentation says "If you are absolutely certain that you want your script to load and execute a file from the current directory, then use a ./ prefix". We can do that, like so:

diff --git i/gitweb/Makefile w/gitweb/Makefile
index cd194d057f..3160b6cc5d 100644
--- i/gitweb/Makefile
+++ w/gitweb/Makefile
@@ -18,7 +18,7 @@ RM ?= rm -f
 INSTALL ?= install
 
 # default configuration for gitweb
-GITWEB_CONFIG = gitweb_config.perl
+GITWEB_CONFIG = ./gitweb_config.perl
 GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
 GITWEB_CONFIG_COMMON = /etc/gitweb-common.conf
 GITWEB_HOME_LINK_STR = projects

but that does not help if someone overrides GITWEB_CONFIG, and besides,
it would be nicer to avoid the possibility of an @INC search altogether.
Another alternative would be to use

	local @INC = ('.');

Would that be better?

Advice from someone more versed than I am in perl would be very welcome
(hence the cc to Ævar).

Thanks for reporting and hope that helps,
Jonathan

[1] https://bugs.debian.org/915632
Next: Ævar Arnfjörð Bjarmason
Message 1 of 4 in “gitweb: local configuration not found”
  1. Jonathan NiederDec 5, 2018
  2. Ævar Arnfjörð BjarmasonDec 5, 2018
  3. Junio C HamanoDec 6, 2018
  4. Martin MarešDec 6, 2018

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.