Source: dictd
Version: 1.12.1+dfsg-4
Severity: important
Tags: patch
How to reproduce the problem.
Perform the following tests.
TEST №1
dict -h dict.bibleonline.ru -M "ide"
----------
1 definition found
From Греческо-русский лексикон Нового Завета [ell-rus_strong]:
Content-type: text/html; charset=utf-8
Content-transfer-encoding: 8bit
2396 ἴδε ide
вот, се, смотри, посмотри;<BR><I TITLE='второе лицо, единственное число,
повелительное наклонение, действительный залог от' STYLE='COLOR: GREEN;
CURSOR:DEFAULT'>2-е л. ед.ч. повел. действ. от</I> 1492 (εἰδῶ, οἶδα).
----------
We got a normal result.
TEST №2
dict -s word -h dict.bibleonline.ru -M "ide"
----------
----------
No result. When you use the -s you have a problem.
TEST №3
dict -s prefix -h dict.bibleonline.ru -M "ide"
----------
From Греческо-русский лексикон Нового Завета [ell-rus_strong]:
Content-type: text/html; charset=utf-8
Content-transfer-encoding: 8bit
2396 ἴδε ide
вот, се, смотри, посмотри;<BR><I TITLE='второе лицо, единственное число,
повелительное наклонение, действительный залог от' STYLE='COLOR: GREEN;
CURSOR:DEFAULT'>2-е л. ед.ч. повел. действ. от</I> 1492 (εἰδῶ, οἶδα).
----------
Now, the last two tests without using the -M, to see what should be the
result.
TEST №4
dict -s word -h dict.bibleonline.ru "ide"
----------
From Греческо-русский лексикон Нового Завета [ell-rus_strong]:
2396 ἴδε ide
вот, се, смотри, посмотри;
2-е л. ед.ч. повел. действ. от 1492 ( {εἰδῶ, οἶδα} ).
----------
TEST №5
dict -s prefix -h dict.bibleonline.ru "ide"
----------
From Греческо-русский лексикон Нового Завета [ell-rus_strong]:
2396 ἴδε ide
вот, се, смотри, посмотри;
2-е л. ед.ч. повел. действ. от 1492 ( {εἰδῶ, οἶδα} ).
From Греческо-русский лексикон Нового Завета [ell-rus_strong]:
2397 ἰδέα idea
вид (1. наружность, внешность;
2. разновидность, тип);
син. 3444 ( {μορφή} ), 4976 ( {σχῆμα} ).
----------
Conclusion: When you use the -M compatible with -s causes that the last
dictionary entry is runaway.
I check this conclusion. I run DICT-server by command:
/usr/sbin/dictd -dnodetach -dinit
I do two tests:
dict -s prefix -h dict.bibleonline.ru -M "ide"
dict -s word -h dict.bibleonline.ru -M "ide"
I can see the result on the DICT-server:
:C: "dict 1.12.1/rf on CYGWIN_NT-5.1 1.7.28(0.271/5/3)"
:M: * prefix "ide" 2
:D: ell-rus_strong "ide" 1
:I: quit: d/m/c = 1/2/108; 1.000r 0.000u 0.000s
:C: "dict 1.12.1/rf on CYGWIN_NT-5.1 1.7.28(0.271/5/3)"
:M: * word "ide" 1
:I: quit: d/m/c = 0/1/903735; 0.000r 0.000u 0.000s
Note: We use the -M option instead --mime, but this is also true for the
long option (--mime) as for the short one (-M).
This should fix it.
Change line 1093 in dict.c to
for (i = cmd_reply.matches + option_mime; i > 0; --i) {
Can you test this and see if it works?
Thanks.
My patch for solving this problem:
----------------------------------------------------------------
--- a/dict.c 2018-01-24 01:05:59.531250000 +0600
+++ b/dict.c 2018-01-24 01:07:03.343750000 +0600
@@ -1090,7 +1090,7 @@
err_internal( __func__,
"%d matches, but no list\n", cmd_reply.matches );
- for (i = cmd_reply.matches; i > 0; --i) {
+ for (i = cmd_reply.matches + option_mime; i > 0; --i) {
/* skip MIME header */
const char *line = lst_nth_get( cmd_reply.data, i );
arg_List a;
----------------------------------------------------------------
--- a/dict.c 2018-01-24 01:05:59.531250000 +0600
+++ b/dict.c 2018-01-24 01:07:03.343750000 +0600
@@ -1090,7 +1090,7 @@
err_internal( __func__,
"%d matches, but no list\n", cmd_reply.matches );
- for (i = cmd_reply.matches; i > 0; --i) {
+ for (i = cmd_reply.matches + option_mime; i > 0; --i) {
/* skip MIME header */
const char *line = lst_nth_get( cmd_reply.data, i );
arg_List a;