[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Slurp weirdness



On Tue, 25 Apr 2000, Paolo Campanella wrote:

> 
> The following came from the Perl FAQ a Day list (18 Apr 2000). I am
> uncertain if they meant that the "unpredictable behaviour" only happens
> if a glob is actually done, or which operating systems are affected
> (would be nice if they said :-) ), but it may be related. I'm using
> 5.005_03 on Linux 2.2.5-15 i686.

I believe the leak is OS dependent, not perl version.

> -----------------------------------------------------------------------
> Question:                                                                                                                                                   
> Is there a leak/bug in
> glob()?                                                                                                                              
>                                                                                                                                                             
>     Due to the current implementation on some operating systems,
> when                                                                                       
>     you use the glob() function or its angle-bracket alias in a
> scalar                                                                                      
>     context, you may cause a leak and/or unpredictable behavior.
> It's                                                                                       
>     best therefore to use glob() only in list context.
> -----------------------------------------------------------------------
> 
> 
> 
> Chip Turner wrote:
> [snip]
> > I don't think it is a bug in the /proc filesystem.  Just like many
> > non-file descriptors that can be read with the read() system call, you
> > aren't guaranteed that you will get the whole file in one read.
> > Somewhat similar to a socket in that respect, I suppose.  It's
> > probably better to think of /proc as more like reading from sockets,
> > serial ports, or other non-file descriptors than reading from any old
> > normal file.
> > 
> > Whether it's a bug in perl or not is arguable.  For safety I would
> > slurp into an array context just to be sure.
> > 
> > Chip
> 
> ==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
> ==== Send email to <fwp-request@technofile.org> with message _body_
> ====   unsubscribe
> 

Andy Bach, Sys. Mangler     	    CC:Mail andy bach at ~7ca-chicago
Internet: andy@wiwb.uscourts.gov    VOICE: (608) 264-5178 ex 5738, FAX 264-5105

"If at first you don't succeed, try, try again.  Then quit.  There's
 no use being a damn fool about it."  --W.C. Fields


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe