From: Nick Ing-Simmons Date: Sun, 15 Sep 2002 10:55:51 +0000 (+0000) Subject: Integrate mainline X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7c07f45e8da164583bdc891840f65bb5d002d0e0;hp=478d3074309ff514cb3d637215f7368927a0a9d6;p=p5sagit%2Fp5-mst-13.2.git Integrate mainline p4raw-id: //depot/perlio@17905 --- diff --git a/Porting/apply b/Porting/apply index c313ee6..d3bdb0b 100644 --- a/Porting/apply +++ b/Porting/apply @@ -2,7 +2,7 @@ my $file = pop(@ARGV); my %meta; $ENV{'P4PORT'} = 'bactrian:1667'; -$ENV{'P4CLIENT'} = 'camel-linux'; +$ENV{'P4CLIENT'} = 'ni-s'; open(FILE,$file) || die "Cannot open $file:$!"; while () { @@ -69,3 +69,4 @@ sub System _exit(exec $cmd); } } + diff --git a/ext/PerlIO/t/via.t b/ext/PerlIO/t/via.t index d40e85e..124efbd 100644 --- a/ext/PerlIO/t/via.t +++ b/ext/PerlIO/t/via.t @@ -14,7 +14,7 @@ BEGIN { my $tmp = "via$$"; -use Test::More tests => 16; +use Test::More tests => 18; my $fh; my $a = join("", map { chr } 0..255) x 10; @@ -58,7 +58,14 @@ is($a, $b, 'compare original data with filtered version'); close($fh); +{ +package Incomplete::Module; +} + $warnings = ''; + no warnings 'layer'; + ok( ! open($fh,">via(Incomplete::Module)", $tmp), 'open via Incomplete::Module will fail'); + is( $warnings, "", "don't warn about unknown package" ); $warnings = ''; no warnings 'layer'; diff --git a/ext/PerlIO/via/via.xs b/ext/PerlIO/via/via.xs index 2bcd355..d454678 100644 --- a/ext/PerlIO/via/via.xs +++ b/ext/PerlIO/via/via.xs @@ -161,6 +161,9 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, else if (SvIV(result) != 0) return SvIV(result); } + else { + goto push_failed; + } if (PerlIOVia_fetchmethod(aTHX_ s, MYMethod(FILL)) == (CV *) - 1) PerlIOBase(f)->flags &= ~PERLIO_F_FASTGETS; @@ -172,6 +175,7 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, Perl_warner(aTHX_ packWARN(WARN_LAYER), "Cannot find package '%.*s'", (int) pkglen, pkg); +push_failed: #ifdef ENOSYS errno = ENOSYS; #else diff --git a/perlio.c b/perlio.c index 11f600f..ea36d80 100644 --- a/perlio.c +++ b/perlio.c @@ -3839,13 +3839,16 @@ PerlIOCrlf_get_cnt(pTHX_ PerlIO *f) b->ptr++; /* say we have read it as far as * flush() is concerned */ b->buf++; /* Leave space in front of buffer */ + /* Note as we have moved buf up flush's + posn += ptr-buf + will naturally make posn point at CR + */ b->bufsiz--; /* Buffer is thus smaller */ code = PerlIO_fill(f); /* Fetch some more */ b->bufsiz++; /* Restore size for next time */ b->buf--; /* Point at space */ b->ptr = nl = b->buf; /* Which is what we hand * off */ - b->posn--; /* Buffer starts here */ *nl = 0xd; /* Fill in the CR */ if (code == 0) goto test; /* fill() call worked */ diff --git a/t/io/crlf.t b/t/io/crlf.t index 08ab4fe..484596b 100644 --- a/t/io/crlf.t +++ b/t/io/crlf.t @@ -15,7 +15,7 @@ END { } if (find PerlIO::Layer 'perlio') { - plan(tests => 7); + plan(tests => 8); ok(open(FOO,">:crlf",$file)); ok(print FOO 'a'.((('a' x 14).qq{\n}) x 2000) || close(FOO)); ok(open(FOO,"<:crlf",$file)); @@ -30,6 +30,18 @@ if (find PerlIO::Layer 'perlio') { { local $/; $text = } is(count_chars($text, "\015\012"), 2000); + { + my $fcontents = join "", map {"$_\r\n"} "a".."zzz"; + open my $fh, "<:crlf", \$fcontents; + local $/ = "xxx"; + local $_ = <$fh>; + my $pos = tell $fh; # pos must be behind "xxx", before "\nyyy\n" + seek $fh, $pos, 0; + $/ = "\n"; + $s = <$fh>.<$fh>; + ok($s eq "\nxxy\n"); + } + ok(close(FOO)); } else { diff --git a/t/op/utf8decode.t b/t/op/utf8decode.t old mode 100644 new mode 100755