cheusov / dictd

Client/server software, human language dictionary databases, and tools supporting the DICT protocol (RFC 2229)
71 stars 10 forks source link

dict: conflict between options --mime with --strategy #3

Open Michahel opened 6 years ago

Michahel commented 6 years ago

How to reproduce the problem.

Perform the following tests:

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:DEFAUL
T'>2-е л. ед.ч. повел. действ. от</I> 1492 (εἰδῶ, οἶδα).

We got a normal result.

dict -s word -h dict.bibleonline.ru -M "ide"

No result. When you use the -s you have a problem.

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:DEFAUL
T'>2-е л. ед.ч. повел. действ. от</I> 1492 (εἰδῶ, οἶδα).

Now, the last two tests without using the -M, to see what should be the result.

dict -s word -h dict.bibleonline.ru "ide"

From Греческо-русский лексикон Нового Завета [ell-rus_strong]:

  2396  ἴδε   ide
  вот, се, смотри, посмотри;
  2-е л. ед.ч. повел. действ. от 1492 ( {εἰδῶ, οἶδα} ).
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:

  1. dict -s prefix -h dict.bibleonline.ru -M "ide"
  2. 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).

Michahel commented 6 years ago

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.