[ic] Encode Woes

David Christensen david at endpoint.com
Fri Aug 28 18:19:34 UTC 2009


On Aug 28, 2009, at 10:59 AM, Gert van der Spoel wrote:

>> -----Original Message-----
>> From: interchange-users-bounces at icdevgroup.org [mailto:interchange-
>> users-bounces at icdevgroup.org] On Behalf Of David Christensen
>> Sent: Friday, August 28, 2009 4:58 PM
>> To: interchange-users at icdevgroup.org
>> Subject: Re: [ic] Encode Woes
>>
>>
>> On Aug 28, 2009, at 6:08 AM, Stefan Hornburg wrote:
>>
>>> Hello,
>>>
>>> even with current software I get encode errors as fllows:
>>>
>>> 89.182.95.158 yar5ToG2:ulisses ulisses [28/August/2009:13:05:48
>>> +0200] ulisses ulisses.icdev.de/cgi-bin/ulisses/index Safe: Attempt
>>> to reload Encode.pm aborted.
>>>> Compilation failed in require at /home/interchange/perl/lib/5.10.1/
>>>> x86_64-linux/Encode/Alias.pm line 22.
>>>>
>>>>
>>>> $Variable->{SKU} = 'AEG3203';
>>>> $Tag->component('image_view_link');
>>>>
>>>>
>>>
>>> This is Perl 5.10.1 from source, compiled without threads and
>>> Interchange from Git.
>>>
>>> Any suggestions?
>>>
>>
>> My guess is that this is some specific runtime require that's not
>> being caught in the Vend::Safe initialization that does the other
>> Encode/UTF8 stuff.  We may need to figure out what's causing the
>> delayed load, and if there is something we can do to trigger the
>> require at Safe setup time.  I haven't looked at 5.10.1 yet, so I may
>> get a chance to do that today.
>>
>> What are the settings you currently have WRT charsets, utf8, etc?
>
> And is it for example possible to reduce it to a testcase of maybe a  
> single
> tag on a page causing this behavior?
> I'm running with 5.10.0 , which has an older Encode version (2.33  
> instead of
> 2.35), but the differences there do not seem to be very big ...
>
> Internet is not coming up with much to hold on to, some checking  
> done by
> Perl 5.10 is more strict than 5.8.x ....
>
> Do you have a possibility to set up a Perl 5.8.9 as well to see if the
> problem exists there aswell (with the latest Encode version)?


As I noted on IRC, 5.10.1 includes a version of Encode.pm which adds  
an explicit require to a couple routines.  I'm enclosing a patch  
inline (untested, as I'm still trying to get 5.10.1 to build over  
here); can you test and verify that this works for you?

Regards,

David
--
David Christensen
End Point Corporation
david at endpoint.com

---- >8 cut here 8< ----
commit 568c7874a66f9d6371a6c499427834f430e77836
Author: David Christensen <david at endpoint.com>
Date:   Fri Aug 28 13:14:24 2009 -0500

     Correct Vend::Safe issues introduced by updated Encode library

     We kind of have to chase our tails here and add Safe::Hole  
exceptions
     to specific subroutines such as this when they occur.  However,  
there
     should be no harm in exposing these routines in prior versions of
     perl, so this approach (while annoying) is still backwards- 
compatible.

diff --git a/lib/Vend/Safe.pm b/lib/Vend/Safe.pm
index c9ae0de..4887351 100644
--- a/lib/Vend/Safe.pm
+++ b/lib/Vend/Safe.pm
@@ -55,8 +55,15 @@ sub initialize_safe_compartment {
      my $mask = $compartment->mask;
      $compartment->deny_only(); # permit everything

+    my @charset_routines = qw(
+        &utf8::SWASHNEW
+        &utf8::SWASHGET
+        &Encode::Alias::init_aliases
+        &Encode::Alias::find_alias
+    );
+
      # add custom shared variables for unicode support
-    $compartment->share_from('main', ['&utf8::SWASHNEW',  
'&utf8::SWASHGET']);
+    $compartment->share_from('main', \@charset_routines);

      # preload utf-8 stuff in compartment
      $compartment->reval('qr{\x{0100}}i');




More information about the interchange-users mailing list