[ic] [interchange] Only apply GDBM filters if they are not already installed
Stefan Hornburg (Racke)
racke at linuxia.de
Fri Aug 31 10:27:00 UTC 2012
On 08/31/2012 03:22 AM, David Christensen wrote:
> commit 0c31ea3287df97c8fedbf23ad71244e4ebe019c7
> Author: David Christensen<david at endpoint.com>
> Date: Thu Aug 30 20:01:28 2012 -0500
>
> Only apply GDBM filters if they are not already installed
>
> In certain circumstances, using the same GDBM-based file in multiple catalogs with
> GDBM_ENABLE_UTF8=1 set was causing the GDBM filters to be installed multiple times on the same
> handle, which was resulting in encoding/decoding errors.
>
> Vend::Table::GDBM will now only install the filters if they do not exist on this handle, which
> should preserve existing behavior plus account for these corner-cases.
>
> lib/Vend/Table/GDBM.pm | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
> ---
> diff --git a/lib/Vend/Table/GDBM.pm b/lib/Vend/Table/GDBM.pm
> index fb82dbb..559f904 100644
> --- a/lib/Vend/Table/GDBM.pm
> +++ b/lib/Vend/Table/GDBM.pm
> @@ -150,10 +150,10 @@ sub apply_utf8_filters {
> my $out_filter = sub { $_ = encode('utf-8', $_) };
> my $in_filter = sub { $_ = decode('utf-8', $_) };
>
> - $handle->filter_store_key($out_filter);
> - $handle->filter_store_value($out_filter);
> - $handle->filter_fetch_key($in_filter);
> - $handle->filter_fetch_value($in_filter);
> + $handle->filter_store_key($out_filter) unless $handle->filter_store_key();
> + $handle->filter_store_value($out_filter) unless $handle->filter_store_value();
> + $handle->filter_fetch_key($in_filter) unless $handle->filter_fetch_key();
> + $handle->filter_fetch_value($in_filter) unless $handle->filter_fetch_value();
>
> return $handle;
> }
>
Running Interchange with this change gives the following message:
Configuring catalog dataident...Using MySQL, DSN=dbi:mysql:dataident...LocaleDatabase locale: Usage: GDBM_File::filter_store_key(db, code) at /usr/lib/interchange/Vend/Table/GDBM.pm line 153, <CONFIG> line 40.
done.
Regards
Racke
--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team
More information about the interchange-users
mailing list