Hi Rocco,

The s/// on line 122 of Kernel/Select.pm doesn't seem to work right.

Given this test script:

vec ($v, 33, 1) = 1;
vec ($v, 35, 1) = 1;
print 'Vector before: ', unpack ('b*', $v), "\n";
$v =~ s/(.)\000+$/$1/;
print 'Vector after : ', unpack ('b*', $v), "\n";

the output is:

Vector before: 0000000000000000000000000000000001010000
Vector after : 0000000001010000

which of course results in assertions like "select error: Bad file
descriptor" or "select error: Unknown error" when POE calls select().

If I change the s/// to say s/(.)\0+\Z/$1/, the problem persists.
However, if I change it to s/(.)\0+\z/$1/, it seems to do a notably
better job!

Looks like Perl's regex engine is not terribly good at manipulating
binary data...

Best regards,
Kirill

Reply via email to