• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7067: Configure adds extra (?^: ... ) to regex variables on save under Perl 5.14

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine configure Normal Closed   patch 5.1.3

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

Reported in TWiki:Support.SID-01595:

Each time you save configure values, the regex variables get an extra enclosing (?^: ... ). For example, an empty regex field looks like this after multiple configure saves:
(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:(?^:))))))))))))))))))))))

Fix: Fix regex values in configure by removing extra patterns recursively.

-- TWiki:Main/PeterThoeny - 2012-11-30

Patch:

--- TWiki/Configure/Types/REGEX.pm   (revision 24236)
+++ TWiki/Configure/Types/REGEX.pm   (working copy)
@@ -27,19 +27,31 @@
 
 use base 'TWiki::Configure::Types::STRING';
 
+# TWikibug:Item7067: Configure adds extra (?^:) to regex variables
+# on save under Perl 5.14. This needs to be cleaned up.
+# SMELL: Regex cleanup needs to be done on 3 places:
+#    * Here in sub string2value,
+#    * Here in sub equals,
+#    * TWiki::Configure::Valuer in sub _getValue.
+
 sub prompt {
     my( $this, $id, $opts, $value ) = @_;
     $value = '' unless defined($value);
     $value = "$value";
-    while ($value =~ s/^\(\?-xism:(.*)\)$/$1/) { };
-    $value =~ s/([[\x01-\x09\x0b\x0c\x0e-\x1f"%&'*<=>@[_\|])/'&#'.ord($1).';'/ge;
+
+    # Disabling this because the value should not appears changed in the authorise screen
+    # while ( $value =~ s/^\(\?-xism:(.*)\)$/$1/ ) { }
+    # while ( $value =~ s/^\(\?\^:(.*)\)/$1/ )     { }
+    # $value =~ s/([[\x01-\x09\x0b\x0c\x0e-\x1f"%&'*<=>@[_\|])/'&#'.ord($1).';'/ge;
+
     my $res = '<input name="'.$id.'" type="text" size="55%" value="'.$value.'" />';
     return $res;
 }
 
 sub string2value {
     my ($this, $value) = @_;
-    while ($value =~ s/^\(\?-xism:(.*)\)$/$1/) { };
+    while ( $value =~ s/^\(\?-xism:(.*)\)$/$1/ ) { }
+    while ( $value =~ s/^\(\?\^:(.*)\)/$1/ )     { }
     return qr/$value/;
 }
 
@@ -51,10 +63,10 @@
     } elsif (!defined $def) {
         return 0;
     }
-    while ($val =~ s/^\(\?-xism:(.*)\)$/$1/) {
-    }
-    while ($def =~ s/^\(\?-xism:(.*)\)$/$1/) {
-    }
+    while ( $val =~ s/^\(\?-xism:(.*)\)$/$1/ ) { }
+    while ( $def =~ s/^\(\?-xism:(.*)\)$/$1/ ) { }
+    while ( $val =~ s/^\(\?\^:(.*)\)/$1/ ) { }
+    while ( $def =~ s/^\(\?\^:(.*)\)/$1/ ) { }
     return $val eq $def;
 }
 
--- TWiki/Configure/Valuer.pm   (revision 24236)
+++ TWiki/Configure/Valuer.pm   (working copy)
@@ -54,7 +54,15 @@
         # SMELL: Really shouldn't do this unless we are sure it's an RE,
         # but the probability of this string occurring elsewhere than an
         # RE is so low that we can afford to take the risk.
-        while ($val =~ s/^\(\?-xism:(.*)\)$/$1/) {};
+
+        # TWikibug:Item7067: Configure adds extra (?^:) to regex variables
+        # on save under Perl 5.14. This needs to be cleaned up.
+        # SMELL: Regex cleanup needs to be done on 3 places:
+        #    * TWiki::Configure::Types::REGEX in sub string2value,
+        #    * TWiki::Configure::Types::REGEX in sub equals,
+        #    * Here in sub _getValue.
+        while ( $val =~ s/^\(\?-xism:(.*)\)$/$1/ ) { }
+        while ( $val =~ s/^\(\?\^:(.*)\)$/$1/ )    { }
     }
     return $val;
 }

-- TWiki:Main/PeterThoeny - 2012-11-30

For TWiki sites running under Perl 5.14 or newer do this to fix the issue:

  • Apply above patch
  • Run configure, save changes - this fixes the regex values

-- TWiki:Main.PeterThoeny - 2012-11-30

Patch confirmed to be working at TWiki:Support.SID-01595

-- PeterThoeny - 2012-12-06

ItemTemplate
Summary Configure adds extra (?^: ... ) to regex variables on save under Perl 5.14
ReportedBy TWiki:Main.PeterThoeny
Codebase ~twiki4, 5.1.2
SVN Range TWiki-5.1.3-trunk, Fri, 23 Nov 2012, build 24178
AppliesTo Engine
Component configure
Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:24237 TWikirev:24238 TWikirev:24239 TWikirev:24240 TWikirev:24241 TWikirev:24242 TWikirev:24243
TargetRelease patch
ReleasedIn 5.1.3
Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r12 - 2012-12-16 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback