[30584] in Perl-Users-Digest
Perl-Users Digest, Issue: 1827 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 30 03:09:47 2008
Date: Sat, 30 Aug 2008 00:09:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 30 Aug 2008 Volume: 11 Number: 1827
Today's topics:
ANNOUNCE: Spreadsheet::Read 0.26 <h.merijn@xs4all.nl>
Re: Help: Variables problem <tzz@lifelogs.com>
Re: Help: Variables problem <openlinuxsource@gmail.com>
Re: Internal limit on variable length? <hjp-usenet2@hjp.at>
matching file name without digits (was: newbie also) <tzz@lifelogs.com>
Re: matching file name without digits <rvtol+news@isolution.nl>
Re: matching file name without digits <tzz@lifelogs.com>
new CPAN modules on Sat Aug 30 2008 (Randal Schwartz)
Re: perl multithreading performance <hjp-usenet2@hjp.at>
Re: subprocesses lifecycle <hjp-usenet2@hjp.at>
Re: subprocesses lifecycle <hjp-usenet2@hjp.at>
Re: subprocesses lifecycle <hjp-usenet2@hjp.at>
Re: subprocesses lifecycle <ced@blv-sam-01.ca.boeing.com>
Re: subprocesses lifecycle <whynot@pozharski.name>
trouble writing a setuid script <petermichaux@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Aug 2008 16:33:09 GMT
From: "H.Merijn" <h.merijn@xs4all.nl>
Subject: ANNOUNCE: Spreadsheet::Read 0.26
Message-Id: <K6EE5t.1Dtt@zorch.sf-bay.org>
It has been too long since I released an update.
file: $CPAN/authors/id/H/HM/HMBRAND/Spreadsheet-Read-0.26.tgz
size: 67847 bytes
md5: 694297b000c8d1285caad59441cf7a81
Note that in order to be able to read the format of a Spreadsheet::ParseExcel
field, the format has to be specified. I found out that if the specified
format of a date field in Excel is equal to the cuurent user's locale setting
for short date format, is is ignored and set to internal format number 14.
The default format for code 14 is 'm-d-yy', which is close to useless,
certainly if the author of the sheet has specified something reasonable like
'yyyy-mm-dd'.
Spreadsheet::Read now overrides the default formats that use a two 'yy' part,
and made the default for code 14 'yyyy-mm-dd', but offers an attribute to
change that.
Revision history for Spreadsheet::Read
0.26 Fri 29 Aug 2008
- Added examples/xls2csv
- Upped copyright to 2008 in examples
- Don't ask to install examples under automated testing
- die => croak
- Added tgzdist target
- Added encoding options to examples/xlscat
- Added date-type checks for SS:PE > 0.32
0.25 Wed 02 Jan 2008
- Spreadsheet-Read now under git
- Upped copyrights to 2008
- Added all prereq's to Makefile.PL, even core mods
- Tested under perl-5.10.0
- Text::CSV as of 1.00 is OK
------------------------------
Date: Fri, 29 Aug 2008 10:21:52 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Help: Variables problem
Message-Id: <86od3bkfsf.fsf@lifelogs.com>
On Fri, 29 Aug 2008 22:44:18 +0800 Amy Lee <openlinuxsource@gmail.com> wrote:
AL> I'm writing a script to parse the contents of /proc/loadavg file. And the
AL> file is like this:
AL> 0.22 0.11 0.03 1/92 2653
AL> And I hope my script output is like this:
AL> 1 minute loadavg: 0.22
AL> 5 minutes loadavg: 0.11
AL> 10 minutes loadavg: 0.03
AL> Running processes: 1 processes
AL> Total processes: 92 processes
AL> And there's my codes:
AL> open LOADAVG, "<", "/proc/loadavg"
AL> or die RED "Can't open /proc/loadavg. $!";
AL> while (<LOADAVG>)
AL> {
AL> <LOADAVG> =~ /(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)\/(\d+)\s+\d+/;
AL> print "1 minute loadavg: $1.$2\n";
AL> print "5 minutes loadavg: $3.$4\n";
AL> print "10 minutes loadavg: $5.$6\n";
AL> print "Running processes: $7 processes\n";
AL> print "Total processes: $8 processes\n";
AL> }
AL> close LOADAVG;
Use the split ' ' syntax to get individual fields (you'll need a further
split for field 4, of course). You can also consider Regexp::Common to
extract numbers.
Or install the CPAN Linux::loadavg module.
Ted
------------------------------
Date: Fri, 29 Aug 2008 23:38:14 +0800
From: Amy Lee <openlinuxsource@gmail.com>
Subject: Re: Help: Variables problem
Message-Id: <pan.2008.08.29.15.38.13.437382@gmail.com>
On Fri, 29 Aug 2008 10:21:52 -0500, Ted Zlatanov wrote:
> On Fri, 29 Aug 2008 22:44:18 +0800 Amy Lee <openlinuxsource@gmail.com> wrote:
>
> AL> I'm writing a script to parse the contents of /proc/loadavg file. And the
> AL> file is like this:
>
> AL> 0.22 0.11 0.03 1/92 2653
>
> AL> And I hope my script output is like this:
>
> AL> 1 minute loadavg: 0.22
> AL> 5 minutes loadavg: 0.11
> AL> 10 minutes loadavg: 0.03
> AL> Running processes: 1 processes
> AL> Total processes: 92 processes
>
> AL> And there's my codes:
>
> AL> open LOADAVG, "<", "/proc/loadavg"
> AL> or die RED "Can't open /proc/loadavg. $!";
> AL> while (<LOADAVG>)
> AL> {
> AL> <LOADAVG> =~ /(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)\/(\d+)\s+\d+/;
> AL> print "1 minute loadavg: $1.$2\n";
> AL> print "5 minutes loadavg: $3.$4\n";
> AL> print "10 minutes loadavg: $5.$6\n";
> AL> print "Running processes: $7 processes\n";
> AL> print "Total processes: $8 processes\n";
> AL> }
> AL> close LOADAVG;
>
> Use the split ' ' syntax to get individual fields (you'll need a further
> split for field 4, of course). You can also consider Regexp::Common to
> extract numbers.
>
> Or install the CPAN Linux::loadavg module.
>
> Ted
Thanks, it seems that your method id pretty good.
Regards,
Amy
------------------------------
Date: Fri, 29 Aug 2008 21:33:32 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Internal limit on variable length?
Message-Id: <slrngbgjoe.ql9.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-29 05:26, dn.perl@gmail.com <dn.perl@gmail.com> wrote:
> I had some print statements in my code and it was hanging with output
> like:
>
> 6 values from Store in Connecticut
> 5 values from Store in New Mexico \t Near Arizona \t S-W US\t etc
> 52 values from Sto
>
> (not printing beyond 'Sto')...
When printing debug output to a file (or a pipe) make sure your
filehandle is unbuffered. STDERR is always unbuffered. Use $| or
autoflush for other file handles.
hp
------------------------------
Date: Fri, 29 Aug 2008 10:29:27 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: matching file name without digits (was: newbie also)
Message-Id: <86k5dzkffs.fsf@lifelogs.com>
On Fri, 29 Aug 2008 14:18:06 GMT "NEAL ZIERKE" <deniserz@verizon.net> wrote:
NZ> If I have file names in directory like /mydir/abcd12e.fgh ,,, in unix system
NZ> I wish to test the "12" part of filenames. I understand and lot of examples
NZ> on net for directory stuff ( File::Find::name )
NZ> I wish to test against other file names that will look the same but the 12
NZ> would be different ( this is the version of the file ) , say it might look
NZ> like this /mydir/abcd45e.fgh, where as this is newest version.
NZ> What is the easiest way to test those 2 char's of file name in perl
Logically, you want to group a bunch of files by their base name without
digits.
use File::Basename;
my %bybase;
sub store_name
{
my $name = shift @_;
my $key = basename $name;
$key =~ s/\d+//g;
push @{$bybase{$key}}, $name;
}
After you use store_name on every file name, the %bybase hash will
contain the groupings you want. Use Data::Dumper to see how it looks.
So unlike your example, you wouldn't check when you find the file, you'd
just store_name on that file name. Then after the full search is done
you would go through %bybase.
Ted
------------------------------
Date: Fri, 29 Aug 2008 19:43:44 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: matching file name without digits
Message-Id: <g99jm0.1ec.1@news.isolution.nl>
Ted Zlatanov schreef:
> my $key = basename $name;
> $key =~ s/\d+//g;
I would probably make that
$key =~ s/[0-9]+/#/g;
or just
$key =~ s/[0-9]+/9/g;
to prevent collissions.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Fri, 29 Aug 2008 13:49:49 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: matching file name without digits
Message-Id: <86prnrhd0y.fsf@lifelogs.com>
On Fri, 29 Aug 2008 19:43:44 +0200 "Dr.Ruud" <rvtol+news@isolution.nl> wrote:
R> Ted Zlatanov schreef:
>> my $key = basename $name;
>> $key =~ s/\d+//g;
R> I would probably make that
R> $key =~ s/[0-9]+/#/g;
R> or just
R> $key =~ s/[0-9]+/9/g;
R> to prevent collissions.
Yeah, good point :)
Ted
------------------------------
Date: Sat, 30 Aug 2008 04:42:21 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Aug 30 2008
Message-Id: <K6ED2L.1Cx8@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
App-Nopaste-0.05
http://search.cpan.org/~sartak/App-Nopaste-0.05/
easy access to any pastebin
----
Bio-DOOP-DOOP-1.01
http://search.cpan.org/~tibi/Bio-DOOP-DOOP-1.01/
DOOP API main module
----
Bundle-Compress-Zlib-2.012
http://search.cpan.org/~pmqs/Bundle-Compress-Zlib-2.012/
Install Compress::Zlib and dependencies
----
Bundle-IO-Compress-Bzip2-2.012
http://search.cpan.org/~pmqs/Bundle-IO-Compress-Bzip2-2.012/
Install IO::Compress::Bzip2 and dependencies
----
CPAN-WWW-Testers-Generator-0.25
http://search.cpan.org/~barbie/CPAN-WWW-Testers-Generator-0.25/
Download and summarize CPAN Testers data
----
Catalyst-Authentication-AuthTkt-0.04
http://search.cpan.org/~karman/Catalyst-Authentication-AuthTkt-0.04/
shim for Apache::AuthTkt
----
Catalyst-Authentication-AuthTkt-0.05
http://search.cpan.org/~karman/Catalyst-Authentication-AuthTkt-0.05/
shim for Apache::AuthTkt
----
Chart-Clicker-2.05
http://search.cpan.org/~gphat/Chart-Clicker-2.05/
Powerful, extensible charting.
----
Chemistry-Elements-1.05_02
http://search.cpan.org/~bdfoy/Chemistry-Elements-1.05_02/
Perl extension for working with Chemical Elements
----
Class-MOP-0.64_07
http://search.cpan.org/~drolsky/Class-MOP-0.64_07/
A Meta Object Protocol for Perl 5
----
Class-XSAccessor-0.07
http://search.cpan.org/~smueller/Class-XSAccessor-0.07/
Generate fast XS accessors without runtime compilation
----
Class-XSAccessor-Array-0.05
http://search.cpan.org/~smueller/Class-XSAccessor-Array-0.05/
Generate fast XS accessors without runtime compilation
----
Config-Augeas-0.301
http://search.cpan.org/~ddumont/Config-Augeas-0.301/
Edit configuration files through Augeas C library
----
DBIx-Class-QueryLog-1.1.3
http://search.cpan.org/~gphat/DBIx-Class-QueryLog-1.1.3/
Log queries for later analysis.
----
Decision-Depends-0.20
http://search.cpan.org/~djerius/Decision-Depends-0.20/
Perform actions based upon file dependencies
----
HTML-Timeline-1.04
http://search.cpan.org/~rsavage/HTML-Timeline-1.04/
Convert a Gedcom file into a Timeline file
----
HTTP-MobileAgent-Plugin-RoamingZone-0.0.2
http://search.cpan.org/~kokogiko/HTTP-MobileAgent-Plugin-RoamingZone-0.0.2/
???????????/??????????????
----
Imager-Search-0.11
http://search.cpan.org/~adamk/Imager-Search-0.11/
Locate images inside other images
----
Kephra-0.3.9_16
http://search.cpan.org/~lichtkind/Kephra-0.3.9_16/
crossplatform, GUI-Texteditor along perllike Paradigms
----
Module-Release-Git-0.10_03
http://search.cpan.org/~bdfoy/Module-Release-Git-0.10_03/
Use Git with Module::Release
----
Moose-0.55_02
http://search.cpan.org/~drolsky/Moose-0.55_02/
A postmodern object system for Perl 5
----
Moose-0.55_03
http://search.cpan.org/~drolsky/Moose-0.55_03/
A postmodern object system for Perl 5
----
MooseX-DeepAccessors-0.01
http://search.cpan.org/~rataxis/MooseX-DeepAccessors-0.01/
Delegate methods to member objects, curried with more methods!
----
MooseX-DeepAccessors-0.02
http://search.cpan.org/~rataxis/MooseX-DeepAccessors-0.02/
Delegate methods to member objects, curried with more methods!
----
Mvalve-0.00013
http://search.cpan.org/~dmaki/Mvalve-0.00013/
Generic Q4M Powered Message Pipe
----
MyCPAN-Indexer-0.11_01
http://search.cpan.org/~bdfoy/MyCPAN-Indexer-0.11_01/
Index a Perl distribution
----
Net-IMAP-Client-0.1
http://search.cpan.org/~mishoo/Net-IMAP-Client-0.1/
Not so simple IMAP client library
----
Net-Twitter-Search-0.06
http://search.cpan.org/~shiny/Net-Twitter-Search-0.06/
Twitter Search
----
POEIKC-0.02_07
http://search.cpan.org/~suzuki/POEIKC-0.02_07/
A framework to make a daemon or P2P with "PoCo::IKC"
----
SNMP-Class-0.15
http://search.cpan.org/~aduitsis/SNMP-Class-0.15/
A convenience class around the NetSNMP perl modules.
----
Shipwright-1.14
http://search.cpan.org/~sunnavy/Shipwright-1.14/
Best Practical Builder
----
Spreadsheet-Read-0.26
http://search.cpan.org/~hmbrand/Spreadsheet-Read-0.26/
Meta-Wrapper for reading spreadsheet data
----
TM-View-0.3
http://search.cpan.org/~alphazulu/TM-View-0.3/
Topic Maps, Views and Listlets
----
TheSchwartz-Simple-0.02
http://search.cpan.org/~miyagawa/TheSchwartz-Simple-0.02/
Lightweight TheSchwartz job dispatcher using plain DBI
----
Unicode-Japanese-0.46
http://search.cpan.org/~hio/Unicode-Japanese-0.46/
Convert encoding of japanese text 1
----
WWW-CDBaby-0.06
http://search.cpan.org/~grantg/WWW-CDBaby-0.06/
Automate interaction with cdbaby.com!
----
WWW-CDBaby-0.07
http://search.cpan.org/~grantg/WWW-CDBaby-0.07/
Automate interaction with cdbaby.com!
----
WWW-CDBaby-0.08
http://search.cpan.org/~grantg/WWW-CDBaby-0.08/
Automate interaction with cdbaby.com!
----
WebService-NFSN-0.06
http://search.cpan.org/~cjm/WebService-NFSN-0.06/
Client for the NearlyFreeSpeech.NET API
----
macro-0.01
http://search.cpan.org/~gfuji/macro-0.01/
An implementation of macro processor
----
resched-0.7.2
http://search.cpan.org/~jonadab/resched-0.7.2/
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Fri, 29 Aug 2008 21:28:40 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: perl multithreading performance
Message-Id: <slrngbgjfb.ql9.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-28 17:49, Leon Timmermans <fawaka@gmail.com> wrote:
> On Wed, 27 Aug 2008 14:25:32 -0700, dniq00 wrote:
>> Thanks for the link - trying to figure out whattahellisgoingon there :)
>> Looks like he's basically mmaps the input and begins reading it starting
>> at different points. Thing is, I'm using <> as input, which can contain
>> hundreds of gigabytes of data, so I'm not sure how's that going to work
>> out...
>
> Is your computer 64 or 32 bits? In the former case mmap will work for
> such large files, but the latter it won't.
Assuming <> is actually referring to a single file (if it doesn't, you
can just process several files in parallel), the same approach can be
used even without mmap:
Fork $num_cpu worker processes. Let each process seek to position
$i * $length / $num_cpu, and search for the start of the next line. Then
start processing lines until you get to position ($i+1) * $length / $num_cpu.
Finally report result to parent process and let it aggregate the
results.
hp
------------------------------
Date: Fri, 29 Aug 2008 21:39:09 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: subprocesses lifecycle
Message-Id: <slrngbgk2t.ql9.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-27 21:04, Eric Pozharski <whynot@pozharski.name> wrote:
> Matthieu Imbert <breafk@remove.this.gmail.com> wrote:
>> Is there a way to force the end of all subprocesses when calling die?
>
> Second. No one can kill process which hangs in syscall till the process
> gets out into userspace. So you'd be better finding why you collect.
This is not generally true. Only when the syscall is in an
uninterruptible sleep (also known as "disk wait", although a disk is not
necessarily involved), no signals (not even SIGKILL) are accepted.
hp
------------------------------
Date: Fri, 29 Aug 2008 21:47:04 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: subprocesses lifecycle
Message-Id: <slrngbgkho.ql9.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-28 21:06, Eric Pozharski <whynot@pozharski.name> wrote:
> Matthieu Imbert <breafk@remove.this.gmail.com> wrote:
>> Eric Pozharski wrote:
> *SKIP*
>> In your example code, the child process stays alive after the end of
>> parent process. As there are probably 30 to 40 lines in /etc/passwd
>> and it sleeps 1 second for each line, it's not surprising that it
>> takes about half a minute to end and die.
>
> Positive. My fault. I've moved B<sleep> in child before B<while> and
> the child exits immediately (with regard to B<sleep> of course). What I
> don't understand is why the child succesfully writes in pipe. The pipe
> isn't closed if a reader exits? I don't grok pipes obviously.
When the reader exits (or more exactly, then the last reader closes the
pipe) and attempt to write into the pipe will yield a SIGPIPE. Since
your script doesn't catch SIGPIPE, this will cause your child process to
terminate. But since you didn't call $pipe->autoflush the child won't
actually try to write to the pipe until the buffer (4kB on Linux, 8kB on
most other unixes) is full - that will be after about 75 or 150 lines,
respectively.
hp
------------------------------
Date: Fri, 29 Aug 2008 21:53:57 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: subprocesses lifecycle
Message-Id: <slrngbgkul.ql9.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-29 12:19, C.DeRykus <ced@blv-sam-01.ca.boeing.com> wrote:
> On Aug 28, 10:43 am, Hans Mulder <han...@xs4all.nl> wrote:
>> What you'd really want, is a way to tell C<open> that you don't want
>> C<close> to wait for this child. As far as I know, there is currently
>> no simple way to achieve that.
>>
>
> Wouldn't backgrounding the task
> accomplish that:
>
> open my $fd, "/some/task & |"
> or die...
Man, that's ugly!
But yes, I think that should work (although I haven't actually tried
it).
> However, child subprocesses would then need to be foregrounded with
> SIGCONT if the parent wants to kill them before exiting.
No. SIGCONT doesn't "foreground" a process running in the background.
It continues a process which has been stopped. A running process can be
sent signals whether it is in the foreground or the background.
hp
------------------------------
Date: Fri, 29 Aug 2008 15:01:08 -0700 (PDT)
From: "C.DeRykus" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: subprocesses lifecycle
Message-Id: <6127a655-f1af-435a-8c55-16189594a5cb@b38g2000prf.googlegroups.com>
On Aug 29, 12:53 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2008-08-29 12:19, C.DeRykus <c...@blv-sam-01.ca.boeing.com> wrote:
>
> > On Aug 28, 10:43 am, Hans Mulder <han...@xs4all.nl> wrote:
> >> What you'd really want, is a way to tell C<open> that you don't want
> >> C<close> to wait for this child. As far as I know, there is currently
> >> no simple way to achieve that.
>
> > Wouldn't backgrounding the task
> > accomplish that:
>
> > open my $fd, "/some/task & |"
> > or die...
>
> Man, that's ugly!
> But yes, I think that should work (although I haven't actually tried
> it).
>
I'm not sure why a lone "&" tips the ugly balance :)
> > However, child subprocesses would then need to be foregrounded with
> > SIGCONT if the parent wants to kill them before exiting.
>
> No. SIGCONT doesn't "foreground" a process running in the background.
> It continues a process which has been stopped. A running process can be
> sent signals whether it is in the foreground or the background.
>
Yes, I mis-spoke but a SIGCONT actually is sent to the process
group when a backgrounded job is
moved to the foreground via "fg"
to enable a terminal read for example. At least that's I glean from
Stevens. Tricky stuff though...
I was also wrong about needing
to foreground the bg jobs so
they could be killed. They can
be killed easily if you know the
pid's. But, there doesn't appear an elegant way to pick them up
without some grubbing around.
--
Charles DeRykus
------------------------------
Date: Fri, 29 Aug 2008 21:58:41 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: subprocesses lifecycle
Message-Id: <1gtlo5xas4.ln2@carpet.zombinet>
C.DeRykus <ced@blv-sam-01.ca.boeing.com> wrote:
*SKIP*
> open my $fd, "/some/task & |"
> or die...
> However, child subprocesses would then need to be foregrounded with
> SIGCONT if the parent wants to kill them before exiting.
Backgrounding doesn't work. I meant it doesn't matter.
time perl -wle '
open my $h, q{(sleep 1 ; /bin/echo -en xyz ) & |} or die $!;
print `ps --cols 60 -O ppid t`;
print <$h>;
print `ps --cols 60 -O ppid t`;'
PID PPID S TTY TIME COMMAND
2198 2193 S pts/1 00:00:02 bash
7528 2198 S pts/1 00:00:00 perl -wle ?open my $h, q{(sl
7529 7528 Z pts/1 00:00:00 [sh] <defunct>
7530 1 S pts/1 00:00:00 sh -c (sleep 1 ; /bin/echo -
7531 7530 R pts/1 00:00:00 sh -c (sleep 1 ; /bin/echo -
7532 7528 R pts/1 00:00:00 ps --cols 60 -O ppid t
xyz
PID PPID S TTY TIME COMMAND
2198 2193 S pts/1 00:00:02 bash
7528 2198 S pts/1 00:00:00 perl -wle ?open my $h, q{(sl
7529 7528 Z pts/1 00:00:00 [sh] <defunct>
7534 7528 R pts/1 00:00:00 ps --cols 60 -O ppid t
real 0m1.277s
user 0m0.084s
sys 0m0.080s
--
Torvalds' goal for Linux is very simple: World Domination
------------------------------
Date: Sat, 30 Aug 2008 00:07:29 -0700 (PDT)
From: Peter Michaux <petermichaux@gmail.com>
Subject: trouble writing a setuid script
Message-Id: <e7c678e3-f34b-48ca-9fa3-06b8dd0ae371@w24g2000prd.googlegroups.com>
Hi,
I'm trying to write a setuid script and can't make it happen. I've
trimmed it down to the very simple example below trying to have a
logger.pl script add a message to a log file. This is my Bash
transcript with all the pertinent details.
$ ls -Al
total 8
-rw-r--r-- 1 root wheel 0 29 Aug 23:52 log
-rwsr-xr-x 1 root wheel 145 29 Aug 23:52 logger.pl*
$ cat log
$ cat logger.pl
#!/usr/bin/perl -w
use strict;
use warnings;
my $FILE;
open(FILE, ">> log") or die "couldn't open: ";
print(FILE "hello, world");
close(FILE);
$ whoami
peter
$ ./logger.pl
couldn't open: at ./logger.pl line 7.
$ sudo ./logger.pl
Password:
$ cat log
hello, world
So the script works when I "sudo" but not when the script runs as my
normal "peter" user.
Any ideas why it doesn't work and what I need to change?
(I don't run into any errors when writing the same program in C.)
Thanks,
Peter
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1827
***************************************