Bugzilla – Attachment 91733 Details for
Bug 13937
Add an Elasticsearch-compatible Z39.50/SRU daemon
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13937: Fix issues found in QA
Bug-13937-Fix-issues-found-in-QA.patch (text/plain), 6.11 KB, created by
Ere Maijala
on 2019-07-23 12:30:00 UTC
(
hide
)
Description:
Bug 13937: Fix issues found in QA
Filename:
MIME Type:
Creator:
Ere Maijala
Created:
2019-07-23 12:30:00 UTC
Size:
6.11 KB
patch
obsolete
>From 0d2064bc4bd2870f026e7ef9980f87f3b1113965 Mon Sep 17 00:00:00 2001 >From: Ere Maijala <ere.maijala@helsinki.fi> >Date: Wed, 21 Nov 2018 16:20:33 +0200 >Subject: [PATCH] Bug 13937: Fix issues found in QA > >Signed-off-by: Stefan Berndtsson <stefan.berndtsson@ub.gu.se> >--- > C4/Installer/PerlDependencies.pm | 5 ----- > Koha/Z3950Responder.pm | 8 ++++---- > Koha/Z3950Responder/Session.pm | 9 +++++---- > misc/z3950_responder.pl | 9 ++++++++- > t/Koha/Z3950responder.t | 23 +++-------------------- > 5 files changed, 20 insertions(+), 34 deletions(-) > >diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm >index c143d18cf3..a937f40718 100644 >--- a/C4/Installer/PerlDependencies.pm >+++ b/C4/Installer/PerlDependencies.pm >@@ -903,11 +903,6 @@ our $PERL_DEPS = { > required => '1', > min_ver => '0.37', > }, >- 'Path::Tiny' => { >- usage => 'core', >- required => 1, >- min_ver => '0.058', >- }, > 'Net::Z3950::SimpleServer' => { > 'usage' => 'Z39.50 responder', > 'required' => '0', >diff --git a/Koha/Z3950Responder.pm b/Koha/Z3950Responder.pm >index cda52ead25..c7a7bf2973 100644 >--- a/Koha/Z3950Responder.pm >+++ b/Koha/Z3950Responder.pm >@@ -32,7 +32,7 @@ use Net::Z3950::SimpleServer; > sub new { > my ( $class, $config ) = @_; > >- my ($item_tag, $itemnumber_subfield) = GetMarcFromKohaField( "items.itemnumber", '' ); >+ my ($item_tag, $itemnumber_subfield) = GetMarcFromKohaField( "items.itemnumber" ); > > # We hardcode the strings for English so SOMETHING will work if the authorized value doesn't exist. > my $status_strings = { >@@ -57,13 +57,13 @@ sub new { > status_strings => $status_strings, > }; > >- # Turn off Yaz's built-in logging (can be turned back on if desired). >- unshift @{ $self->{yaz_options} }, '-v', 'none'; >- > # If requested, turn on debugging. > if ( $self->{debug} ) { > # Turn on single-process mode. > unshift @{ $self->{yaz_options} }, '-S'; >+ } else { >+ # Turn off Yaz's built-in logging apart from fatal errors (can be turned back on if desired). >+ unshift @{ $self->{yaz_options} }, '-v', 'none,fatal'; > } > > $self->{server} = Net::Z3950::SimpleServer->new( >diff --git a/Koha/Z3950Responder/Session.pm b/Koha/Z3950Responder/Session.pm >index 209a96d858..338056bb15 100644 >--- a/Koha/Z3950Responder/Session.pm >+++ b/Koha/Z3950Responder/Session.pm >@@ -80,6 +80,7 @@ sub _log_error { > > sub _set_error { > my ( $self, $args, $code, $msg ) = @_; >+ > ( $args->{ERR_CODE}, $args->{ERR_STR} ) = ( $code, $msg ); > > $self->_log_error(" returning error $code: $msg"); >@@ -140,8 +141,8 @@ sub _check_fetch { > return 0; > } > >- if ( $offset + $num_records > $resultset->{hits} ) { >- $self->_set_error( $args, ERR_PRESENT_OUT_OF_RANGE, 'Fetch request out of range' ); >+ if ( $offset < 0 || $offset + $num_records > $resultset->{hits} ) { >+ $self->_set_error( $args, ERR_PRESENT_OUT_OF_RANGE, 'Present request out of range' ); > return 0; > } > >@@ -155,7 +156,7 @@ sub _fetch_record { > > eval { > if ( !$resultset->{results}->record_immediate( $index ) ) { >- my $start = int( $index / $num_to_prefetch ) * $num_to_prefetch; >+ my $start = $num_to_prefetch ? int( $index / $num_to_prefetch ) * $num_to_prefetch : $index; > > if ( $start + $num_to_prefetch >= $resultset->{results}->size() ) { > $num_to_prefetch = $resultset->{results}->size() - $start; >@@ -184,7 +185,7 @@ sub search_handler { > my $database = $args->{DATABASES}->[0]; > > if ( $database !~ /^(biblios|authorities)$/ ) { >- $self->_set_error( ERR_DB_DOES_NOT_EXIST, 'No such database' ); >+ $self->_set_error( $args, ERR_DB_DOES_NOT_EXIST, 'No such database' ); > return; > } > >diff --git a/misc/z3950_responder.pl b/misc/z3950_responder.pl >index 2e63177d22..729934338d 100755 >--- a/misc/z3950_responder.pl >+++ b/misc/z3950_responder.pl >@@ -36,6 +36,9 @@ use Koha::Z3950Responder; > > =head1 OPTIONS > >+See https://software.indexdata.com/yaz/doc/server.invocation.html for more information about YAZ options >+not described below. >+ > =over 8 > > =item B<--help> >@@ -102,7 +105,6 @@ my @yaz_options; > > sub add_yaz_option { > my ( $opt_name, $opt_value ) = @_; >- warn "name: $opt_name and value: $opt_value"; > > push @yaz_options, "-$opt_name", "$opt_value"; > } >@@ -145,6 +147,11 @@ GetOptions( > pod2usage(1) if $help; > pod2usage( -verbose => 2 ) if $man; > >+if (!@ARGV || $ARGV[-1] =~ /^-/) { >+ # No bind address specified. Use @:2100 by default. >+ push(@ARGV, '@:2100'); >+} >+ > # Create and start the server. > > die "This tool only works with Zebra" if C4::Context->preference('SearchEngine') ne 'Zebra'; >diff --git a/t/Koha/Z3950responder.t b/t/Koha/Z3950responder.t >index 3d74e5df8f..7f2219783b 100644 >--- a/t/Koha/Z3950responder.t >+++ b/t/Koha/Z3950responder.t >@@ -1,7 +1,7 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 8; >+use Test::More tests => 2; > > BEGIN { > use_ok('Koha::Z3950Responder'); >@@ -9,23 +9,6 @@ BEGIN { > > my $zR = Koha::Z3950Responder->new({}); > >-my $args={ PEER_NAME => 'PEER'}; >+my $args = { PEER_NAME => 'PEER' }; > $zR->init_handler($args); >-is ( $args->{IMP_NAME}, 'Koha',"Server returns basic info"); >-$args->{DATABASES} = ['biblios']; >-$args->{QUERY} = 'biblios'; >-$args->{SETNAME} = 'biblios'; >-$args->{START} = 0; >-$args->{OFFSET} = 0; >-$args->{NUMBER} = 42; >-$zR->search_handler( $args ); >-is ( $args->{ERR_CODE}, 2, "We didn't start server , should fail"); >-is ( $args->{ERR_STR}, 'Cannot connect to upstream server', "We didn't start server, should fail because it cannot connect"); >-$zR->present_handler( $args ); >-is ( $args->{ERR_CODE}, 30, "There is no handler as we aren't connected"); >-is ( $args->{ERR_STR}, 'No such resultset', "We don't have a handler, should fail because we don't"); >-my $arg_check = ( $args ); >-$zR->fetch_handler( $args ); >-is_deeply( $args, $arg_check, "nothing should change"); >-$zR->close_handler( $args ); >-is_deeply( $args, $arg_check, "nothing should change"); >+is ( $args->{IMP_NAME}, 'Koha', 'Server returns basic info' ); >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13937
:
46369
|
47417
|
47418
|
47419
|
53503
|
58122
|
58125
|
58126
|
59443
|
59444
|
60735
|
60736
|
60737
|
60738
|
66943
|
66944
|
66945
|
66946
|
69139
|
82562
|
82563
|
82564
|
82565
|
82566
|
82567
|
82589
|
82590
|
82591
|
82592
|
82593
|
82594
|
82595
|
82660
|
82661
|
82662
|
82663
|
82664
|
82665
|
82666
|
82667
|
83780
|
83781
|
83782
|
83783
|
83784
|
83785
|
83786
|
83787
|
83788
|
83789
|
83951
|
83952
|
83953
|
83954
|
83955
|
83956
|
83957
|
83958
|
83959
|
84050
|
84051
|
84052
|
84053
|
84054
|
84055
|
84056
|
84057
|
84058
|
84059
|
84062
|
84063
|
84064
|
84065
|
84066
|
84067
|
84068
|
84069
|
84072
|
84073
|
85112
|
86353
|
86354
|
86355
|
86356
|
86357
|
86358
|
86359
|
86360
|
86361
|
86362
|
86363
|
86364
|
88907
|
88908
|
88909
|
88910
|
88911
|
88912
|
88913
|
88914
|
88915
|
88916
|
88917
|
88918
|
91728
|
91729
|
91730
|
91731
|
91732
| 91733 |
91734
|
91735
|
91736
|
91737
|
91738
|
91739
|
91740
|
93913
|
94097
|
94109
|
94110
|
94209
|
94616
|
94647