Package: dicod
Version: 2.11-2+b3
Severity: important
Affects: dico-module-mediawiki
Tags: patch
Usertags: pca.it-communication

Hi there,

after the `load python` bug[1], I tried to configure some WikiMedia
databases using the `dicod`-commented M4 macros, without success:
```
root@harlock:~# /usr/bin/dicod --stderr -f
dicod: Error: /etc/dicod.conf:136.11-11: stray character `
dicod: Error: /etc/dicod.conf:136.14-14: stray character '
dicod: Error: /etc/dicod.conf:137.3-3: stray character `
dicod: Error: /etc/dicod.conf:137.20-20: stray character '
root@harlock:~# 
```

[1] <https://bugs.debian.org/1028487>

NB, plain non-macro configurations as the ones in the
    `dico-module-mediawiki`'s README.Debian allowed `dicod` to start.

In fact, after having read the `dico` upstream manual[2] I discovered
that for whatever reason (I am not an M4 neither a `dico` expert) the
wrong quoting characters ` and ' where used instead of [ and ][3],
albeit according to the M4 manual[4] ` and ' are indeed the M4 default
quoting characters.

[2] <https://www.gnu.org.ua/software/dico/manual/dico.html#Preprocessor>
[3] 
<https://stackoverflow.com/questions/66738638/how-should-i-escape-a-comma-inside-the-arguments-to-esyscmd#70503189>
[4] <https://www.gnu.org/software/m4/manual/m4.html#Quoted-strings>

Thus, replacing `' with [] in the `wikipedia` and `wiktionary` M4
macro definitions was the first step to get something working, albeit
to have everything OK I could not be able to keep the `wiktionary` and
`wiktionary` macro names, attached the full patch.

However, two final notes:

1. the snippets in `dico-module-mediawiki`'s README.Debian are IMHO
   useless if `dicod.conf` contains commented M4 macros.

2. I would go for a even more generic MediaWiki M4 macro and not 2
   different ones, as shown in the included `/etc/dicod.conf`.

Thx, bye,
Gismo / Luca

-- System Information:
Debian Release: 12.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'oldstable-updates'), (500, 'oldstable-security'), (500, 'oldoldstable'), (500, 
'stable'), (500, 'oldstable'), (100, 'bookworm-fasttrack'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-0.deb12.1-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dicod depends on:
ii  adduser                    3.134
ii  init-system-helpers        1.65.2
ii  libc6                      2.36-9+deb12u3
ii  libcrypt1                  1:4.4.33-2
ii  libdico2                   2.11-2+b3
ii  libgsasl18                 2.2.0-1
ii  libldap-2.5-0              2.5.13+dfsg-5
ii  libltdl7                   2.4.7-5
ii  libpam0g                   1.5.2-6+deb12u1
ii  libpcre3                   2:8.39-15
ii  m4                         1.4.19-3
ii  sysvinit-utils [lsb-base]  3.06-4
ii  zlib1g                     1:1.2.13.dfsg-1

dicod recommends no packages.

Versions of packages dicod suggests:
pn  dico-doc                         <none>
pn  openbsd-inetd | inetutils-inetd  <none>

-- Configuration Files:
/etc/dicod.conf changed:
capability (mime,xversion);
timing yes;
pidfile /var/run/dicod/dicod.pid;
listen localhost;
module-load-path ("/usr/lib/dico");
// Enable handling of databases in dict.org format:
load-module dictorg {
        command "dictorg sort trim-ws dbdir=/usr/share/dictd";
}
// dicodconfig automatically generates the database sections for dictorg
// formatted dictionaries, the following line makes use of this facility:
// Uncomment the following to enable handling of databases in Emacs outline 
// format:
/* load-module outline {
        command "outline";
}
*/
// Uncomment the following to enable Guile interface:
/* load-module guile {
        command "guile";
}
*/
// Uncomment the following to enable Python modules (e.g. MediaWiki):
// <https://bugs.debia.org/1028487>
load-module python {
        command "python load-path=/usr/share/dico/python";
}
// Emacs outline database example:
/* database {
        name "devdict";
        handler "outline /usr/share/dico/outline/devils.out";
}
*/
// WikiMedia via `debpkg:dico-module-mediawiki`
// <https://www.gnu.org.ua/software/dico/manual/dico.html#Preprocessor>
m4_define([defdbwikimedia], [
database {
        name "$1";
        handler "python load-path=/usr/share/dico/python init-script=mediawiki 
$2";
        mime-headers <<- EOT
          Content-Type: text/x-wiki
          Content-Transfer-Encoding: quoted-printable
          X-Wiki-Language: $1
        EOT;
m4_ifelse([$2],,,[
        description "$2";])
m4_ifelse([$3],,,[
        info <<- EOT
$3
EOT;])
}
])
defdbwikimedia(wikipedia-en,
  [en.wikipedia.org],
  [English language Wikipedia, a collaborative project to produce a
   free-content multilingual encyclopedia.])
defdbwikimedia(wikipedia-fr, [fr.wikipedia.org])
defdbwikimedia(wikipedia-it, [it.wikipedia.org])
defdbwikimedia(wiktionary-en,
  [en.wiktionary.org],
  [English language Wiktionary, a collaborative project to produce a
   free-content multilingual dictionary.])
defdbwikimedia(wiktionary-fr, [fr.wiktionary.org])
defdbwikimedia(wiktionary-it, [it.wiktionary.org])
alias d DEFINE;
alias da d "*";
alias df d "!";
alias m MATCH;
alias mas m "*";
alias mfs m "!";
alias ma mas ".";
alias mf mfs ".";
alias s STATUS;
alias h HELP;
alias q QUIT;
help-text <<- EOT
        +
  The following commands are abbreviations that Gray likes to use when
  debugging the daemon.  You may or may not find them useful.  However
  it is, do not write your client software to relay on them.  They may
  disappear or change any time Gray pleases, without notice.
  d database word                 -- DEFINE database word
  da word                         -- DEFINE * word
  df word                         -- DEFINE ! word
  ma word                         -- MATCH * . word
  mf word                         -- MATCH ! . word
  mas strategy word               -- MATCH * strategy word
  mfs strategy word               -- MATCH ! strategy word
  m database strategy word        -- MATCH database strategy word
  s                               -- STATUS
  h                               -- HELP
  q                               -- QUIT
EOT;
user dicod;
max-children 18;
server-info <<EOT
This is a Dico server.
EOT;
/* load-module stratall {
  command "stratall";
}
strategy all {
  deny-all yes;
}
*/
/* load-module substr {
  command "substr";
}
strategy substr {
  deny-length-lt 3;
}
*/


-- no debconf information

Attachment: dicod_2.11-2+b3_dicod.conf_dico-module-mediawiki.patch.gz
Description: application/gzip

Attachment: signature.asc
Description: PGP signature

Reply via email to