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

Re: [perl #2783] Security of ARGV using 2-argument open - historicity

From:
Tom Christiansen
Date:
July 27, 2008 17:17
Subject:
Re: [perl #2783] Security of ARGV using 2-argument open - historicity
Message ID:
2774.1217204247@chthon
In-Reply-To: Message from Mark Mielke <mark@mark.mielke.cc> 
   of "Sat, 26 Jul 2008 16:29:40 EDT." <488B8934.3050204@mark.mielke.cc> 

> Users who don't read the document will always be surprised.  In
> standard Unix, passing a "-" in has traditionally meant STDIN.

For input; for output, it's meant stdout, the standard output.
Compare

    % tar cf - | gzip > foo.tar.gz
    % gunzip < foo.tar.gz | tar xf - 

As for piping to/fro "-", that's a Perl innovation, but it still means
"to/fro the *standard* thing" (of which [per Descartes] the only such
standard upon whose existence we can be certain is the very querent
it/him/our/themself; hence, the fork, being ourselves of the only entity
   guaranteed to exist).

> One could argue that an experienced user might be "surprised" that "-"
> was NOT interpreted as STDIN.  This argument is entirely relative to
> the person's expectations.

> In this case, the expectations should be well instilled. Perl has done
> what it has done for over a decade, 

While what you said is not false, it doesn't convey the historicity.
You could have said over a month and been equally correct.

Perl has *always* done this.  Witness:

    % perl1 -e 'while(<>) {print "$ARGV $. $_";}' /etc/motd - /etc/motd < /etc/motd
    /etc/motd 1 This particularly rapid unintelligible patter 
    /etc/motd 2 isn't generally heard and if iTIS it doesn't matter.
    - 3 This particularly rapid unintelligible patter 
    - 4 isn't generally heard and if iTIS it doesn't matter.
    /etc/motd 5 This particularly rapid unintelligible patter 
    /etc/motd 6 isn't generally heard and if iTIS it doesn't matter.

    % perl1 -v
    $Header: perly.c,v 1.0 87/12/18 15:53:31 root Exp $
    Patch level: 0

> and if somebody is truly surprised today - they should pick up the
> manual and give it another read.

Even in our post-literate uncivilization? :-(

--tom



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