Compare commits

..

2 Commits

Author SHA1 Message Date
Alex Schroeder
d94d571881 Perl 5.26 no longer adds . to @INC
test.pl calls stuff/server.pl and needs to pass a qualified
script (./wiki.pl instead of wiki.pl).
2017-11-07 15:06:05 +01:00
Alex Schroeder
d663c2b61d Perl 5.26 no longer adds . to @INC
Trying a different solution. The existing solution only worked for
relative paths in $DataDir. Now we check whether $DataDir starts with /
or ./ and only prepend a ./ if it does not.
2017-11-07 14:49:52 +01:00
4 changed files with 8 additions and 7 deletions

View File

@@ -76,8 +76,8 @@ sub LoadLanguage {
next unless $file; # file is not listed, eg. there is no file for "de-ch"
$file = "$LoadLanguageDir/$file" if defined $LoadLanguageDir;
if (IsFile($file)) {
do "./$file";
do "./$ConfigFile-$Lang{$_}" if IsFile("$ConfigFile-$Lang{$_}");
do $file;
do "$ConfigFile-$Lang{$_}" if IsFile("$ConfigFile-$Lang{$_}");
$CurrentLanguage = $Lang{$_};
last;
}

View File

@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
my $wiki = $ARGV[0] || 'wiki.pl';
my $wiki = $ARGV[0] || './wiki.pl';
my $port = $ARGV[1] || 8080;
my $dir = $ARGV[2];
$ENV{WikiDataDir} = $dir if $dir;
@@ -25,7 +25,7 @@ $ENV{WikiDataDir} = $dir if $dir;
use base qw(HTTP::Server::Simple::CGI);
$OddMuse::RunCGI = 0;
do "./$wiki"; # load just once
do $wiki; # load just once
sub handle_request {
my $self = shift;

View File

@@ -384,7 +384,7 @@ sub start_server {
} elsif ($pid == 0) {
use Config;
my $secure_perl_path = $Config{perlpath};
exec($secure_perl_path, "stuff/server.pl", "wiki.pl", $port) or die "Cannot exec: $!";
exec($secure_perl_path, "stuff/server.pl", "./wiki.pl", $port) or die "Cannot exec: $!";
}
}

View File

@@ -69,6 +69,7 @@ our $UseConfig //= 1;
our $DataDir;
$DataDir ||= decode_utf8($ENV{WikiDataDir}) if $UseConfig;
$DataDir ||= '/tmp/oddmuse'; # FIXME: /var/opt/oddmuse/wiki ?
$DataDir = "./$DataDir" unless $DataDir =~ m!^(/|\./)!;
our $ConfigFile;
$ConfigFile ||= $ENV{WikiConfigFile} if $UseConfig;
@@ -233,7 +234,7 @@ sub InitModules {
if (not $MyInc{$lib}) {
$MyInc{$lib} = 1; # Cannot use %INC in mod_perl settings
my $file = encode_utf8($lib);
do "./$file";
do $file;
$Message .= CGI::p("$lib: $@") if $@; # no $q exists, yet
}
}
@@ -242,7 +243,7 @@ sub InitModules {
sub InitConfig {
if ($UseConfig and $ConfigFile and not $INC{$ConfigFile} and IsFile($ConfigFile)) {
do "./$ConfigFile"; # these options must be set in a wrapper script or via the environment
do $ConfigFile; # these options must be set in a wrapper script or via the environment
$Message .= CGI::p("$ConfigFile: $@") if $@; # remember, no $q exists, yet
}
if ($ConfigPage) { # $FS and $MaxPost must be set in config file!