summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2020-04-27 10:17:56 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2020-04-29 14:46:06 +0200
commit34c3f9d61ef86a46e3b774130fe3877f4ec0ea32 (patch)
treeb71caac8943906af4fe2b8f402d408612460d292
parent9bdd99afee76630ee6de7bdf61f63bd0b487a2eb (diff)
downloadurpmi-34c3f9d61ef86a46e3b774130fe3877f4ec0ea32.tar
urpmi-34c3f9d61ef86a46e3b774130fe3877f4ec0ea32.tar.gz
urpmi-34c3f9d61ef86a46e3b774130fe3877f4ec0ea32.tar.bz2
urpmi-34c3f9d61ef86a46e3b774130fe3877f4ec0ea32.tar.xz
urpmi-34c3f9d61ef86a46e3b774130fe3877f4ec0ea32.zip
fix failing when serving over HTTP from within /root
rationale: If we switch from root to nobody/nogroup while running in /root, everytime simple-httpd accesses to a files while answering to urpmi will fail with "-1 EACCES (Permission denied)" Then t/tmp/error.log contains "Error - 404 - file not found" but that's hidden when running tests as part of CPAN testers.
-rw-r--r--NEWS1
-rwxr-xr-xt/simple-httpd8
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index c9748f54..66be375d 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
o display RPM version in cpan-testers logs
o do not fail test when libnss.so is not found in Debian 9 or FreeBSD
o fix failing to build some rpms on FreeBSD
+ o fix failing tests when serving over HTTP from within /root
o fix test with rpm < 4.13 on CentOS7
o make sure genhdlist2 works
o perform some file conflict tests only on Mageia
diff --git a/t/simple-httpd b/t/simple-httpd
index 1f758699..fcc9a301 100755
--- a/t/simple-httpd
+++ b/t/simple-httpd
@@ -6,6 +6,7 @@
use base qw(Net::Server::Single);
use strict;
+use Cwd 'getcwd';
@ARGV == 3 or die "usage: simple-httpd <document root> <log dir> <port>\n";
my ($DOCUMENT_ROOT, $SERVER_ROOT, $PORT) = @ARGV;
@@ -23,8 +24,11 @@ sub configure_hook {
my $root = $self->{server_root} = $SERVER_ROOT;
$self->{server}->{port} = "*:$PORT"; # port and addr to bind
- $self->{server}->{user} = 'nobody'; # user to run as
- $self->{server}->{group} = 'nogroup' if -e '/etc/mageia-release'; # group to run as
+ # running as nobody will make all tests to fail when running as root and in /root (access denied -> 404)
+ if (getcwd() !~ m!^/root/!) {
+ $self->{server}->{user} = 'nobody'; # user to run as
+ $self->{server}->{group} = 'nogroup' if -e '/etc/mageia-release'; # group to run as
+ }
$self->{server}->{log_file} = "$root/server.log";