[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#354416: metamail: test="xxx" field isn't passed the correct value of '%s'



Package: metamail
Version: 2.7-51
Severity: normal


according to the man page for mailcap metamail should evaluate the
test=xxx field with the same arguments as the command field, namely %s
should be the name of the file (the attachment to a mail message) 

<snipped from mailcap man page "command field" section>
 If  the  command contains "%s", those two characters will be
        replaced by the name of a file that contains the body of  the
	message.
	

<snipped from mailcap man page "test=xxx" section>
The command may be any UNIX command, using the same syntax and the same 
 %-escapes as for the  viewing command, as described above.

Granted, a careful reading indicates it says that %s is "replaced by the name of
*a* file that contains the body of the message" but I would think that
it would be the filename of the attached file... however an strace shows
that %s is actually the name of the temp file created... this makes it
impossible to have mailcap entries test on the file name of the
attachement.

If one wanted to use the attachment file name to determine what
application to use on files with the same Content-Type but different
extensions it would be nice to be able to test the actual attachment
filename

video/x-ms-asf; mplayer %s; description="MS Media File"; test=echo %s |
grep -qi asf
video/x-ms-asf; avifile %s; description="MS Media File"; test=echo %s |
grep -qi asx

should evaluate the attachment file name but instead evaluate the name
of the temp file created; from an strace
----- start snip
[pid  5837] execve("/bin/sh", ["sh", "-c", "echo /tmp/MHE5of5 | grep -qi
asf"...], [/* 34 vars */]) = 0
----- end

or better yet with debugging on:
----- start snip
write(1, "Metamail Version 2.7, debugging "..., 278Metamail Version 2.7,
debugging turned on.
Trying to open input file:
/home/slamson/.sylpheed-claws/mimetmp/0000002e.funny_scene.asf
Here is the environment:

Executing test command: echo /tmp/M2LNuzg | grep -qi tmp
Here is the environment:

---Executing:  mplayer /tmp/M86wEAl
----- end

Of course it executed because I used "tmp" as the search key for grep
instead of "asf" or "asx" as I would have wanted.

Is there an alternate solution available for this type of filename
evaluation?  Is this a bug?  A wishlist item?


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-386
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages metamail depends on:
ii  libc6                         2.3.6-2    GNU C Library: Shared libraries an
ii  libncurses5                   5.5-1      Shared libraries for terminal hand

Versions of packages metamail recommends:
ii  mime-support                  3.35-1     MIME files 'mime.types' & 'mailcap
ii  sharutils                     1:4.2.1-15 shar, unshar, uuencode, uudecode

-- no debconf information



Reply to: