Front page | perl.perl5.porters |
Postings from October 2014
Re: New feature proposal : <<>> to disable magic open of ARGV
Thread Previous
|
Thread Next
From:
Rafael Garcia-Suarez
Date:
October 3, 2014 12:07
Subject:
Re: New feature proposal : <<>> to disable magic open of ARGV
Message ID:
CAMoYMM_CgjQMimvLHJVgvzCjtSZ=AS0hcbbeUVNqY=2nu5-BEw@mail.gmail.com
Ah, of course. I now have made the tests a bit more tolerant
with df968918245d10232f955ab0965da7f8d6297a29.
On 3 October 2014 13:59, H.Merijn Brand <h.m.brand@xs4all.nl> wrote:
> On Fri, 3 Oct 2014 13:44:32 +0200, Rafael Garcia-Suarez
> <rgs@consttype.org> wrote:
>
>> Hi, I see the failures on the reports now:
>>
>> ../t/io/argv.t .............................................. FAILED 29-32
>>
>> Could you run the test by hand and send the output?
>
> $ ./perl -I../lib harness -v io/argv.t
> io/argv.t ..
> 1..36
> ok 1 - <> from two files
> ok 2 - <> from a file and STDIN
> ok 3 - <> from just STDIN
> ok 4 - $ARGV is the file name
> ok 5 - $ARGV is - for explicit STDIN
> ok 6 - $ARGV is - for implicit STDIN
> ok 7 - eof() doesn't segfault
> ok 8 - $. counts <>
> ok 9 - <> from @ARGV
> ok 10
> ok 11
> ok 12
> ok 13 - eof() true on unopened filehandle
> ok 14 - STDIN has something
> ok 15
> ok 16 - eof() true with empty @ARGV
> ok 17
> ok 18
> ok 19 - eof() true after closing ARGV
> ok 20
> ok 21
> ok 22
> ok 23
> ok 24
> ok 25
> ok 26 - <<>>
> ok 27 - <<>> and rcatline
> ok 28 - <<>> from just STDIN (no argument)
> ok 29 - $ARGV is - for STDIN with <<>>
> not ok 30 - <<>> does not treat - as STDIN
> # Failed test 30 - <<>> does not treat - as STDIN at io/argv.t line 191
> # got "Can\'t open -: A file or directory in the path name does not exist. at -e line 1.\n"
> # expected "Can\'t open -: No such file or directory at -e line 1.\n"
> not ok 31 - <<>> does not treat - as STDIN
> # Failed test 31 - <<>> does not treat - as STDIN at io/argv.t line 199
> # got "Can\'t open : A file or directory in the path name does not exist. at -e line 1.\n"
> # expected "Can\'t open : No such file or directory at -e line 1.\n"
> not ok 32 - <<>> does not treat - as STDIN
> # Failed test 32 - <<>> does not treat - as STDIN at io/argv.t line 205
> # got "Can\'t open : A file or directory in the path name does not exist. at -e line 1.\n"
> # expected "Can\'t open : No such file or directory at -e line 1.\n"
> not ok 33 - <<>> does not treat ...| as fork
> # Failed test 33 - <<>> does not treat ...| as fork at io/argv.t line 216
> # got "Can\'t open echo foo |: A file or directory in the path name does not exist. at -e line 1.\n"
> # expected "Can\'t open echo foo |: No such file or directory at -e line 1.\n"
> # Failed test 34 - <<>> does not treat ...| as fork after eof at io/argv.t line 223
> # got "Can\'t open echo foo |: A file or directory in the path name does not exist. at -e line 1, <> line 3.\n"
> # expected "Can\'t open echo foo |: No such file or directory at -e line 1, <> line 3.\n"
> not ok 34 - <<>> does not treat ...| as fork after eof
> ok 35 - ARGV aliasing and eof()
> ok 36 - deleting $::{ARGV}
> Failed 5/36 subtests
>
> Test Summary Report
> -------------------
> io/argv.t (Wstat: 0 Tests: 36 Failed: 5)
> Failed tests: 30-34
> Files=1, Tests=36, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.21 cusr 0.14 csys = 0.38 CPU)
> Result: FAIL
>
> AIX 5.3.0.0/TL12-05 IBM,9115-505 PowerPC_POWER5/1898(2) 3920 Mb
>
> $ ./perl -I../lib -V
> Summary of my perl5 (revision 5 version 21 subversion 5) configuration:
> Snapshot of: f63a114b48be4e9c44534b6e07ecdeea8be2ef71
> Platform:
> osname=aix, osvers=5.3.0.0, archname=aix-thread-multi-64all
> uname='aix i3 3 5 0004898ad300 '
> config_args='-des -Dcc=gcc -Dusedevel -Duseithreads -Duse64bitall'
> hint=recommended, useposix=true, d_sigaction=define
> useithreads=define, usemultiplicity=define
> use64bitint=define, use64bitall=define, uselongdouble=undef
> usemymalloc=n, bincompat5005=undef
> Compiler:
> cc='gcc -maix64', ccflags ='-D_THREAD_SAFE -maix64 -DPERL_DONT_CREATE_GVSV -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -fno-strict-aliasing -pipe -I/pro/local/include -maix64 -DUSE_64_BIT_ALL -D_FORTIFY_SOURCE=2',
> optimize='-O',
> cppflags='-D_THREAD_SAFE -maix64 -DPERL_DONT_CREATE_GVSV -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -fno-strict-aliasing -pipe -I/pro/local/include'
> ccversion='', gccversion='4.2.4', gccosandvers=''
> intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=87654321
> d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8, longdblkind=-1
> ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
> alignbytes=8, prototype=define
> Linker and Libraries:
> ld='gcc -maix64', ldflags =' -L/usr/local/ppc64/lib64 -Wl,-b64 -L/pro/local/lib -Wl,-brtl -Wl,-bdynamic -Wl,-b64'
> libpth=/usr/local/ppc64/lib /usr/lib /usr/local/ppc64/lib64 /lib /usr/ccs/lib /usr/local/lib /usr/lib64
> libs=-lbind -lnsl -ldbm -ldb -ldl -lld -lm -lcrypt -lpthreads -lc
> perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
> libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
> gnulibc_version=''
> Dynamic Linking:
> dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Xlinker -bE:/opt/perl64/lib/5.21.5/aix-thread-multi-64all/CORE/perl.exp'
> cccdlflags=' ', lddlflags=' -Wl,-b64 -Wl,-bhalt:4 -Wl,-G -Wl,-bI:$(PERL_INC)/perl.exp -Wl,-bE:$(BASEEXT).exp -Wl,-bnoentry -lpthreads -lc -lm -L/usr/local/ppc64/lib64 -L/pro/local/lib'
>
>
> Characteristics of this binary (from libperl):
> Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
> PERL_DONT_CREATE_GVSV
> PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
> PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
> PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
> PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT
> USE_ITHREADS USE_LARGE_FILES USE_LOCALE
> USE_LOCALE_COLLATE USE_LOCALE_CTYPE
> USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO
> USE_PERL_ATOF USE_REENTRANT_API
> Locally applied patches:
> SMOKEf63a114b48be4e9c44534b6e07ecdeea8be2ef71
> Built under aix
> Compiled at Oct 3 2014 13:36:07
> @INC:
> ../lib
> /opt/perl64/lib/site_perl/5.21.5/aix-thread-multi-64all
> /opt/perl64/lib/site_perl/5.21.5
> /opt/perl64/lib/5.21.5/aix-thread-multi-64all
> /opt/perl64/lib/5.21.5
> .
>
>> On 3 October 2014 12:27, Michael Felt <aixtools@gmail.com> wrote:
>> > this may have nothing to do with this thread, other than it is the only one
>> > search returned. I see a lot of argv.t test failures on my AIX smokers. fyi.
>> >
>> > On Sep 30, 2014 8:34 AM, "Rafael Garcia-Suarez" <rgs@consttype.org> wrote:
>> >>
>> >> On 29 July 2014 23:54, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote:
>> >> > * Rafael Garcia-Suarez <rgs@consttype.org> [2014-07-24T11:51:40]
>> >> >> I believe that this was discussed here some years ago, and that this
>> >> >> was suggested by TomC. Anyway, I pushed a patch on rgs/nomagicopen.
>> >> >> The patch is incomplete as it lacks docs and tests. I welcome feedback
>> >> >> on the intent of the feature.
>> >> >
>> >> > I'm still not crazy about the one-off syntax addition, but I think that
>> >> > it's
>> >> > the best we're going to see without setting an unrealistic bar for a
>> >> > new,
>> >> > generic feature. If we ever *do* get <> adverbs, we can call this sugar
>> >> > for
>> >> > one or blah blah blah it doesn't matter that much right now. :-)
>> >> >
>> >> > While my heart wants -n to be safe, my conscience tells me that we'll
>> >> > break
>> >> > enough (bizarre, to my mind (except maybe regarding "-")) expectations
>> >> > that it
>> >> > isn't worth doing. Probably we want -P and -N for safe opening.
>> >> >
>> >> > I am gratified to see that <<X>> fails for any X, as you've only made
>> >> > the
>> >> > literal construct <<>> iterate. Awesome. I think we're going to want a
>> >> > better
>> >> > error message, if possible, though, than:
>> >> >
>> >> > ~/code/perl5$ ./perl -e 'while (<<ARGV>>) { print }' 'ls |'
>> >> > Can't find string terminator "ARGV" anywhere before EOF at -e line 1.
>> >> >
>> >> > Something roughly like "safe <<>> operator meaningless on concrete
>> >> > filehandles"
>> >> > — that's not right, but you get the idea.
>> >> >
>> >> > I don't think I have any further thoughts on it.
>> >>
>> >> I have now merged this in blead, with more tests, and docs by Peter
>> >> Martini
>> >> and myself. I also added tests for the $ARGV variable, that was not
>> >> tested.
>> >>
>> >> I'm not too sure about the error message; it's not totally trivial to
>> >> change, since
>> >> a script like this one, for example, will print "8":
>> >>
>> >> print <<FOO>> 1;
>> >> 16
>> >> FOO
>
>
> --
> H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/
> using perl5.00307 .. 5.19 porting perl5 on HP-UX, AIX, and openSUSE
> http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/
> http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Thread Previous
|
Thread Next