Skip to content

prevents other packages from accessing libraries they require when run by root user #6

@stuart-little

Description

@stuart-little

I have a VPS where I run as root. The script I'm testing is as follows:

#!/usr/bin/env perl                                  
use warnings;                                        
use v5.12;                                                                                                

use App::Daemon qw( daemonize );
$App::Daemon::pidfile  = qq|$0.pid|;                 
use POSIX qw(strftime);                              
use Time::Interval;                                                                                       

daemonize();
my $now = strftime("%F %T %Z", localtime);           
my $diff = getInterval(                                  
    $now,
    $now,
    'small'                                              
);

This dies immediately, because Time::Interval is prevented from finding Date::Parse:

# <script> -X
Cannot remove /root/bin/pl.pl.pid at /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/App/Daemon.pm line 212. 
                                                   
Can't locate Date/Parse.pm:   /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/x86_64-linux/Date/Parse.pm: Permission denied at /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/Time/Interval.pm line 38.

The file /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/x86_64-linux/Date/Parse.pm is definitely there..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions