-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 21 November 2003 23:53, Nicholas Clark wrote: > Yes, that's a feature. But what we seem to agree is a bug is the change > from this behaviour: > > $ perl5.00405 -we 'undef $/;open F, "/" and defined(scalar <F>) and print > "ok\n"; print "$!\n"' Is a directory > > to that behaviour: > > $ perl5.00503 -we 'undef $/;open F, "/" and defined(scalar <F>) and print > "ok\n"; print "$!\n"' ok > Is a directory > > which Andreas has identified as caused by this patch: > > http://public.activestate.com/cgi-bin/perlbrowse?patch=2910 > > which I vaguely remember reading about at the time. > > And if we agree that this change is a regression, then someone needs to > write a test case, and someone (else) a fix. Now here is a patch: - ------------------------------------------------------- - --- perl-5.8.2/pp_hot.c 2003-11-02 23:45:36.000000000 +0100 +++ perl-5.8.2.new/pp_hot.c 2003-11-22 12:34:42.000000000 +0100 @@ -1574,7 +1574,9 @@ for (;;) { PUTBACK; if (!sv_gets(sv, fp, offset) - - && (type == OP_GLOB || SNARF_EOF(gimme, PL_rs, io, sv))) + && (type == OP_GLOB + || SNARF_EOF(gimme, PL_rs, io, sv) + || PerlIO_error(fp))) { PerlIO_clearerr(fp); if (IoFLAGS(io) & IOf_ARGV) { - ------------------------------------------------------- 'make test' said: All tests successful. I'll provide a test case for linux and windows. I think there are more OSes that return an error on reading a directory file. But some let it go without error like Solaris. For UNIX-like systems I could check if 'cat .' succeeds and skip the test in that case. But what about the others? And how to catch that it is a UNIX-like system? $^O returns a string but not UNIX-likeness. Is there a portable solution for that? Is it better to put the new test in an existing file (e.g. t/io/read.t) or should I create a new test file? Torsten -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE/v1N+wicyCTir8T4RAr59AJ47eYTago0X7Y/9BBpj/wPsY2uUEQCglPwK m/FJiE7IaDqsCRXGBEZFEMo= =UVnw -----END PGP SIGNATURE-----Thread Previous | Thread Next