[open-ils-commits] [GIT] Evergreen ILS branch master updated. 01aa516be0861619b8d73af542b51d22fdc18b0d

Evergreen Git git at git.evergreen-ils.org
Fri Aug 11 11:55:44 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  01aa516be0861619b8d73af542b51d22fdc18b0d (commit)
       via  93f18ff0062954a199bee88aea56975472cf456d (commit)
      from  2151722dfff83d4c2ccfe875b9c347cafc803168 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 01aa516be0861619b8d73af542b51d22fdc18b0d
Author: Jason Stephenson <jason at sigio.com>
Date:   Sat Jan 7 19:49:12 2017 -0500

    LP 1542495: Release Notes and Sample Config Change.
    
    In addition to adding the release note file, we alter the location of
    the encoding element in oils_sip.xml.example to the new, recommended
    location.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Martha Driscoll <driscoll at noblenet.org>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example
index c3843e3..57ebda4 100644
--- a/Open-ILS/examples/oils_sip.xml.example
+++ b/Open-ILS/examples/oils_sip.xml.example
@@ -53,22 +53,22 @@
 				timeout="600" 
 				retries="3"/>
 	
+			<!-- The default encoding defined in the SIP specification is -->
+			<!-- ASCII, which isn't great for French, Spanish, Armenian. -->
+			<!-- You can specify a different encoding here, based on the -->
+			<!-- encodings supported by your SIP client and your Encode -->
+			<!-- module; run the following command to get a list of supported -->
+			<!-- encodings: -->
+			<!--   perl -MEncode -le "print for Encode->encodings(':all')" -->
+
+			<!-- UTF-8 is the recommended encoding if your SIP client supports it -->
+			<encoding>ascii</encoding>
+
 			<!-- implementation specific config options go here -->
 			<implementation_config>
 				<bootstrap>SYSCONFDIR/opensrf_core.xml</bootstrap>
 				<currency>USD</currency>
 
-				<!-- The default encoding defined in the SIP specification is -->
-				<!-- ASCII, which isn't great for French, Spanish, Armenian. -->
-				<!-- You can specify a different encoding here, based on the -->
-				<!-- encodings supported by your SIP client and your Encode -->
-				<!-- module; run the following command to get a list of supported -->
-				<!-- encodings: -->
-				<!--   perl -MEncode -le "print for Encode->encodings(':all')" -->
-
-				<!-- UTF-8 is the recommended encoding if your SIP client supports it -->
-				<encoding>ascii</encoding>
-
 				<!-- These defines what this SIP code has the ability to support -->
 				<supports>
 					<item name='magnetic media' value='true'/>
diff --git a/docs/RELEASE_NOTES_NEXT/SIP/LP1542495-Requires-SIPServer-Upgrade.adoc b/docs/RELEASE_NOTES_NEXT/SIP/LP1542495-Requires-SIPServer-Upgrade.adoc
new file mode 100644
index 0000000..2b40037
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/SIP/LP1542495-Requires-SIPServer-Upgrade.adoc
@@ -0,0 +1,34 @@
+SIP Bugfix Requires SIPServer Upgrade
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The fix for Launchpad Bug 1542495: "OpenILS::SIP::clean_text() can
+crash" requires that you also upgrade SIPServer with the fix for
+Launchpad Bug 1463943: "Non-ascii Unicode characters in messages cause
+SIP client problems."  This means that if you use SIP2 with Evergreen,
+you must also upgrade SIPServer to the latest commit in the git
+repository.  Conversely, if you upgrade SIPServer to the latest commit
+in git, you must also upgrade Evergreen or, at least, apply the patch
+for Launchpad Bug 1542495.  These two patches are complementary and
+cannot be applied independently of one another.
+
+SIP Bugfix Changes How Encoding Is Determined in Configuration
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The combined fix for the above mentioned SIP bugs alters the way that
+the output encoding is looked up in the configuration file (typically
+oils_sip.xml).  SIPServer now looks for the encoding in the following
+places:
+
+1. An +encoding+ attribute on the +account+ element for the currently active SIP account.
+2. The +encoding+ element that is a child of the +insitution+ element of the currently acctive SIP account.
+3. The +encoding+ element that is a child of the +implementation_config+ element that is itself a child of the +insitution+ element of the currently acctive SIP account.
+4. If none of the above exist, then ASCII encoding is used by default.
+
+Number 3 is provided to ease the transition to the new code.  It is
+the current location of the +encoding+ element in the sample
+configuration file and as such, where it is likely to be found in
+actual files.  It is recommended that you alter your configuration to
+move this element out of the +implementation_config+ element and into
+its parent +institution+ element.  SIPServer should *not* look into
+the implementation config, and this check may be removed at some time
+in the future.

commit 93f18ff0062954a199bee88aea56975472cf456d
Author: Jason Stephenson <jason at sigio.com>
Date:   Mon Jan 2 10:51:48 2017 -0500

    LP 1542495: Remove OpenILS::SIP::clean_text.
    
    This commit removes the OpenILS::SIP::clean_text utility function and
    all references to it in the OpenILS::SIP modules.  Its job is now done
    in SIPServer's write_msg routine.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Martha Driscoll <driscoll at noblenet.org>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
index 998ea85..e2639cc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
@@ -25,8 +25,6 @@ use OpenSRF::Utils::SettingsClient;
 use OpenILS::Application::AppUtils;
 use OpenSRF::Utils qw/:datetime/;
 use DateTime::Format::ISO8601;
-use Encode;
-use Unicode::Normalize;
 
 my $U = 'OpenILS::Application::AppUtils';
 
@@ -129,48 +127,6 @@ sub make_editor {
     return OpenILS::Utils::CStoreEditor->new;
 }
 
-=head2 clean_text(scalar)
-
-Evergreen uses the UTF8 encoding for everything from the database up. Perl
-doesn't know this, however, so we have to convince it to treat our UTF8 strings
-as UTF8 strings. This may enable OpenNCIP to correctly calculate the checksums
-for UTF8 text for SIP clients that support such modern options.
-
-The target encoding is set in the <encoding> element of the SIPServer.pm
-configuration file.
-
-=cut
-
-sub clean_text {
-    my $text = shift || '';
-
-    # Convert our incoming UTF8 data into Perl's internal string format
-
-    # Also convert to Normalization Form D, as the ASCII, iso-8859-1,
-    # and latin-1 encodings (at least) require this to substitute
-    # characters rather than simply returning a string truncated
-    # after the first non-ASCII character
-    $text = NFD(decode_utf8($text));
-
-    if ($target_encoding eq 'ascii') {
-
-        # Try to maintain a reasonable version of the content by
-        # stripping diacritics from the text, given that the SIP client
-        # wants just plain ASCII. This is the base requirement according
-        # to the SIP2 specification.
-
-        # Stripping the combining characters converts ""béè♁ts"
-        # into "bee?ts" instead of "b???ts" - better, eh?
-        $text =~ s/\pM+//og;
-    }
-
-    # Characters that cannot be represented in the target encoding will
-    # generally be replaced with a question mark (?) character.
-    $text = encode($target_encoding, $text);
-
-    return $text;
-}
-
 my %org_sn_cache;
 sub shortname_from_id {
     my $id = shift or return;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
index b32fb01..0c59825 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
@@ -271,17 +271,17 @@ sub sip_media_type {
 sub title_id {
     my $self = shift;
     my $t =  ($self->{mods}) ? $self->{mods}->title : $self->{copy}->dummy_title;
-    return OpenILS::SIP::clean_text($t);
+    return $t;
 }
 
 sub permanent_location {
     my $self = shift;
-    return OpenILS::SIP::clean_text($self->{copy}->circ_lib->shortname);
+    return $self->{copy}->circ_lib->shortname;
 }
 
 sub current_location {
     my $self = shift;
-    return OpenILS::SIP::clean_text($self->{copy}->circ_lib->shortname);
+    return $self->{copy}->circ_lib->shortname;
 }
 
 
@@ -340,7 +340,7 @@ sub fee_currency {
 
 sub owner {
     my $self = shift;
-    return OpenILS::SIP::clean_text($self->{copy}->circ_lib->shortname);
+    return $self->{copy}->circ_lib->shortname;
 }
 
 sub hold_queue {
@@ -418,14 +418,14 @@ sub hold_pickup_date {
 # message to display on console
 sub screen_msg {
     my $self = shift;
-    return OpenILS::SIP::clean_text($self->{screen_msg}) || '';
+    return $self->{screen_msg} || '';
 }
 
 
 # reciept printer
 sub print_line {
     my $self = shift;
-    return OpenILS::SIP::clean_text($self->{print_line}) || '';
+    return $self->{print_line} || '';
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 23e234c..cf6375a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -242,11 +242,10 @@ sub name {
 
 sub format_name {
     my $u = shift;
-    return OpenILS::SIP::clean_text(
-        sprintf('%s %s %s', 
-            ($u->first_given_name || ''),
-            ($u->second_given_name || ''),
-            ($u->family_name || '')));
+    return sprintf('%s %s %s',
+                   ($u->first_given_name || ''),
+                   ($u->second_given_name || ''),
+                   ($u->family_name || ''));
 }
 
 sub home_library {
@@ -259,19 +258,18 @@ sub home_library {
 sub __addr_string {
     my $addr = shift;
     return "" unless $addr;
-    my $return = OpenILS::SIP::clean_text(
-        join( ' ', map {$_ || ''} (
-            $addr->street1,
-            $addr->street2,
-            $addr->city . ',',
-            $addr->county,
-            $addr->state,
-            $addr->country,
-            $addr->post_code
-            )
-        )
-    );
-    $return =~ s/\s+/ /sg;     # Compress any run of of whitespace to one space
+    my $return = join( ' ', map {$_ || ''}
+                           (
+                               $addr->street1,
+                               $addr->street2,
+                               $addr->city . ',',
+                               $addr->county,
+                               $addr->state,
+                               $addr->country,
+                               $addr->post_code
+                           )
+                       );
+    $return =~ s/\s+/ /sg; # Compress any run of of whitespace to one space
     return $return;
 }
 
@@ -290,7 +288,7 @@ sub address {
 
 sub email_addr {
     my $self = shift;
-    return OpenILS::SIP::clean_text($self->{user}->email);
+    return $self->{user}->email;
 }
 
 sub home_phone {
@@ -322,7 +320,7 @@ sub ptype {
         [$self->{user}->profile->id, {no_i18n => 1}])->name
         if $use_code =~ /true/io;
 
-    return OpenILS::SIP::clean_text($self->{user}->profile->name);
+    return $self->{user}->profile->name;
 }
 
 sub language {
@@ -578,7 +576,7 @@ sub __format_holds {
 
         } else {
             push(@response, 
-                OpenILS::SIP::clean_text($self->__hold_to_title($hold)));
+                $self->__hold_to_title($hold));
         }
     }
 
@@ -777,7 +775,7 @@ sub overdue_items {
         if($return_datatype eq 'barcode') {
             push( @o, __circ_to_barcode($self->{editor}, $circid));
         } else {
-            push( @o, OpenILS::SIP::clean_text(__circ_to_title($self->{editor}, $circid)));
+            push( @o, __circ_to_title($self->{editor}, $circid));
         }
     }
     @overdues = @o;
@@ -834,7 +832,7 @@ sub charged_items_impl {
         if($return_datatype eq 'barcode' or $force_bc) {
             push( @c, __circ_to_barcode($self->{editor}, $circid));
         } else {
-            push( @c, OpenILS::SIP::clean_text(__circ_to_title($self->{editor}, $circid)));
+            push( @c, __circ_to_title($self->{editor}, $circid));
         }
     }
 
@@ -862,7 +860,7 @@ sub fine_items {
            } else {
                $line .= $xact->last_billing_note;
            }
-           push @fines, OpenILS::SIP::clean_text($line);
+           push @fines, $line;
        }
     };
     my $log_status = $@ ? 'ERROR: ' . $@ : 'OK';
@@ -899,7 +897,7 @@ sub block {
 
     # retrieve the un-fleshed user object for update
     $u = $e->retrieve_actor_user($u->id);
-    my $note = OpenILS::SIP::clean_text($u->alert_message) || "";
+    my $note = $u->alert_message || "";
     $note = "<sip> CARD BLOCKED BY SELF-CHECK MACHINE. $blocked_card_msg</sip>\n$note"; # XXX Config option
     $note =~ s/\s*$//;  # kill trailng whitespace
     $u->alert_message($note);
@@ -941,7 +939,7 @@ sub enable {
 
     # retrieve the un-fleshed user object for update
     $u = $e->retrieve_actor_user($u->id);
-    my $note = OpenILS::SIP::clean_text($u->alert_message) || "";
+    my $note = $u->alert_message || "";
     $note =~ s#<sip>.*</sip>##;
     $note =~ s/^\s*//;  # kill leading whitespace
     $note =~ s/\s*$//;  # kill trailng whitespace
@@ -977,7 +975,7 @@ sub inet_privileges {
     my $e = OpenILS::SIP->editor();
     $INET_PRIVS = $e->retrieve_all_config_net_access_level() unless $INET_PRIVS;
     my ($level) = grep { $_->id eq $self->{user}->net_access_level } @$INET_PRIVS;
-    my $name = OpenILS::SIP::clean_text($level->name);
+    my $name = $level->name;
     syslog('LOG_DEBUG', "OILS: Patron inet_privs = $name");
     return $name;
 }

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/oils_sip.xml.example             |   22 ++++----
 Open-ILS/src/perlmods/lib/OpenILS/SIP.pm           |   44 -----------------
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm      |   12 ++--
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm    |   52 +++++++++----------
 .../SIP/LP1542495-Requires-SIPServer-Upgrade.adoc  |   34 +++++++++++++
 5 files changed, 76 insertions(+), 88 deletions(-)
 create mode 100644 docs/RELEASE_NOTES_NEXT/SIP/LP1542495-Requires-SIPServer-Upgrade.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list