develooper Front page | perl.perl5.porters | Postings from July 2008

Re: Alarums and Excursions (was [perl #2783] Security of ARGV using 2-argument open)

Thread Previous
From:
Tels
Date:
July 28, 2008 10:53
Subject:
Re: Alarums and Excursions (was [perl #2783] Security of ARGV using 2-argument open)
Message ID:
200807281948.32833@bloodgate.com
On Monday 28 July 2008 09:31:11 Mark Mielke wrote:
> Ed Avis wrote:
> > Indeed.  I would much rather write while (<>).  At the moment I
> > can't, at least not unless I add a 'notes and gotchas' section to
> > my program's manual page noting that it will open the wrong file if
> > a filename has trailing spaces, overwrite some random other file if
> > a filename begins with >, and start running arbitrary external
> > commands if a filename begins or ends |.
>
> You and Aristotle have almost bought me over. I think the only part
> I'm missing to be 50% + 1 convinced personally is a survey or some
> other measure on how widely used these features are. I've already
> said I don't use them - but I'm not the type of person to see
> something cute and use it wherever I can just to say that I did. It
> is correct that modern shells provide all of the necessary functions,
> and these are usually easier to understand, therefore I expect the
> people who use it, to be the people who like to be overly clever and
> cute, and chose to use it, rather than found themselves forced to use
> it. :-)
>
> I'm still scared that Perl 5.10 will break my existing programs, and
> 5.12 more so, especially with many of the recent threads in this
> mailing list that seem to place less value that I prefer on backwards
> compatibility. *sigh*

I don't know if that helps, but reading this thread actually made me 
realize for the first time that "<>" is actually bad and doing things I 
don't it intend to do - depending on what file names are in the current 
directory.

And yes, I am guilty of whipping up small scripts that are run as part 
of cronjobs as root to do some backup tasks or other things, and they 
might use "<>" just because "it works" and thus there are now timebombs 
ticking on some of the machines. Thank god everything is internal and 
not connected to any other network.

All the best,

Tels

-- 
 Signed on Mon Jul 28 19:46:12 2008 with key 0x93B84C15.
 View my photo gallery: http://bloodgate.com/photos
 PGP key on http://bloodgate.com/tels.asc or per email.

 "If you want to travel around the world and be invited to speak at a
 lot of different places, just write a Unix operating system."

  -- Linus Torvalds

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About