summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-01-11 19:32:07 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-01-11 19:32:07 +0000
commit4bfee161f7a97900585aa2d88dc2e41ec655cbfb (patch)
tree3989c45f2a756331b8b960a417baa1afb718a9fe
parentb03c0a3af9d8dc230dbf7f55955fdc7ce65f2403 (diff)
parent075a4a2b17419f90b0888605cbb91ee4b236f645 (diff)
downloadperl-4bfee161f7a97900585aa2d88dc2e41ec655cbfb.tar.gz
Integrate mainline
p4raw-id: //depot/perlio@8406
-rw-r--r--Changes202
-rw-r--r--ext/IO/lib/IO/Socket/INET.pm11
-rw-r--r--ext/Socket/Socket.pm1
-rw-r--r--mg.c18
-rw-r--r--patchlevel.h2
-rw-r--r--perl.h1
-rw-r--r--regexec.c2
-rw-r--r--t/op/re_tests1
-rwxr-xr-xt/op/split.t23
-rwxr-xr-xt/op/substr.t127
10 files changed, 376 insertions, 12 deletions
diff --git a/Changes b/Changes
index c628e27c99..eaa6aac8ff 100644
--- a/Changes
+++ b/Changes
@@ -32,6 +32,206 @@ Version v5.7.1 Development release working toward v5.8
--------------
____________________________________________________________________________
+[ 8403] By: jhi on 2001/01/11 04:38:24
+ Log: Subject: Re: [ID 20001029.005] Regex error: "cd. (A. Tw)" !~ /\((\w\. \w+)\)/
+ From: Hugo <hv@crypt.compulink.co.uk>
+ Date: Mon, 30 Oct 2000 01:33:26 +0000
+ Message-Id: <200010300133.BAA10390@crypt.compulink.co.uk>
+ Branch: perl
+ ! regexec.c t/op/re_tests
+____________________________________________________________________________
+[ 8402] By: jhi on 2001/01/11 04:26:12
+ Log: Integrate perlio.
+ Branch: perl
+ !> scope.h util.c
+____________________________________________________________________________
+[ 8401] By: nick on 2001/01/10 22:52:55
+ Log: Allow control of 2nd arg to segsetjmp() via -DSCOPE_SAVES_SIGNAL_MASK.
+ (So Alan and Ilya can try setting via hints.)
+ Verified Linux "works" with it true and fails to re-enable SIGINT if false.
+ Restoring sigmask in Perl_sighandler() if handler dies is not equivalent;
+ doing the save everywhere seems to restart read() correctly, but just
+ doing it once "round" the handler does not.
+ Branch: perlio
+ ! scope.h
+____________________________________________________________________________
+[ 8400] By: jhi on 2001/01/10 21:57:54
+ Log: Not defining PERL_PRESERVE_IVUV fixes only the op/inc problem
+ of IRIX, HP-UX is unaffected.
+ Branch: perl
+ ! perl.h
+____________________________________________________________________________
+[ 8399] By: nick on 2001/01/10 21:29:19
+ Log: Safe fix for Simon's pclose() doing SvIVX of undef -> core bug.
+ Branch: perlio
+ ! util.c
+____________________________________________________________________________
+[ 8398] By: jhi on 2001/01/10 20:55:31
+ Log: Add ReuseAddr as a (preferred) alias for Reuse as we know
+ also have ReusePort.
+ Branch: perl
+ ! ext/IO/lib/IO/Socket/INET.pm
+____________________________________________________________________________
+[ 8397] By: jhi on 2001/01/10 20:50:57
+ Log: Subject: [PATCH] add ReusePort option to IO::Socket::INET for better multicast support (resend)
+ From: "Jeremy D. Zawodny" <jzawodn@yahoo-inc.com>
+ Date: Wed, 10 Jan 2001 01:38:13 -0800
+ Message-ID: <20010110013813.B41744@yahoo-inc.com>
+ Branch: perl
+ ! ext/IO/lib/IO/Socket/INET.pm
+____________________________________________________________________________
+[ 8396] By: jhi on 2001/01/10 20:49:30
+ Log: Subject: [PATCH] add SO_REUSEPORT to export list in Socket.pm for better multicast support (resend)
+ From: "Jeremy D. Zawodny" <jzawodn@yahoo-inc.com>
+ Date: Wed, 10 Jan 2001 01:37:32 -0800
+ Message-ID: <20010110013732.A41744@yahoo-inc.com>
+ Branch: perl
+ ! ext/Socket/Socket.pm
+____________________________________________________________________________
+[ 8395] By: jhi on 2001/01/10 20:41:37
+ Log: Test for bug id 20010105.016 (fixed by #8378).
+ Branch: perl
+ ! t/op/split.t
+____________________________________________________________________________
+[ 8394] By: jhi on 2001/01/10 20:26:32
+ Log: Integrate perlio.
+ Branch: perl
+ ! util.c
+____________________________________________________________________________
+[ 8393] By: nick on 2001/01/10 19:34:30
+ Log: Back out Simon's pid hackery for now.
+ Branch: perlio
+ ! util.c
+____________________________________________________________________________
+[ 8392] By: nick on 2001/01/10 19:23:13
+ Log: Integrate mainline. (Builds but does not work - something broke pipes...)
+ Branch: perlio
+ !> (integrate 29 files)
+____________________________________________________________________________
+[ 8391] By: jhi on 2001/01/10 18:43:15
+ Log: Subject: [PATCH] Fix my_pclose segfault
+ From: Simon Cozens <simon@cozens.net>
+ Date: Wed, 10 Jan 2001 18:39:35 +0000
+ Message-ID: <20010110183934.A25640@pembro26.pmb.ox.ac.uk>
+ Branch: perl
+ ! util.c
+____________________________________________________________________________
+[ 8390] By: jhi on 2001/01/10 18:42:08
+ Log: Subject: [PATCH perl@8269] Opcode.XS, fix memory leak
+ From: lane@DUPHY4.Physics.Drexel.Edu (Charles Lane)
+ Date: Wed, 10 Jan 2001 13:23:02 EST
+ Message-Id: <010110132245.8129a@DUPHY4.Physics.Drexel.Edu>
+ Branch: perl
+ ! ext/Opcode/Opcode.xs
+____________________________________________________________________________
+[ 8389] By: jhi on 2001/01/10 15:16:07
+ Log: Turn off the integer preservation for now.
+ Branch: perl
+ ! perl.h
+____________________________________________________________________________
+[ 8388] By: jhi on 2001/01/10 15:01:25
+ Log: Few more IDE/editor nits from p5p.
+ Branch: perl
+ ! pod/perlfaq3.pod
+____________________________________________________________________________
+[ 8387] By: jhi on 2001/01/10 06:53:16
+ Log: Subject: Re: [ID 20010109.003] Patch 8138 broke a test in libwww
+ To: "Andreas J. Koenig" <andreas.koenig@anima.de>
+ Date: Tue, 9 Jan 2001 23:16:02 +0000
+ Message-ID: <20010109231602.A81101@plum.flirble.org>
+ Branch: perl
+ ! sv.c
+____________________________________________________________________________
+[ 8386] By: jhi on 2001/01/10 03:17:54
+ Log: Test cases for #8385 (from Simon's "torture.pl")
+ Branch: perl
+ ! t/op/tr.t
+____________________________________________________________________________
+[ 8385] By: jhi on 2001/01/10 03:17:11
+ Log: Subject: Re: more UTF8 test suites and an UTF8 patch
+ From: Inaba Hiroto <inaba@sdd.tokyo-sc.toshiba.co.jp>
+ Date: Wed, 10 Jan 2001 11:39:39 +0900
+ Message-Id: <10101100239.AA10002@tux0017.sdd.tokyo-sc.toshiba.co.jp>
+
+ Some more UTF-8 tr cases fixed.
+ Branch: perl
+ ! doop.c
+____________________________________________________________________________
+[ 8384] By: jhi on 2001/01/09 22:45:40
+ Log: Allow the locale test needing POSIX and the taint test
+ needing IPC::SysV to run under 'minitest' (basically,
+ bail out if loading the extension fails)
+ Branch: perl
+ ! t/op/misc.t t/op/taint.t
+____________________________________________________________________________
+[ 8383] By: jhi on 2001/01/09 21:36:04
+ Log: Subject: [PATCH @8382] Remove FileHandle/IO dependence in t/io/openpid.t
+ From: Stephen McCamant <smcc@CSUA.Berkeley.EDU>
+ Date: Tue, 9 Jan 2001 13:33:22 -0800 (PST)
+ Message-ID: <14939.33475.474459.147429@soda.csua.berkeley.edu>
+ Branch: perl
+ ! t/io/openpid.t
+____________________________________________________________________________
+[ 8382] By: jhi on 2001/01/09 21:06:08
+ Log: save_delete(), err, SAVEDELETE() fixes from Charles Lane.
+ Should finish up the bug id 20001205.022.
+ Branch: perl
+ ! pp.c pp_hot.c scope.c
+____________________________________________________________________________
+[ 8381] By: jhi on 2001/01/09 18:27:43
+ Log: Subject: Re: [PATCH: perl@8342] comp/proto..........FAILED tests 112-123
+ From: Andy Dougherty <doughera@lafayette.edu>
+ Date: Tue, 9 Jan 2001 12:11:16 -0500 (EST)
+ Message-ID: <Pine.SOL.4.10.10101091144440.13124-100000@maxwell.phys.lafayette.edu>
+
+ More robust yacc/bison error detection.
+ Branch: perl
+ ! t/comp/proto.t
+____________________________________________________________________________
+[ 8380] By: jhi on 2001/01/09 15:21:38
+ Log: Subject: [PATCH] make t/op/misc.t work on VMS
+ From: lane@DUPHY4.Physics.Drexel.Edu (Charles Lane)
+ Date: Tue, 9 Jan 2001 07:53:55 EST
+ Message-Id: <010109075323.91c8f@DUPHY4.Physics.Drexel.Edu>
+ Branch: perl
+ ! t/op/misc.t vms/test.com
+____________________________________________________________________________
+[ 8379] By: jhi on 2001/01/09 15:20:38
+ Log: Subject: [ID 20001230.003] UTF-8 tr still hurts
+ From: jhi@cc.hut.fi
+ Date: Sat, 30 Dec 2000 22:57:32 +0200 (EET)
+ Message-Id: <200012302057.WAA31168@alpha.hut.fi>
+
+ The #8378 fixed this.
+ Branch: perl
+ ! t/op/tr.t
+____________________________________________________________________________
+[ 8378] By: jhi on 2001/01/09 15:05:32
+ Log: Subject: One more patch for UTF8
+ From: Inaba Hiroto <inaba@st.rim.or.jp>
+ Date: Tue, 09 Jan 2001 01:04:32 +0900
+ Message-ID: <3A59E510.52BAB5B9@st.rim.or.jp>
+
+ UTF-8 fixes for 'x' and tr///.
+ Branch: perl
+ ! doop.c embed.h embed.pl op.c pod/perlapi.pod pp.c proto.h
+ ! regcomp.c regexec.c toke.c utf8.c
+____________________________________________________________________________
+[ 8377] By: jhi on 2001/01/09 14:32:17
+ Log: Make explicit our assumption that (for now) "\x{80}" produces UTF-8.
+ Branch: perl
+ ! t/op/length.t
+____________________________________________________________________________
+[ 8376] By: jhi on 2001/01/09 04:32:32
+ Log: integrate changes #7775, #8316, #8316 from mainline
+ Branch: maint-5.6/perl
+ ! hints/solaris_2.sh
+____________________________________________________________________________
+[ 8375] By: jhi on 2001/01/09 04:26:43
+ Log: Update Changes.
+ Branch: perl
+ ! Changes patchlevel.h
+____________________________________________________________________________
[ 8374] By: jhi on 2001/01/09 04:14:32
Log: IDE/editor section tweaking.
Branch: perl
@@ -175,7 +375,7 @@ ____________________________________________________________________________
! lib/ExtUtils/typemap perlio.c perlio.h
____________________________________________________________________________
[ 8355] By: jhi on 2001/01/06 20:27:15
- Log: integrate change #8836 from mainline
+ Log: integrate change #8336 from mainline
Scoping of %^H still broken in both perl@8269 and perl-5.6.1-TRIAL1
Branch: maint-5.6/perl
diff --git a/ext/IO/lib/IO/Socket/INET.pm b/ext/IO/lib/IO/Socket/INET.pm
index c922bf35c9..d2cc488dd2 100644
--- a/ext/IO/lib/IO/Socket/INET.pm
+++ b/ext/IO/lib/IO/Socket/INET.pm
@@ -151,11 +151,16 @@ sub configure {
$sock->socket(AF_INET, $type, $proto) or
return _error($sock, $!, "$!");
- if ($arg->{Reuse}) {
+ if ($arg->{Reuse} || $arg->{ReuseAddr}) {
$sock->sockopt(SO_REUSEADDR,1) or
return _error($sock, $!, "$!");
}
+ if ($arg->{ReusePort}) {
+ $sock->sockopt(SO_REUSEPORT,1) or
+ return _error($sock, $!, "$!");
+ }
+
if($lport || ($laddr ne INADDR_ANY) || exists $arg->{Listen}) {
$sock->bind($lport || 0, $laddr) or
return _error($sock, $!, "$!");
@@ -302,7 +307,9 @@ C<IO::Socket::INET> provides.
Proto Protocol name (or number) "tcp" | "udp" | ...
Type Socket type SOCK_STREAM | SOCK_DGRAM | ...
Listen Queue size for listen
- Reuse Set SO_REUSEADDR before binding
+ ReuseAddr Set SO_REUSEADDR before binding
+ Reuse Set SO_REUSEADDR before binding (deprecated, prefer ReuseAddr)
+ ReusePort Set SO_REUSEPORT before binding
Timeout Timeout value for various operations
MultiHomed Try all adresses for multi-homed hosts
diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm
index b4a0419cbc..90e16e6e19 100644
--- a/ext/Socket/Socket.pm
+++ b/ext/Socket/Socket.pm
@@ -268,6 +268,7 @@ use XSLoader ();
SO_RCVLOWAT
SO_RCVTIMEO
SO_REUSEADDR
+ SO_REUSEPORT
SO_SNDBUF
SO_SNDLOWAT
SO_SNDTIMEO
diff --git a/mg.c b/mg.c
index 3a61655678..ca06b891fc 100644
--- a/mg.c
+++ b/mg.c
@@ -1417,15 +1417,25 @@ Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
{
- STRLEN len;
- char *tmps = SvPV(sv,len);
+ STRLEN littlelen;
+ char *tmps = SvPV(sv, littlelen);
+
if (DO_UTF8(sv)) {
+ I32 bigoff = LvTARGOFF(sv);
+ I32 biglen = LvTARGLEN(sv);
+ U8 *s, *a, *b;
+
sv_utf8_upgrade(LvTARG(sv));
- sv_insert(LvTARG(sv),LvTARGOFF(sv),LvTARGLEN(sv), tmps, len);
+ /* sv_utf8_upgrade() might have moved and/or resized
+ * the string to be replaced, we must rediscover it. --jhi */
+ s = (U8*)SvPVX(LvTARG(sv));
+ a = utf8_hop(s, bigoff);
+ b = utf8_hop(a, biglen);
+ sv_insert(LvTARG(sv), a - s, b - a, tmps, littlelen);
SvUTF8_on(LvTARG(sv));
}
else
- sv_insert(LvTARG(sv),LvTARGOFF(sv),LvTARGLEN(sv), tmps, len);
+ sv_insert(LvTARG(sv), LvTARGOFF(sv), LvTARGLEN(sv), tmps, littlelen);
return 0;
}
diff --git a/patchlevel.h b/patchlevel.h
index 574869a0e2..30397891a9 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -70,7 +70,7 @@
#if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
static char *local_patches[] = {
NULL
- ,"DEVEL8374"
+ ,"DEVEL8403"
,NULL
};
diff --git a/perl.h b/perl.h
index 41b1c2a211..19827a3101 100644
--- a/perl.h
+++ b/perl.h
@@ -1084,7 +1084,6 @@ typedef UVTYPE UV;
#define IV_DIG (BIT_DIGITS(IVSIZE * 8))
#define UV_DIG (BIT_DIGITS(UVSIZE * 8))
-#define NO_PERL_PRESEVE_IVUV /* Not finished yet. */
#ifndef NO_PERL_PRESERVE_IVUV
#define PERL_PRESERVE_IVUV /* We like our integers to stay integers. */
#endif
diff --git a/regexec.c b/regexec.c
index 5990ea3ca4..c7d42cda4e 100644
--- a/regexec.c
+++ b/regexec.c
@@ -597,7 +597,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
DEBUG_r(PerlIO_printf(Perl_debug_log,
", trying anchored starting at offset %ld...\n",
(long)(s1 + 1 - i_strpos)));
- other_last = last + 1;
+ other_last = last; /* Fix this later. --Hugo */
s = HOP3c(t, 1, strend);
goto restart;
}
diff --git a/t/op/re_tests b/t/op/re_tests
index 52666daea5..1090e112b9 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -781,3 +781,4 @@ tt+$ xxxtt y - -
^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))? 012cxx0190 y - -
^(b+?|a){1,2}c bbbac y $1 a
^(b+?|a){1,2}c bbbbac y $1 a
+\((\w\. \w+)\) cd. (A. Tw) y -$1- -A. Tw-
diff --git a/t/op/split.t b/t/op/split.t
index 90c38e0770..ffc29be899 100755
--- a/t/op/split.t
+++ b/t/op/split.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..30\n";
+print "1..32\n";
$FS = ':';
@@ -129,6 +129,27 @@ print "not" if $_ ne "r:m :b";
print "ok 29\n";
# unicode splittage
+
@ary = map {ord} split //, v1.20.300.4000.50000.4000.300.20.1;
print "not " unless "@ary" eq "1 20 300 4000 50000 4000 300 20 1";
print "ok 30\n";
+
+@ary = split(/\x{FE}/, "\x{FF}\x{FE}\x{FD}"); # bug id 20010105.016
+print "not " unless @ary == 2 &&
+ $ary[0] eq "\xFF" && $ary[1] eq "\xFD" &&
+ $ary[0] eq "\x{FF}" && $ary[1] eq "\x{FD}";
+print "ok 31\n";
+
+@ary = split(/(\x{FE}\xFE)/, "\xFF\x{FF}\xFE\x{FE}\xFD\x{FD}"); # variant of 31
+print "not " unless @ary == 3 &&
+ $ary[0] eq "\xFF\xFF" &&
+ $ary[0] eq "\x{FF}\xFF" &&
+ $ary[0] eq "\x{FF}\x{FF}" &&
+ $ary[1] eq "\xFE\xFE" &&
+ $ary[1] eq "\x{FE}\xFE" &&
+ $ary[1] eq "\x{FE}\x{FE}" &&
+ $ary[2] eq "\xFD\xFD" &&
+ $ary[2] eq "\x{FD}\xFD" &&
+ $ary[2] eq "\x{FD}\x{FD}";
+
+print "ok 32\n";
diff --git a/t/op/substr.t b/t/op/substr.t
index 4d3bbce927..d3937fb107 100755
--- a/t/op/substr.t
+++ b/t/op/substr.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..136\n";
+print "1..149\n";
#P = start of string Q = start of substr R = end of substr S = end of string
@@ -304,3 +304,128 @@ my %data;
tie $data{'a'}, 'Tie::StdScalar'; # makes $data{'a'} magical
$data{a} = "firstlast";
ok 136, substr($data{'a'}, 0, 5, "") eq "first" && $data{'a'} eq "last";
+
+# more utf8
+
+# The following two originally from Ignasi Roca.
+
+$x = "\xF1\xF2\xF3";
+substr($x, 0, 1) = "\x{100}"; # Ignasi had \x{FF}
+ok 137, length($x) == 3 &&
+ $x eq "\x{100}\xF2\xF3" &&
+ substr($x, 0, 1) eq "\x{100}" &&
+ substr($x, 1, 1) eq "\x{F2}" &&
+ substr($x, 2, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 0, 1) = "\x{100}\x{FF}"; # Ignasi had \x{FF}
+ok 138, length($x) == 4 &&
+ $x eq "\x{100}\x{FF}\xF2\xF3" &&
+ substr($x, 0, 1) eq "\x{100}" &&
+ substr($x, 1, 1) eq "\x{FF}" &&
+ substr($x, 2, 1) eq "\x{F2}" &&
+ substr($x, 3, 1) eq "\x{F3}";
+
+# more utf8 lval exercise
+
+$x = "\xF1\xF2\xF3";
+substr($x, 0, 2) = "\x{100}\xFF";
+ok 139, length($x) == 3 &&
+ $x eq "\x{100}\xFF\xF3" &&
+ substr($x, 0, 1) eq "\x{100}" &&
+ substr($x, 1, 1) eq "\x{FF}" &&
+ substr($x, 2, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 1, 1) = "\x{100}\xFF";
+ok 140, length($x) == 4 &&
+ $x eq "\xF1\x{100}\xFF\xF3" &&
+ substr($x, 0, 1) eq "\x{F1}" &&
+ substr($x, 1, 1) eq "\x{100}" &&
+ substr($x, 2, 1) eq "\x{FF}" &&
+ substr($x, 3, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 2, 1) = "\x{100}\xFF";
+ok 141, length($x) == 4 &&
+ $x eq "\xF1\xF2\x{100}\xFF" &&
+ substr($x, 0, 1) eq "\x{F1}" &&
+ substr($x, 1, 1) eq "\x{F2}" &&
+ substr($x, 2, 1) eq "\x{100}" &&
+ substr($x, 3, 1) eq "\x{FF}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 3, 1) = "\x{100}\xFF";
+ok 142, length($x) == 5 &&
+ $x eq "\xF1\xF2\xF3\x{100}\xFF" &&
+ substr($x, 0, 1) eq "\x{F1}" &&
+ substr($x, 1, 1) eq "\x{F2}" &&
+ substr($x, 2, 1) eq "\x{F3}" &&
+ substr($x, 3, 1) eq "\x{100}" &&
+ substr($x, 4, 1) eq "\x{FF}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, -1, 1) = "\x{100}\xFF";
+ok 143, length($x) == 4 &&
+ $x eq "\xF1\xF2\x{100}\xFF" &&
+ substr($x, 0, 1) eq "\x{F1}" &&
+ substr($x, 1, 1) eq "\x{F2}" &&
+ substr($x, 2, 1) eq "\x{100}" &&
+ substr($x, 3, 1) eq "\x{FF}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, -1, 0) = "\x{100}\xFF";
+ok 144, length($x) == 5 &&
+ $x eq "\xF1\xF2\x{100}\xFF\xF3" &&
+ substr($x, 0, 1) eq "\x{F1}" &&
+ substr($x, 1, 1) eq "\x{F2}" &&
+ substr($x, 2, 1) eq "\x{100}" &&
+ substr($x, 3, 1) eq "\x{FF}" &&
+ substr($x, 4, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 0, -1) = "\x{100}\xFF";
+ok 145, length($x) == 3 &&
+ $x eq "\x{100}\xFF\xF3" &&
+ substr($x, 0, 1) eq "\x{100}" &&
+ substr($x, 1, 1) eq "\x{FF}" &&
+ substr($x, 2, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 0, -2) = "\x{100}\xFF";
+ok 146, length($x) == 4 &&
+ $x eq "\x{100}\xFF\xF2\xF3" &&
+ substr($x, 0, 1) eq "\x{100}" &&
+ substr($x, 1, 1) eq "\x{FF}" &&
+ substr($x, 2, 1) eq "\x{F2}" &&
+ substr($x, 3, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 0, -3) = "\x{100}\xFF";
+ok 147, length($x) == 5 &&
+ $x eq "\x{100}\xFF\xF1\xF2\xF3" &&
+ substr($x, 0, 1) eq "\x{100}" &&
+ substr($x, 1, 1) eq "\x{FF}" &&
+ substr($x, 2, 1) eq "\x{F1}" &&
+ substr($x, 3, 1) eq "\x{F2}" &&
+ substr($x, 4, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, 1, -1) = "\x{100}\xFF";
+ok 148, length($x) == 4 &&
+ $x eq "\xF1\x{100}\xFF\xF3" &&
+ substr($x, 0, 1) eq "\x{F1}" &&
+ substr($x, 1, 1) eq "\x{100}" &&
+ substr($x, 2, 1) eq "\x{FF}" &&
+ substr($x, 3, 1) eq "\x{F3}";
+
+$x = "\xF1\xF2\xF3";
+substr($x, -1, -1) = "\x{100}\xFF";
+ok 149, length($x) == 5 &&
+ $x eq "\xF1\xF2\x{100}\xFF\xF3" &&
+ substr($x, 0, 1) eq "\x{F1}" &&
+ substr($x, 1, 1) eq "\x{F2}" &&
+ substr($x, 2, 1) eq "\x{100}" &&
+ substr($x, 3, 1) eq "\x{FF}" &&
+ substr($x, 4, 1) eq "\x{F3}";
+