Subject: | protect() error message |
Date: | Tue, 19 Aug 2014 21:07:16 +1000 |
To: | bug-File-Map [...] rt.cpan.org |
From: | Kevin Ryde <user42_kevin [...] yahoo.com.au> |
With recent debian i386 perl 5.20.0 if protect() is called with an
invalid protection mode argument then it prints garbage characters in
its croak message. For example foo.pl below prints
No such mode '\240\370^A' known at /home/gg/bug/file-map-errmsg/foo.pl line 8.
where those \240 etc are actual high bytes. I expected it to print
something like
No such mode 'bogusmode'
I suspect in S_protection_value() that croak() takes a string rather
than an SV.
use strict;
use File::Map 'map_file','protect';
print File::Map->VERSION,"\n";
map_file (my $str, '/etc/passwd');
print "mapped ok\n";
protect ($str, 'bogusmode');
print "protect ok\n";