For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > December 2006 > pod2usage fails running setuid on Solaris









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author pod2usage fails running setuid on Solaris
Dan

2006-12-22, 7:03 pm

We have (too many :-) setuid perl scripts running in our Solaris 8
environment. In attempting to add documentation to them with
pod2usage, we get CONSISTENT failures.

Because the "real" file handle is set to /dev/fd/3 when the script is
running setuid, pod2usage can't find the pod doc :-(

Short of hard-coding the path in every script with something like:

$0 = "/usr/local/bin/my_script";

is there any way to get the "real" value of $0 so that pod2usage can
run correctly in this environment?

Example:
============================ Cut here ================
#!/usr/bin/env perl -w
use Getopt::Std;
use Pod::Usage;
use Env;

delete $ENV{qw(CDPATH IFS BASH_ENV ENV)};
$ENV{'PATH'} = "/usr/bin:/usr/sbin:/usr/local/bin";

getopts('hm', \%opt);
pod2usage(1) if $opt{h};
pod2usage( -verbose => 2 ) if $opt{m};

pod2usage("$0: No files given.") if ((@ARGV == 0) && (-t STDIN));
__END__

=head1 NAME

sample - Using GetOpt::Long and Pod::Usage

=head1 SYNOPSIS
============================ Cut here ================
.........

which produces:

No documentation found for "/dev/fd/3".

when run with the -m switch.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com