Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/mailbase/, net-mail/mailbase/files/
Date: Wed, 15 Sep 2021 15:34:05
Message-Id: 1631719964.882f0d776b44270540a4477c0622b72f9cf261a9.vapier@gentoo
1 commit: 882f0d776b44270540a4477c0622b72f9cf261a9
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 15 15:24:45 2021 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 15 15:32:44 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=882f0d77
7
8 net-mail/mailbase: document mailcap better
9
10 Also fix quoting of %s, and add %{charset} support to html.
11
12 Clean up the mailcap man page to generalize and remove mention of the
13 "metamail" package since this file is not specific to it.
14
15 Closes: https://bugs.gentoo.org/521134
16 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
17
18 net-mail/mailbase/files/mailcap-r2 | 36 ++++++++++++++++++++++
19 net-mail/mailbase/files/mailcap.5 | 58 +++++++++++++++++------------------
20 net-mail/mailbase/mailbase-1.7.ebuild | 46 +++++++++++++++++++++++++++
21 3 files changed, 111 insertions(+), 29 deletions(-)
22
23 diff --git a/net-mail/mailbase/files/mailcap-r2 b/net-mail/mailbase/files/mailcap-r2
24 new file mode 100644
25 index 00000000000..5ecd40a4201
26 --- /dev/null
27 +++ b/net-mail/mailbase/files/mailcap-r2
28 @@ -0,0 +1,36 @@
29 +# Database binding MIME types to programs that can process them.
30 +# This file is generally used by mail clients to view attachments.
31 +#
32 +# Users should add their own rules to their ~/.mailcap file. That file will be
33 +# processed first before falling back to this one.
34 +#
35 +# For more information, see the mailcap(5) man page.
36 +
37 +# NB: Do not quote %s. Clients will handle expanding it with proper quoting,
38 +# so adding quotes ourselves just confuses things.
39 +
40 +application/pdf; xdg-open %s; needsterminal
41 +application/postscript; xdg-open %s; needsterminal
42 +application/x-info; info --subnodes -o /dev/stdout -f %s 2>/dev/null; copiousoutput; description=GNU Info document
43 +application/x-gtar; tar tvzf -; print=tar tvzf - | print text/plain:-; copiousoutput
44 +application/x-tar; tar tvf -; print=tar tvf - | print text/plain:-; copiousoutput
45 +application/x-troff-man; nroff -mandoc -Tutf8; copiousoutput; print=nroff -mandoc -Tutf8 | print text/plain:-
46 +# It'd be nice to limit this to compressed formats (e.g. x-*), but the file
47 +# format doesn't support that, and less has good fallbacks already.
48 +application/*; less %s; copiousoutput; needsterminal
49 +
50 +audio/*; xdg-open %s; needsterminal
51 +image/*; xdg-open %s; needsterminal
52 +
53 +text/html; lynx -dump -assume_charset=%{charset} %s; copiousoutput; description=HTML Text; nametemplate=%s.html
54 +text/troff; man -l %s; needsterminal; description=Man page
55 +text/*; less %s; needsterminal
56 +text/*; gview %s; edit=gvim -f %s; compose=gvim -f %s; test=test "$DISPLAY" != ""
57 +text/*; view %s; edit=vim %s; compose=vim %s; needsterminal
58 +text/*; more %s; needsterminal
59 +
60 +# NB: This is an extension in the hope that it might be useful to some programs.
61 +# RFC1524 does not support * for the type (the string before the /), only for
62 +# the subtype (the string after the /).
63 +*/*; less %s; needsterminal
64 +*/*; false; print=lpr %s
65
66 diff --git a/net-mail/mailbase/files/mailcap.5 b/net-mail/mailbase/files/mailcap.5
67 index eec92103f88..438c6e2fa6d 100644
68 --- a/net-mail/mailbase/files/mailcap.5
69 +++ b/net-mail/mailbase/files/mailcap.5
70 @@ -1,17 +1,15 @@
71 .\" Hey, Emacs! This is an -*- nroff -*- source file.
72 .TH MAILCAP 5 "Release 2" "Bellcore Prototype"
73 .SH NAME
74 -mailcap - metamail capabilities file
75 +mailcap - mail capabilities file
76 .SH DESCRIPTION
77 The
78 .I mailcap
79 -file is read by the
80 -.I metamail
81 -program to determine how to display non-text at the local site.
82 +file is read by e-mail clients to determine how to display non-text at the local site.
83
84 The syntax of a mailcap file is quite simple, at least compared to termcap files. Any line that starts with "#" is a comment. Blank lines are ignored. Otherwise, each line defines a single mailcap entry for a single content type. Long lines may be continued by ending them with a backslash character, \\.
85
86 -Each individual mailcap entry consists of a content-type specification, a command to execute, and (possibly) a set of optional "flag" values. For example, a very simple mailcap entry (which is actually a built-in default behavior for metamail) would look like this:
87 +Each individual mailcap entry consists of a content-type specification, a command to execute, and (possibly) a set of optional "flag" values. For example, a very simple mailcap entry would look like this:
88
89 text/plain; cat %s
90
91 @@ -21,55 +19,57 @@ text/plain; cat %s; copiousoutput
92
93 can be used to indicate that the output of the 'cat' command may be voluminous, requiring either a scrolling window, a pager, or some other appropriate coping mechanism.
94
95 -The "type" field (text/plain, in the above example) is simply any legal content type name, as defined by informational RFC 1524. In practice, this is almost any string. It is the string that will be matched against the "Content\-type" header (or the value passed in with \-c) to decide if this is the mailcap entry that matches the current message. Additionally, the type field may specify a subtype (e.g. "text/ISO\-8859\-1") or a wildcard to match all subtypes (e.g. "image/*").
96 +The "type" field (text/plain, in the above example) is simply any legal content type name, as defined by informational RFC 1524. In practice, this is almost any string. It is the string that will be matched against the "Content\-type" header (or the value passed in with \-c) to decide if this is the mailcap entry that matches the current message. Additionally, the type field may specify a subtype (e.g. "text/ISO\-8859\-1") or a wildcard to match all subtypes (e.g. "image/*"). Note that wildcards may only be specified in the subtype (e.g. "*" or "*/*" do not work), and as the entire subtype (e.g. "application/x-*" does not work).
97
98 -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. Semicolons and backslashes within the command must be quoted with backslashes. If the command contains "%s", those two characters will be replaced by the name of a file that contains the body of the message. If it contains "%t", those two characters will be replaced by the content-type field, including the subtype, if any. (That is, if the content-type was "image/pbm; opt1=something-else", then "%t" would be replaced by "image/pbm".) If the command field contains "%{" followed by a parameter name and a closing "}", then all those characters will be replaced by the value of the named parameter, if any, from the Content-type header. Thus, in the previous example, "%{opt1}" will be replaced by "something-else". Finally, if the command contains "\\%", those two characters will b
99 e replaced by a single % character. (In fact, the backslash can be used to quote any character, including itself.)
100 +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
101 +.BR system (3)
102 +facility. Semicolons and backslashes within the command must be quoted with backslashes. If the command contains "%s", those two characters will be replaced by the name of a file that contains the body of the message. If it contains "%t", those two characters will be replaced by the content-type field, including the subtype, if any. (That is, if the content-type was "image/pbm; opt1=something-else", then "%t" would be replaced by "image/pbm".) If the command field contains "%{" followed by a parameter name and a closing "}", then all those characters will be replaced by the value of the named parameter, if any, from the Content-type header. Thus, in the previous example, "%{opt1}" will be replaced by "something-else". Finally, if the command contains "\\%", those two characters will be replaced by a single % character. (In fact, the backslash can be used to quote any character, including itself.)
103
104 -If no "%s" appears in the command field, then instead of placing the message body in a temporary file, metamail will pass the body to the command on the standard input. This is helpful in saving /tmp file space, but can be problematic for window-oriented applications under some window systems such as MGR.
105 +If no "%s" appears in the command field, then instead of placing the message body in a temporary file, clients will pass the body to the command on the standard input. This is helpful in saving /tmp file space, but can be problematic for window-oriented applications under some window systems such as MGR.
106
107 -Two special codes can appear in the viewing command for objects of type multipart (any subtype). These are "%n" and "%F". %n will be replaced by the number of parts within the multipart object. %F will be replaced by a series of arguments, two for each part, giving first the content-type and then the name of the temporary file where the decoded part has been stored. In addition, for each file created by %F, a second file is created, with the same name followed by "H", which contains the header information for that body part. This will not be needed by most multipart handlers, but it is there if you ever need it.
108 +Two special codes can appear in the viewing command for objects of type multipart (any subtype). These are "%n" and "%F". %n will be replaced by the number of parts within the multipart object. %F will be replaced by a series of arguments, two for each part, giving first the content-type and then the name of the temporary file where the decoded part has been stored. In addition, for each file created by %F, a second file is created, with the same name followed by "H", which contains the header information for that body part. This will not be needed by most multipart handlers, but it is there if you ever need it.
109
110 The "notes=xxx" field is an uninterpreted string that is used to specify the name of the person who installed this entry in the mailcap file. (The "xxx" may be replaced by any text string.)
111
112 The "test=xxx" field is a command that is executed to determine whether or not the mailcap line actually applies. That is, if the content-type field matches the content-type on the message, but a "test=" field is present, then the test must succeed before the mailcap line is considered to "match" the message being viewed. The command may be any UNIX command, using the same syntax and the same %-escapes as for the viewing command, as described above. A command is considered to succeed if it exits with a zero exit status, and to fail otherwise.
113
114 -The "print=xxx" field is a command that is executed to print the data instead of display it interactively. This behavior is usually a consequence of invoking metamail with the "\-h" switch.
115 +The "print=xxx" field is a command that is executed to print the data instead of display it interactively.
116
117 -The "textualnewlines" field can be used in the rather obscure case where metamail's default rules for treating newlines in base64-encoded data are unsatisfactory. By default, metamail will translate CRLF to the local newline character in decoded base64 output if the content-type is "text" (any subtype), but will not do so otherwise. A mailcap entry with a field of "textualnewlines=1" will force such translation for the specified content-type, while "textualnewlines=0" will guarantee that the translation does not take place even for textual content-types.
118 +The "textualnewlines" field can be used in the rather obscure case where default rules for treating newlines in base64-encoded data are unsatisfactory. By default, clients will translate CRLF to the local newline character in decoded base64 output if the content-type is "text" (any subtype), but will not do so otherwise. A mailcap entry with a field of "textualnewlines=1" will force such translation for the specified content-type, while "textualnewlines=0" will guarantee that the translation does not take place even for textual content-types.
119
120 -The "compose" field may be used to specify a program that can be used to compose a new body or body part in the given format. Its intended use is to support mail composing agents that support the composition of multiple types of mail using external composing agents. As with the view-command, the compose command will be executed after replacing certain escape sequences starting with "%". In particular, %s should be replaced by the name of a file to which the composed data is to be written by the specified composing program, thus allowing the calling program (e.g. metamail) to tell the called program where to store the composed data. If %s does not appear, then the composed data will be assumed to be written by the composing programs to standard output. The result of the composing program may be data that is NOT yet suitable for mail transport -- that is, a Content-Transfer-Encoding may still need to be applied to the data.
121 +The "compose" field may be used to specify a program that can be used to compose a new body or body part in the given format. Its intended use is to support mail composing agents that support the composition of multiple types of mail using external composing agents. As with the view-command, the compose command will be executed after replacing certain escape sequences starting with "%". In particular, %s should be replaced by the name of a file to which the composed data is to be written by the specified composing program, thus allowing the calling program to tell the called program where to store the composed data. If %s does not appear, then the composed data will be assumed to be written by the composing programs to standard output. The result of the composing program may be data that is NOT yet suitable for mail transport -- that is, a Content-Transfer-Encoding may still need to be applied to the data.
122
123 The "composetyped" field is similar to the "compose" field, but is to be used when the composing program needs to specify the Content-type header field to be applied to the composed data. The "compose" field is simpler, and is preferred for use with existing (non-mail-oriented) programs for composing data in a given format. The "composetyped" field is necessary when the Content-type information must include auxiliary parameters, and the composition program must then know enough about mail formats to produce output that includes the mail type information, and to apply any necessary Content-Transfer-Encoding. Conceptually, "compose" specifies a program that simply outputs the specified type of data in its raw form, while "composetyped" specifies a program that outputs the data as a MIME object, with all necessary Content-* headers already in place.
124
125 .TP 8
126 .B needsterminal
127 -If this flag is given, the named interpreter needs to interact with the user on a terminal. In some environments (e.g. a window-oriented mail reader under X11) this will require the creation of a new terminal emulation window, while in most environments it will not. If the mailcap entry specifies "needsterminal" and metamail is not running on a terminal (as determined by isatty(3), the \-x option, and the MM_NOTTTY environment variable) then metamail will try to run the command in a new terminal emulation window. Currently, metamail knows how to create new windows under the X11, SunTools, and WM window systems.
128 +If this flag is given, the named interpreter needs to interact with the user on a terminal. In some environments (e.g. a window-oriented mail reader under X11) this will require the creation of a new terminal emulation window, while in most environments it will not. If the mailcap entry specifies "needsterminal" and the mail client is not running on a terminal (as determined by
129 +.BR isatty (3),
130 +the \-x option, and the MM_NOTTTY environment variable) then the client will try to run the command in a new terminal emulation window.
131 .TP 8
132 .B copiousoutput
133 -This flag should be given whenever the interpreter is capable of producing more than a few lines of output on stdout, and does no interaction with the user. If the mailcap entry specifies copiousoutput, and pagination has been requested via the "\-p" command, then the output of the command being executed will be piped through a pagination program ("more" by default, but this can be overridden with the METAMAIL_PAGER environment variable).
134 -.SH BUILT-IN CONTENT-TYPE SUPPORT
135 -The metamail program has built-in support for a few key content-types. In particular, it supports the text type, the multipart and multipart/alternative type, and the message/rfc822 types. This support is incomplete for many subtypes -- for example, it only supports US-ASCII text in general. This kind of built-in support can be OVERRIDDEN by an entry in any mailcap file on the user's search path. Metamail also has rudimentary built-in support for types that are totally unrecognized -- i.e. for which no mailcap entry or built-in handler exists. For such unrecognized types, metamail will write a file with a "clean" copy of the data -- i.e. a copy in which all mail headers have been removed, and in which any 7-bit transport encoding has been decoded.
136 +This flag should be given whenever the interpreter is capable of producing more than a few lines of output on stdout, and does no interaction with the user. If the mailcap entry specifies copiousoutput, and pagination has been requested via the "\-p" command, then the output of the command being executed will be piped through a pagination program ("more" by default, but this can be overridden with the PAGER environment variable).
137 .SH FILES
138 $HOME/.mailcap:/etc/mailcap:/usr/share/etc/mailcap:/usr/local/etc/mailcap -- default path for mailcap files.
139 .SH SEE ALSO
140 -.BR run-mailcap "(1)",
141 -.BR mailcap.order "(5)",
142 -.BR update-mime "(8)"
143 +.BR run-mailcap (1),
144 +.BR mailcap.order (5),
145 +.BR update-mime (8)
146
147 -RFC 1524 (<http://tools.ietf.org/html/rfc1524>)
148 +RFC 1524 (<https://tools.ietf.org/html/rfc1524>)
149
150 .SH COPYRIGHT
151 Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
152
153 -Permission to use, copy, modify, and distribute this material
154 -for any purpose and without fee is hereby granted, provided
155 -that the above copyright notice and this permission notice
156 -appear in all copies, and that the name of Bellcore not be
157 -used in advertising or publicity pertaining to this
158 -material without the specific, prior written permission
159 -of an authorized representative of Bellcore. BELLCORE
160 -MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
161 -OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
162 +Permission to use, copy, modify, and distribute this material
163 +for any purpose and without fee is hereby granted, provided
164 +that the above copyright notice and this permission notice
165 +appear in all copies, and that the name of Bellcore not be
166 +used in advertising or publicity pertaining to this
167 +material without the specific, prior written permission
168 +of an authorized representative of Bellcore. BELLCORE
169 +MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
170 +OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
171 WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
172 .SH AUTHOR
173 Nathaniel S. Borenstein
174
175 diff --git a/net-mail/mailbase/mailbase-1.7.ebuild b/net-mail/mailbase/mailbase-1.7.ebuild
176 new file mode 100644
177 index 00000000000..3dd86a87fa2
178 --- /dev/null
179 +++ b/net-mail/mailbase/mailbase-1.7.ebuild
180 @@ -0,0 +1,46 @@
181 +# Copyright 1999-2021 Gentoo Authors
182 +# Distributed under the terms of the GNU General Public License v2
183 +
184 +EAPI="7"
185 +
186 +inherit pam
187 +
188 +DESCRIPTION="MTA layout package"
189 +HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
190 +
191 +LICENSE="GPL-2"
192 +SLOT="0"
193 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
194 +IUSE="pam"
195 +
196 +RDEPEND="
197 + acct-group/mail
198 + acct-user/mail
199 + acct-user/postmaster
200 + pam? ( sys-libs/pam )
201 + !<net-mail/metamail-2.7.53.3-r2"
202 +
203 +S=${WORKDIR}
204 +
205 +src_install() {
206 + dodir /etc/mail
207 + insinto /etc/mail
208 + doins "${FILESDIR}"/aliases
209 + insinto /etc
210 + newins "${FILESDIR}"/mailcap-r2 mailcap
211 + doman "${FILESDIR}"/mailcap.5
212 +
213 + dosym spool/mail /var/mail
214 +
215 + if use pam ; then
216 + newpamd "${FILESDIR}"/common-pamd-include pop
217 + newpamd "${FILESDIR}"/common-pamd-include imap
218 + local p
219 + for p in pop3 pop3s pops ; do
220 + dosym pop /etc/pam.d/${p}
221 + done
222 + for p in imap4 imap4s imaps ; do
223 + dosym imap /etc/pam.d/${p}
224 + done
225 + fi
226 +}