[Bug 1795907] [NEW] In tests %s is not substituted with filename

Alexander Lazarević laza at e11bits.com
Wed Oct 3 14:24:54 UTC 2018


Public bug reported:

The manual of mailcap(5) says that in the test field "The command may be
any UNIX command, using the same syntax and the same %-escapes as for
the viewing command"

So this mailcap entry should be fine:

text/plain; wc '%s'; test=grep -q somepattern %s

I would expect to whenever there's a plain text file that contains the
word somepattern, wc should be invoked by run-mailcap on it. Otherwise
this entry should not be considered by run-mailcap.

What actually happens is that the %s will be substituted for the view
field (wc '%s') but not for the test field and so this entry will be
never considered.

I've included a bash script with testcases to demonstrate the bug.
(Please keep in mind that after all the years I still do consider myself
a bash script novice)

I have no patch. I do not grok perl.

** Affects: mime-support (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: testcase

** Attachment added: "Bash script with testcases"
   https://bugs.launchpad.net/bugs/1795907/+attachment/5196659/+files/test_test.sh

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to mime-support in Ubuntu.
https://bugs.launchpad.net/bugs/1795907

Title:
  In tests %s is not substituted with filename

Status in mime-support package in Ubuntu:
  New

Bug description:
  The manual of mailcap(5) says that in the test field "The command may
  be any UNIX command, using the same syntax and the same %-escapes as
  for the viewing command"

  So this mailcap entry should be fine:

  text/plain; wc '%s'; test=grep -q somepattern %s

  I would expect to whenever there's a plain text file that contains the
  word somepattern, wc should be invoked by run-mailcap on it. Otherwise
  this entry should not be considered by run-mailcap.

  What actually happens is that the %s will be substituted for the view
  field (wc '%s') but not for the test field and so this entry will be
  never considered.

  I've included a bash script with testcases to demonstrate the bug.
  (Please keep in mind that after all the years I still do consider
  myself a bash script novice)

  I have no patch. I do not grok perl.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mime-support/+bug/1795907/+subscriptions



More information about the foundations-bugs mailing list