Package: mailutils
Version: 1:3.1.1-1
Severity: normal

Dear Maintainer,

I have this mailcap rule:

text/html; w3m -config $HOME/.w3m-config2 -dump -T text/html

but mailutils programs (like mail) don't use the shell to run this command, 
which fails because the variable HOME is not expanded.

From man 5 mailcap:
> The "command" field is any UNIX command ("cat %s" in the
> above example), and is used to specify the interpreter for
> the given type of message. It will be passed to the shell
> via the system(3) facility.

From man 3 system:
> system()  executes a command specified in command by
> calling /bin/sh -c command, and returns after the command
> has been completed.

In lib/mailcap.c:
/* Return 1 if CMD needs to be executed via sh -c */
static int
need_shell_p (const char *cmd)
{
  for (; *cmd; cmd++)
    if (strchr ("<>|&", *cmd))
      return 1;
  return 0;
}

This function should be removed. There's no point in adding characters to the 
list: mailcap calls for 'sh -c' *every* time.
I expect to be able to call any standard sh builtin from a mailcap rule. For 
example 'exit 0' should not result in a 'No such file or directory'.

-- System Information:
Debian Release: 9.8
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/1 CPU core)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mailutils depends on:
ii guile-2.0-libs 2.0.13+1-4
ii libc6 2.24-11+deb9u4
ii libfribidi0 0.19.7-1+b1
ii libgc1c2 1:7.4.2-8
ii libgnutls30 3.5.8-5+deb9u4
ii libgsasl7 1.8.0-8+b2
ii libkyotocabinet16v5 1.2.76-4.2+b1
ii libldap-2.4-2 2.4.44+dfsg-5+deb9u2
ii libmailutils5 1:3.1.1-1
ii libncurses5 6.0+20161126-1+deb9u2
ii libpam0g 1.1.8-3.6
ii libpython2.7 2.7.13-2+deb9u3
ii libreadline7 7.0-3
ii libtinfo5 6.0+20161126-1+deb9u2
ii libwrap0 7.6.q-26
ii mailutils-common 1:3.1.1-1
ii postfix [mail-transport-agent] 3.1.9-0+deb9u2

mailutils recommends no packages.

Versions of packages mailutils suggests:
pn mailutils-doc <none>
pn mailutils-mh <none>

-- no debconf information

Reply via email to