SPUG: perls 'test' -d cgi vs. command line.

Matthew Bustad mybustad at gmail.com
Thu Feb 17 14:42:01 PST 2011

Here is a puzzle:

Setting up gitweb on CentOS 5.5

In the script segment:

# gitweb - simple web interface to track changes in git repositories
# (C) 2005-2006, Kay Sievers <kay.sievers at vrfy.org>
# (C) 2005, Christian Gierke
# This program is licensed under the GPLv2

open(O, ">>/tmp/fo");

use 5.008;
use strict;
use warnings;
use CGI qw(:standard :escapeHTML -nosticky);
use CGI::Util qw(unescape);
use CGI::Carp qw(fatalsToBrowser set_message);
use Encode;
use Fcntl ':mode';
use File::Find qw();
use File::Basename qw(basename);
use Time::HiRes qw(gettimeofday tv_interval);
binmode STDOUT, ':utf8';

my $projects_list = "/pub/git";
     printf(O "--\n%s-\n", $projects_list ); # debug printfs to
isolate the error
        if (-d $projects_list) {
     printf(O "--\n%s-\n", $projects_list ); # debug printfs to
isolate the error
---8<--- End ---8<------8<------8<------8<------8<------8<------8<------8<---

The -d test of if /pub/git is a directory (it is) fails via cgi, but
(as user apache)
works via command line?

Any ideas?

-- Matthew

More information about the spug-list mailing list