docs/master

view ch03.roff @ 84:c35ec2b7de5d

style: New macros .Ar (argument) and .Hd (header field)
author markus schnalke <meillo@marmaro.de>
date Wed, 06 Jun 2012 18:27:28 +0200
parents ff4537327162
children fb0d1b4c8fb1
line source
1 .H0 "Discussion
2 .P
3 This main chapter discusses the practical work done in the mmh project.
4 It is structured along the goals to achieve. The concrete work done
5 is described in the examples of how the general goals were achieved.
10 .H1 "Stream-lining
12 .P
13 MH had been considered an all-in-one system for mail handling.
14 The community around nmh has a similar understanding.
15 In fundamental difference, should be a MUA only.
16 I believe that all-in-one mail systems are obsolete.
17 There are excellent specialized MTAs, like Postfix;
18 there are specialized MDAs, like Procmail; there are specialized
19 MRAs, like Fetchmail. I believe it's best to use them instead of
20 providing the same function ourselves. Doing something well, requires to
21 focus on a small set of aspects. The more
22 it is possible to focus, the better the result in this particular
23 area will be. Usually, the limiting resource in Free Software
24 community development is man power.
25 If the development power is even spread over a large
26 development area, it becomes more difficult to
27 compete with the specialists in the various fields. This is even
28 increased, given the small community \(en developers and users \(en
29 that MH-based mail systems have. In consequence, I believe that the
30 available resources should be focused to the point where MH is
31 most unique. This is clearly the MUA part.
32 .P
33 The goal for mmh was to remove peripheral parts and stream-line
34 it for the MUA task.
37 .H2 "Removal of Mail Transfer Facilities
38 .P
39 In contrast to nmh, which also provides mail submission and mail retrieval
40 facilities, mmh is a MUA only.
41 This general difference in the view on the character of nmh
42 initiated the development of mmh.
43 Removing the mail transfer facilities had been the first work task
44 in the mmh project.
45 .P
46 The MSA is called \fIMessage Transfer Service\fP (MTS) in nmh.
47 The facility established network connections and spoke SMTP to submit
48 messages for relay to the outside world.
49 This part was implemented by the
50 .Pn post
51 command.
52 The changes in emailing
53 demanded changes in this part of nmh in the last years.
54 Encryption and authetication for network connections
55 needed to be supported, hence TLS and SASL were introduced
56 into nmh. This added complexity to the nmh without improving it in
57 its core functions. Also, keeping up with recent developments in
58 this field requires development power and specialists.
59 For mmh this whole facility was cut off.
60 .Ci f6aa95b724fd8c791164abe7ee5468bf5c34f226
61 .Ci fecd5d34f65597a4dfa16aeabea7d74b191532c3
62 .Ci 156d35f6425bea4c1ed3c4c79783dc613379c65b
63 Instead, mmh depends on an external MTA.
64 The only outgoing interface available to mmh is the
65 .Pn sendmail
66 command.
67 Almost any MTA provides a
68 .Pn sendmail
69 command.
70 If not, any program can be substituted if it reads the
71 message from the standard input, extracts the recipient addresses
72 from the message header and does not conflict
73 with sendmail-specific command line options.
74 .P
75 To retrieve mail, the
76 .Pn inc
77 command established network connections
78 and spoke POP3 to retrieve mail from remote servers.
79 As with mail submission, the network connections required encryption and
80 authentication, thus TLS and SASL was added.
81 As POP3 becomes more and more superseded by IMAP, support for message
82 retrieval through IMAP will become necessary to be added soon, too.
83 Mmh has dropped the support for retrieving mail from remote locations.
84 .Ci ab7b48411962d26439f92f35ed084d3d6275459c
85 Instead, it depends on an external tool to cover this task.
86 There exist two paths for messages to enter mmh's mail storage:
87 They can be incorporate with
88 .Pn inc
89 from the system maildrop, or
90 .Pn rcvstore
91 reads them from the standard input.
92 .P
93 With the removal of the MSA and MRA, mmh converted from an all-in-one
94 mail system to being only a MUA.
95 Following the Unix philosophy, it focuses on one job and
96 tries to do that one well.
97 Not only the programs follow that tenet but also the project itself does so.
98 Now, of course, mmh depends on third-party software.
99 An external MTA/MSA is required to transfer mail to the outside world;
100 an external MRA is required to retrieve mail from remote machines.
101 There exist excellent implementations of such software,
102 which do this specific task likely better than the internal
103 versions had done it. Also, the best suiting programs can be freely chosen.
104 .P
105 As it had already been possible to use an external MSA or MRA,
106 why not keep the internal version for convenience?
107 The question whether there is sense in having a fall-back pager in all
108 the command line tools, for the cases when
109 .Pn more
110 or
111 .Pn less
112 aren't available, appears to be ridiculous.
113 Now, an MSA or MRA is clearly more complex than a text pager,
114 and not necessarily available but still the concept holds:
115 design the system orthogonally.
116 If it is conceptionally more elegant to have the MTA to be a separate tool
117 \(en as the RFCs propose this split, this is likely the case \(en
118 then separate.
119 .P
120 Further more, if programs become complex, they should be split;
121 and if projects become complex, they should be split, too.
122 Essential complexity is defined by the problem.
123 Decades ago, emailing had been small and simple.
124 (\c
125 .Pn /bin/mail
126 had once covered anything there was to email and still had been small
127 and simple.)
128 Then the essential complexity of email increased.
129 Email tools needed to react.
130 In nmh, for instance, the POP server, which the original MH had included,
131 was removed.
132 Now is the time to go one step further and remove the MSA and MRA.
133 Not only does it decrease the code amount of the project,
134 but more important, it removes the whole field of message transfer
135 with all its implications for the project.
136 It removes the need to adjust to any changes concerning network transfer.
137 This independence is received by depending on an external program
138 that covers the field.
139 Today, this is a reasonable exchange.
140 .P
141 To add some kind of function, there's always the choice
142 among implementing the function in the project directly,
143 depending on a library that provides the function, or depending on
144 a program that provides the function.
145 Whereas adding the function directly to the project increases the
146 code size most and requires most maintenance and development work,
147 it makes the project most independent.
148 Using libraries or external programs require less
149 maintenance work.
150 Programs have the smallest interfaces, providing the most separation
151 but possibly limiting the information exchange.
152 External libraries are stronger connected than external programs but
153 allow better information exchange.
154 Adding more code to a project does always increase maintenance work.
155 Implementing complex functions directly in the project will add
156 a lot of code. This should be avoided if possible.
157 Hence, the dependencies only change in kind, not in their existence.
158 In mmh, library dependencies on
159 .Pn libsasl2
160 and
161 .Pn libcrypto /\c
162 .Pn libssl
163 were treated against program dependencies on an MSA and an MRA.
164 Besides program dependencies providing the stronger separation
165 and being more flexible, they also allowed
166 over 6\|000 lines of code to be removed from mmh.
167 This made mmh's code base about 12\|% smaller.
168 Reducing the projects code size by such an amount without actually
169 losing function is a convincing argument.
170 Actually, as external MSAs and MRAs are likely better
171 than the project's internal version, the user even gains functionality.
172 .P
173 Users of MH should not have problems to set up an external MSA and MRA.
174 Also, the popular MSAs and MRAs have large communities and a lot
175 of documentation available.
176 Choices for MSAs range from the full-featured
177 .I Postfix
178 over mid-size solutions like
179 .I masqmail
180 and
181 .I dma
182 to small forwarders like
183 .I ssmtp
184 and
185 .I nullmailer .
186 Choices for MRAs include
187 .I fetchmail ,
188 .I getmail ,
189 .I mpop
190 and
191 .I fdm .
194 .H2 "Removal of non-MUA Tools
195 .P
196 Some MH tools were removed because they didn't add to the MUA's job.
197 It is a design goal of mmh to remove the parts that are rarely used.
198 The project shall become more stream-lined and focused.
199 Rarely used and loosely related tools distract from the lean appearance.
200 They require maintenance work without adding to the core task.
201 In mmh the following tools are not available anymore:
202 .BU
203 .Pn conflict
204 was removed because it is a mail system maintenance tool.
205 .Ci 8b235097cbd11d728c07b966cf131aa7133ce5a9
206 Besides, it even checks
207 .Fn /etc/passwd
208 and
209 .Fn /etc/group
210 for consistency, which has nothing at all to do with emailing.
211 The tool might be useful, but it should not be shipped with mmh.
212 .\" XXX historic reasons?
213 .BU
214 .Pn rcvtty
215 was removed because its usecase of writing to the user's terminal
216 on receiving of mail is obsolete.
217 .Ci 14767c94b3827be7c867196467ed7aea5f6f49b0
218 If users like to be
219 informed of new mail, the shell's
220 .Ev MAILPATH
221 variable or graphical notifications are more appealing.
222 Writing directly to a terminals is hardly ever wanted today.
223 If though one wants to have it this way, the standard tool
224 .Pn write
225 can be used in a way similar to:
226 .VS
227 scan -file - | write `id -un`
228 VE
229 .BU
230 .Pn viamail
231 was removed when the new attachment system was activated, because
232 .Pn forw
233 could then cover the task itself.
234 .Ci eda72d6a7a7c20ff123043fb7f19c509ea01f932
235 The program
236 .Pn sendfiles
237 was rewritten as a shell script wrapper around
238 .Pn forw .
239 .Ci 0e82199cf3c991a173e0ac8aa776efdb3ded61e6
240 .BU
241 .Pn msgchk
242 was removed, because it lost its use case when POP support was removed.
243 .Ci bb9360ead7eb7a3fedcce2eeedfc660014e41dbe
244 A call to
245 .Pn msgchk
246 provided hardly more information than
247 .VS
248 ls -l /var/mail/meillo
249 VE
250 though it distinguished between old and new mail.
251 This detail information and can be retrieved with
252 .Pn stat (1),
253 too.
254 A very small shell script could be written to output the information
255 in a similar way, if truly necessary.
256 As mmh's
257 .Pn inc
258 only incorporates mail from the user's local maildrop
259 and thus no data transfers over slow networks are involved,
260 there's hardly any need to check for new mail before incorporating it.
261 .BU
262 .Pn msh
263 was removed because the tool was in conflict with the philosophy of MH.
264 .Ci 916690191222433a6923a4be54b0d8f6ac01bd02
265 It provided an interactive shell to access the features of MH,
266 but it wasn't just a shell, tailored to the needs of mail handling.
267 Instead it was one large program that had several MH tools built in.
268 This conflicts with the major feature of MH of being a tool chest.
269 .Pn msh 's
270 main use case had been accessing Bulletin Boards, which have seized to
271 be popular.
272 .P
273 Removing
274 .Pn msh ,
275 together with the truly archaic code relicts
276 .Pn vmh
277 and
278 .Pn wmh ,
279 saved more than 7\|000 lines of C code \(en
280 about 15\|% of the project's original source code amount.
281 .P
282 Having less code (with equal readability, of course)
283 for the same functionality is an advantage.
284 Less code means less bugs and less maintenance work.
285 As
286 .Pn rcvtty
287 and
288 .Pn msgchk
289 are rarely used and can be implemented in different ways,
290 then why should one keep them?
291 Removing them stream-lines mmh.
292 .Pn viamail 's
293 use case is now partly obsolete and partly covered by
294 .Pn forw ,
295 hence there's no reason to still maintain it.
296 .Pn conflict
297 is not related to the mail client, and
298 .Pn msh
299 conflicts with the basic concept of MH.
300 Theses two tools might still be useful, but they should not be part of mmh.
301 .P
302 Finally, there's
303 .Pn slocal .
304 .Pn slocal
305 is an MDA and thus not directly MUA-related.
306 It should be removed, because including it is a violation
307 of the idea that mmh is a MUA only.
308 It should become a separate project.
309 But
310 .Pn slocal
311 provides rule-based processing of messages, like filing them into
312 different folders, which is otherwise not available in mmh.
313 Further more,
314 .Pn slocal
315 does neither pull dependencies nor a whole new technical area
316 into the project.
317 (See section XXX for the removing of the ndbm dependency.)
318 Still,
319 .Pn slocal
320 accounts for about 1\|000 lines of code that need to be maintained.
321 As
322 .Pn slocal
323 is almost self-standing, it should be split off into a separate project.
324 This would cut the strong connection between the MUA mmh and the MDA
325 .Pn slocal .
326 The MDA would become an alternative to
327 .I procmail ,
328 as it would no longer be the need to install a complete MH system, too.
329 Likewise, mmh users could decide to use
330 .I procmail
331 without having a second, unused MDA (\c
332 .Pn slocal )
333 installed.
334 That's conceptionally the best solution.
335 Yet,
336 .Pn slocal
337 was not removed.
338 I feel unsure with the removal.
339 Hence, the decision over
340 .Pn slocal
341 is deferred.
342 This does not hurt because
343 .Pn slocal
344 is completely unrelated to the rest of mmh.
347 .H2 "\fLshow\fP and \fPmhshow\fP
348 .P
349 Since the very beginning \(en already in the first concept paper \(en
350 .Pn show
351 had been MH's message display program.
352 .Pn show
353 mapped message numbers and sequences to files and invoked
354 .Pn mhl
355 to have the files formated.
356 For MIME, this approach wasn't sufficient anymore.
357 MIME messages can consist of multiple parts, some of which aren't
358 directly displayable, and text content might be encoded in
359 foreign charsets.
360 .Pn show 's
361 understanding of messages and
362 .Pn mhl 's
363 limited display facilities couldn't cope with the task any longer.
364 .P
365 Instead of extending these tools, additional tools were written from scratch
366 and then added to the MH tool chest. Doing so is encouraged by the
367 tool chest approach. The new tools could be added without interfering
368 with the existing ones.
369 Modular design is a great advantage for extending a system.
370 First, the new MIME features were added in form of the single program
371 .Pn mhn .
372 The command
373 .Cl "mhn -show 42
374 would show the MIME message numbered 42.
375 With the 1.0 release of nmh in February 1999, Richard Coleman finished
376 the split of
377 .Pn mhn
378 into a set of specialized programs, which together covered the
379 multiple aspects of MIME. One of these resulting tools was
380 .Pn mhshow ,
381 which replaced the
382 .Cl "mhn -show
383 call.
384 It was capable to display a MIME message appropriately.
385 .P
386 From then on, two message display tools were part of nmh:
387 .Pn show
388 and
389 .Pn mhshow .
390 Because the user should not need to invoke the right tool
391 whether the message uses MIME or not,
392 .Pn show
393 was extended to automatically hand the job over to
394 .Pn mhshow
395 if displaying the message would be beyond
396 .Pn show 's
397 abilities.
398 In consequence, the user would invoke
399 .Pn show
400 (possibly through
401 .Pn next
402 or
403 .Pn prev )
404 and get the message printed with either
405 .Pn show
406 or
407 .Pn mhshow ,
408 whatever was more appropriate.
409 (There was also a switch for
410 .Pn show
411 to never invoke
412 .Pn mhshow .
413 .Pn show
414 was able to display MIME messages if they contained only a single text
415 part.)
416 .P
417 Having two similar tools for essentially the same task is redundant.
418 The development of both programs needed to be in sync,
419 to ensure that the programs behaved in a similar way,
420 because they were used like a single tool.
421 Different behavior would have surprised the user.
422 .P
423 Today, non-MIME messages are rather seen to be a special case of
424 MIME messages, than MIME messages are seen to be an extension to
425 original email.
426 As
427 .Pn mhshow
428 had already be able to display non-MIME messages, it was natural
429 to drop
430 .Pn show
431 in favor of using
432 .Pn mhshow
433 exclusively.
434 This decision followed the idea of orthogonal design.
435 For convenience,
436 .Pn mhshow
437 was then renamed to
438 .Pn show .
439 .Ci 4c1efddfd499300c7e74263e57d8aa137e84c853
440 .P
441 To prepare for this transition,
442 .Pn mhshow
443 was reworked to behave more like
444 .Pn show
445 first.
446 (Section XXX describes this rework from a different perspective.)
447 Once the tools behaved similar, the replacing became a natural decision.
448 In mmh,
449 .Pn show
450 is the one single message display program again, but it handles
451 MIME messages as well as non-MIME messages.
452 Now, there's only one program to maintain, and users don't need to deal
453 with the existance of two display programs.
454 .P
455 There's one reason why removing the old
456 .Pn show
457 hurts: It had been such a simple program.
458 Its lean elegance is missing to
459 .Pn mhshow ,
460 i.e. the new
461 .Pn show .
462 But there is no chance, because supporting MIME causes essentially
463 higher complexity.
466 .H2 "Removal of Configure Options
467 .P
468 Customization is a double-edged sword.
469 It allows better suiting setups, but not for free.
470 There is the cost of code complexity to be able to customize.
471 There is the cost of less tested setups, because there are
472 more possible setups and especially corner-cases.
473 And, there is the cost of choice itself.
474 The code complexity directly affects the developers.
475 Less tested code affects both, users and developers.
476 The problem of choice affects the users, for once by having to
477 choose, but also by complexer interfaces that require more documentation.
478 Whenever options add little advantages, they should be considered for
479 removal.
480 I have reduced the number of project-specific configure options from
481 fifteen to three.
483 .U3 "Mail Transfer Facilities
484 .P
485 With the removal of the mail transfer facilities five option vanished:
486 .IP \f(CW--with-mts=[smtp|sendmail]\fP
487 Specified the default mail transport service, which now is sendmail always.
488 .IP \f(CW--with-smtpservers=[server1...]\fP
489 Specified the default SMTP servers for the smtp mail transfer service.
490 .Ci 128545e06224233b7e91fc4c83f8830252fe16c9
491 .IP \f(CW--with-cyrus-sasl\fP
492 Enabled SASL support for mail transfer.
493 .IP \f(CW--with-tls\fP
494 Enabled TLS support for mail transfer.
495 .IP \f(CW--enable-pop\fP
496 Enabled the message retrieval facility.
498 .U3 "Backup Prefix
499 .P
500 The backup prefix is the string that was prepended to message
501 filenames to tag them as deleted.
502 By default it had been the comma character `\f(CW,\fP'.
503 In July 2000, Kimmo Suominen introduced
504 the configure option
505 .Sw --with-hash-backup
506 to change the default to the hash symbol `\f(CW#\fP'.
507 The choice was probably personal preference, because first, the
508 option was named
509 .Sw --with-backup-prefix.
510 and had the prefix symbol as argument.
511 Because giving the hash symbol as argument caused to many problems
512 for configure,
513 the option was limited to use the hash symbol as the default prefix.
514 This makes me believe, that the choice for the hash was personal preference.
515 Being it related or not, words that start with the hash symbol
516 introduce a comment in the Unix shell.
517 Thus, the command line
518 .Cl "rm #13 #15
519 calls
520 .Pn rm
521 without arguments because the first hash symbol starts the comment
522 that reaches until the end of the line.
523 To delete the backup files,
524 .Cl "rm ./#13 ./#15"
525 needs to be used.
526 Using the hash as backup prefix can be seen as a precaution agains
527 data loss.
528 .P
529 I removed the configure option but added the profile entry
530 .Pe backup-prefix ,
531 which allows to specify an arbitrary string as backup prefix.
532 .Ci 6c40d481d661d532dd527eaf34cebb6d3f8ed086
533 Profile entries are the common method to change mmh's behavior.
534 This change did not remove the choice but moved it to a location where
535 it suited better.
536 .P
537 Eventually, however, the new trash folder concept
538 .Cf "Sec. XXX
539 obsoleted the concept of the backup prefix completely.
540 .Ci 8edc5aaf86f9f77124664f6801bc6c6cdf258173
541 (Well, there still are corner-cases to remove until the backup
542 prefix can be layed to rest, eventually.)
543 .\" FIXME: Do this work in the code!
545 .U3 "Editor and Pager
546 .P
547 The two configure options
548 .CW --with-editor=EDITOR
549 .CW --with-pager=PAGER
550 were used to specify the default editor and pager at configure time.
551 Doing so at configure time made sense in the Eighties,
552 when the set of available editors and pagers varied much across
553 different systems.
554 Today, the situation is more homegeneic.
555 The programs
556 .Pn vi
557 and
558 .Pn more
559 can be expected to be available on every Unix system,
560 as they are specified by POSIX since two decades.
561 (The specifications for
562 .Pn vi
563 and
564 .Pn more
565 appeared in
566 .[
567 posix 1987
568 .]
569 and,
570 .[
571 posix 1992
572 .]
573 respectively.)
574 As a first step, these two tools were hard-coded as defaults.
575 .Ci 5d43a99db70c12a673028c7758c20cbe3e13ef5f
576 Not changed were the
577 .Pe editor
578 and
579 .Pe moreproc
580 profile entries, which allowed the user to override the system defaults.
581 Later, the concept was reworked to respect the standard environment
582 variables
583 .Ev VISUAL
584 and
585 .Ev PAGER
586 if they are set.
587 Today, mmh determines the editor to use in the following order,
588 taking the first available and non-empty item:
589 .IP (1)
590 Environment variable
591 .Ev MMHEDITOR
592 .IP (2)
593 Profile entry
594 .Pe Editor
595 .IP (3)
596 Environment variable
597 .Ev VISUAL
598 .IP (4)
599 Environment variable
600 .Ev EDITOR
601 .IP (5)
602 Command
603 .Pn vi .
604 .P
605 .Ci f85f4b7ae62e3d05a945dcd46ead51f0a2a89a9b
606 .P
607 The pager to use is deteminded in a similar order,
608 also taking the first available and non-empty item:
609 .IP (1)
610 Environment variable
611 .Ev MMHPAGER
612 .IP (2)
613 Profile entry
614 .Pe Pager
615 (replaces
616 .Pe moreproc )
617 .IP (3)
618 Environment variable
619 .Ev PAGER
620 .IP (4)
621 Command
622 .Pn more .
623 .P
624 .Ci 0c4214ea2aec6497d0d67b436bbee9bc1d225f1e
625 .P
626 By respecting the
627 .Ev VISUAL /\c
628 .Ev EDITOR
629 and
630 .Ev PAGER
631 environment variables,
632 the new behavior confirms better to the common style on Unix systems.
633 Additionally, the new approach is more uniform and clearer to users.
635 .U3 "Locale
636 .P
637 The configure option
638 .Sw --disable-locale
639 was removed because today there's hardly any need to disable locale
640 support.
641 .Ci ccf4f175ef4c4e7522f9510a4a1149c15d810dd9
643 .U3 "ndbm
644 .P
645 .Pn slocal
646 used to depend on
647 .I ndbm ,
648 a database library.
649 The database is used to store the `\fLMessage-ID\fP's of all
650 messages delivered.
651 This enables
652 .Pn slocal
653 to suppress delivering the same message to the same user twice.
654 (This features was enabled by the
655 .Sw -suppressdup
656 switch.)
657 .P
658 A variety of version of the database library exist.
659 .[
660 wolter unix incompat notes dbm
661 .]
662 Complicated autoconf code was needed to detect them correctly.
663 Further more, the configure switches
664 .Sw --with-ndbm=ARG
665 and
666 .Sw --with-ndbmheader=ARG
667 were added to help with difficult setups that would
668 not be detected automatically or correctly.
669 .P
670 By removing the suppress duplicates feature of
671 .Pn slocal ,
672 the dependency on
673 .I ndbm
674 vanished and 120 lines of complex autoconf code could be saved.
675 .Ci ecd6d6a20cb7a1507e3a20d6c4cb3a1cf14c6bbf
676 The change removed funtionality too, but that is minor to the
677 improvement by dropping the dependency and the complex autoconf code.
679 .U3 "mh-e Support
680 .P
681 The configure option
682 .Sw --disable-mhe
683 was removed when the mh-e support was reworked.
684 Mh-e is the Emacs front-end to MH.
685 It requires MH to provide minor additional functions.
686 The
687 .Sw --disable-mhe
688 configure option could switch these extensions off.
689 After removing the support for old versions of mh-e,
690 only the
691 .Sw -build
692 switches of
693 .Pn forw
694 and
695 .Pn repl
696 are left to be mh-e extensions.
697 They are now always built in because they add little code and complexity.
698 In consequence, the
699 .Sw --disable-mhe
700 configure option was removed
701 .Ci a7ce7b4a580d77b6c2c4d980812beb589aa4c643
702 Removing the option removed a second code setup that would have
703 needed to be tested.
704 This change was first done in nmh and thereafter merged into mmh.
705 .P
706 The interface changes in mmh require mh-e to be adjusted in order
707 to be able to use mmh as back-end.
708 This will require minor changes to mh-e, but removing the
709 .Sw -build
710 switches would require more rework.
712 .U3 "Masquerading
713 .P
714 The configure option
715 .Sw --enable-masquerade
716 could take up to three arguments:
717 `draft_from', `mmailid', and `username_extension'.
718 They activated different types of address masquerading.
719 All of them were implemented in the SMTP-speaking
720 .Pn post
721 command, which provided an MSA.
722 Address masquerading is an MTA's task and mmh does not cover
723 this field anymore.
724 Hence, true masquerading needs to be implemented in the external MTA.
725 .P
726 The
727 .I mmailid
728 masquerading type is the oldest one of the three and the only one
729 available in the original MH.
730 It provided a
731 .I username
732 to
733 .I fakeusername
734 mapping, based on the password file's GECOS field.
735 The man page
736 .Mp mh-tailor(5)
737 described the use case as being the following:
738 .QP
739 This is useful if you want the messages you send to always
740 appear to come from the name of an MTA alias rather than your
741 actual account name. For instance, many organizations set up
742 `First.Last' sendmail aliases for all users. If this is
743 the case, the GECOS field for each user should look like:
744 ``First [Middle] Last <First.Last>''
745 .P
746 As mmh sends outgoing mail via the local MTA only,
747 the best location to do such global rewrites is there.
748 Besides, the MTA is conceptionally the right location because it
749 does the reverse mapping for incoming mail (aliasing), too.
750 Further more, masquerading set up there is readily available for all
751 mail software on the system.
752 Hence, mmailid masquerading was removed.
753 .Ci 0836c8000ccb34b59410ef1c15b1b7feac70ce5f
754 .P
755 The
756 .I username_extension
757 masquerading type did not replace the username but would append a suffix,
758 specified by the
759 .Ev USERNAME_EXTENSION
760 environment variable, to it.
761 This provided support for the
762 .I user-extension
763 feature of qmail and the similar
764 .I "plussed user
765 processing of sendmail.
766 The decision to remove this username_extension masquerading was
767 motivated by the fact that
768 .Pn spost
769 hadn't supported it already.
770 .Ci 2abae0bfd0ad5bf898461e50aa4b466d641f23d9
771 Username extensions are possible in mmh, but less convenient to use.
772 .\" XXX format file %(getenv USERNAME_EXTENSION)
773 .P
774 The
775 .I draft_from
776 masquerading type instructed
777 .Pn post
778 to use the value of the
779 .Hd From
780 header field as SMTP envelope sender.
781 Sender addresses could be replaced completely.
782 .Ci b14ea6073f77b4359aaf3fddd0e105989db9
783 Mmh offers a kind of masquerading similar in effect, but
784 with technical differences.
785 As mmh does not transfer messages itself, the local MTA has final control
786 over the sender's address. Any masquerading mmh introduces may be reverted
787 by the MTA.
788 In times of pedantic spam checking, an MTA will take care to use
789 sensible envelope sender addresses to keep its own reputation up.
790 Nonetheless, the MUA can set the
791 .Hd From
792 header field and thereby propose
793 a sender address to the MTA.
794 The MTA may then decide to take that one or generate the canonical sender
795 address for use as envelope sender address.
796 .P
797 In mmh, the MTA will always extract the recipient and sender from the
798 message header (\c
799 .Pn sendmail 's
800 .Sw -t
801 switch).
802 The
803 .Hd From
804 header field of the draft may be set arbitrary by the user.
805 If it is missing, the canonical sender address will be generated by the MTA.
807 .U3 "Remaining Options
808 .P
809 Two configure options remain in mmh.
810 One is the locking method to use:
811 .Sw --with-locking=[dot|fcntl|flock|lockf] .
812 The idea of removing all methods except the portable dot locking
813 and having that one as the default is appealing, but this change
814 requires deeper technical investigation into the topic.
815 The other option,
816 .Sw --enable-debug ,
817 compiles the programs with debugging symbols and does not strip them.
818 This option is likely to stay.
823 .H2 "Removal of switches
824 .P
829 .H1 "Modernizing
832 .H2 "Removal of Code Relicts
833 .P
834 The code base of mmh originates from the late Seventies,
835 had been extensively
836 worked on in the mid Eighties, and had been partly reorganized and extended
837 in the Nineties. Relicts of all those times had gathered in the code base.
838 My goal was to remove any ancient code parts. One part of the task was
839 converting obsolete code constructs to standard constructs, the other part
840 was dropping obsolete functions.
841 .P
842 As I'm not even thirty years old and have no more than seven years of
843 Unix experience, I needed to learn about the history in retrospective.
844 Older people likely have used those ancient constructs themselves
845 and have suffered from their incompatibilities and have longed for
846 standardization. Unfortunately, I have only read that others had done so.
847 This put me in a much more difficult positions when working on the old
848 code. I needed to recherche what other would have known by heart from
849 experience. All my programming experience comes from a time past ANSI C
850 and past POSIX. Although I knew about the times before, I took the
851 current state implicitly for granted most of the time.
852 .P
853 Being aware of
854 these facts, I rather let people with more historic experience solve the
855 task of converting the ancient code constructs to standardized ones.
856 Luckily, Lyndon Nerenberg focused on this task at the nmh project.
857 He converted large parts of the code to POSIX constructs, removing
858 the conditionals compilation for now standardized features.
859 I'm thankful for this task being solved. I only pulled the changes into
860 mmh.
861 .P
862 The other task \(en dropping ancient functionality to remove old code \(en
863 I did myself, though. My position to strip mmh to the bare minimum of
864 frequently used features is much more revolutional than the nmh community
865 likes it. Without the need to justify my decisions, I was able to quickly
866 remove functionality I considered ancient.
867 The need to discuss my decisions with
868 peers likely would have slowed this process down. Of course, I researched
869 if a particular feature really should be dropped. Having not had any
870 contact to this feature within my computer life was a first indicator to
871 drop it, but I also asked others and searched the literature for modern
872 usage of the feature. If it appeared to be truly ancient, I dropped it.
873 The reason for dropping is always part of the commit message in the
874 version control system. Thus, it is easy for others to check their
875 view on the topic with mine and possibly to argue for reinclusion.
877 .U2 "MMDF maildrop support
878 .P
879 I did drop any support for the MMDF maildrop format. This type of format
880 is conceptionally similar to the mbox format, but uses four bytes with
881 value 1 (\fL^A^A^A^A\fP) as message delimiter,
882 instead of the string ``\fLFrom\ \fP''.
883 Due to the similarity and mbox being the de-facto standard maildrop
884 format on Unix, but also due to the larger influence of Sendmail than MMDF,
885 the MMDF maildrop format had vanished.
886 .P
887 The simplifications within the code were only moderate. Switches could
888 be removed from tools like
889 .L packf ,
890 which generate packed mailboxes. Only one packed mailbox format remained:
891 mbox.
892 The most important changes affect the equally named mail parsing routine in
893 .L sbr/m_getfld.c .
894 The direct MMDF code had been removed, but as now only one packed mailbox
895 format is left, code structure simplifications are likely possible.
896 The reason why they are still outstanding is the heavily optimized code
897 of
898 .Fu m_getfld() .
899 Changes beyond a small local scope \(en
900 which restructuring in its core is \(en cause a high risk of damaging
901 the intricate workings of the optimized code. This problem is know
902 to the developers of nmh, too. They also avoid touching this minefield
903 if possible.
905 .U2 "UUCP Bang Paths
906 .P
907 More questionably than the former topic is the removal of support for the
908 UUCP bang path address style. However, the user may translate the bang
909 paths on retrieval to Internet addresses and the other way on posting
910 messages. The former can be done my an MDA like procmail; the latter
911 by a sendmail wrapper. This would ensure that any address handling would
912 work as expected. However, it might just work well without any
913 such modifications, as mmh does not touch addresses much, in general.
914 But I can't ensure as I have never used an environment with bang paths.
915 Also, the behavior might break at any point in further development.
917 .U2 "Hardcopy terminal support
918 .P
919 More of a funny anecdote is the remaining of a check for printing to a
920 hardcopy terminal until Spring 2012, when I finally removed it.
921 I surely would be very happy to see such a terminal in action, maybe
922 actually being able to work on it, but I fear my chances are null.
923 .P
924 The check only prevented a pager to be placed between the outputting
925 program (\c
926 .Pn mhl )
927 and the terminal. This could have been ensured with
928 the
929 .Sw -nomoreproc
930 at the command line statically, too.
932 .U2 "Removed support for header fields
933 .P
934 The
935 .Hd Encrypted
936 header field had been introduced by RFC\^822, but already
937 marked legacy in RFC 2822. It was superseded by FIXME.
938 Mmh does no more support this header field.
939 .P
940 Native support for
941 .Hd Face
942 header fields had been removed, as well.
943 The feature is similar to the
944 .Hd X-Face
945 header field in its intent,
946 but takes a different approach to store the image.
947 Instead of encoding the image data directly into the header field,
948 the it contains the hostname and UDP port where the image
949 date could be retrieved.
950 Neither
951 .Hd X-Face
952 nor the here described
953 .Hd Face
954 system
955 \**
956 .FS
957 There is also a newer but different system, invented 2005,
958 using
959 .Hd Face
960 headers.
961 It is the successor of
962 .Hd X-Face
963 providing colored PNG images.
964 .FE
965 became well used in the large scale.
966 It's still possible to use a Face systems,
967 although mmh does not provide support for any of the different systems
968 anymore. It's fairly easy to write a small shell script to
969 extract the embedded or fetch the external Face data and display the image.
970 Own
971 .Hd Face
972 header field can be added into the draft template files.
973 .P
974 .Hd Content-MD5
975 header fields were introduced by RFC\^1864. They provide only
976 a verification of data corruption during the transfer. By no means can
977 they ensure verbatim end-to-end delivery of the contents. This is clearly
978 stated in the RFC. The proper approach to provide verificationability
979 of content in an end-to-end relationship is the use of digital cryptography
980 (RFCs FIXME). On the other hand, transfer protocols should ensure the
981 integrity of the transmission. In combinations these two approaches
982 make the
983 .Hd Content-MD5
984 header field useless. In consequence, I removed
985 the support for it. By this removal, MD5 computation is not needed
986 anywhere in mmh. Hence, over 500 lines of code were removed by this one
987 change. Even if the
988 .Hd Content-MD5
989 header field is useful sometimes,
990 I value its usefulnes less than the improvement in maintainability, caused
991 by the removal.
993 .U2 "Prompter's Control Keys
994 .P
995 The program
996 .Pn prompter
997 queries the user to fill in a message form. When used by
998 .Pn comp
999 as:
1000 .VS
1001 comp -editor prompter
1002 VE
1003 the resulting behavior is similar to
1004 .Pn mailx .
1005 Apparently,
1006 .Pn prompter
1007 hadn't been touched lately. Otherwise it's hardly explainable why it
1008 still offered the switches
1009 .Sw -erase
1010 .Ar chr
1011 and
1012 .Sw -kill
1013 .Ar chr
1014 to name the characters for command line editing.
1015 The times when this had been necessary are long time gone.
1016 Today these things work out-of-the-box, and if not, are configured
1017 with the standard tool
1018 .Pn stty .
1020 .U2 "Vfork and Retry Loops
1021 .P
1022 MH creates many processes, which is a consequence of the tool chest approach.
1023 In earlier times
1024 .Fu fork()
1025 had been an expensive system call, as the process's whole image needed
1026 to be duplicated. One common case is replacing the image with
1027 .Fu exec()
1028 right after having forked the child process.
1029 To speed up this case, the
1030 .Fu vfork()
1031 system call was invented at Berkeley. It completely omits copying the
1032 image. If the image gets replaced right afterwards then unnecessary
1033 work is omited. On old systems this results in large speed ups.
1034 MH uses
1035 .Fu vfork()
1036 whenever possible.
1037 .P
1038 Memory management units that support copy-on-write semantics make
1039 .Fu fork()
1040 almost as fast as
1041 .Fu vfork()
1042 in the cases when they can be exchanged.
1043 With
1044 .Fu vfork()
1045 being more error-prone and hardly faster, it's preferable to simply
1046 use
1047 .Fu fork()
1048 instead.
1049 .P
1050 Related to the costs of
1051 .Fu fork()
1052 is the probability of its success.
1053 Today on modern systems, the system call will succeed almost always.
1054 In the Eighties on heavy loaded systems, as they were common at
1055 universities, this had been different. Thus, many of the
1056 .Fu fork()
1057 calls were wrapped into loops to retry to fork several times in
1058 short intervals, in case of previous failure.
1059 In mmh, the program aborts at once if the fork failed.
1060 The user can reexecute the command then. This is expected to be a
1061 very rare case on modern systems, especially personal ones, which are
1062 common today.
1065 .H2 "Attachments
1066 .P
1067 MIME
1070 .H2 "Digital Cryptography
1071 .P
1072 Signing and encryption.
1075 .H2 "Good Defaults
1076 .P
1077 foo
1082 .H1 "Code style
1083 .P
1084 foo
1087 .H2 "Standard Code
1088 .P
1089 POSIX
1092 .H2 "Separation
1094 .U2 "MH Directory Split
1095 .P
1096 In MH and nmh, a personal setup had consisted of two parts:
1097 The MH profile, named
1098 .Fn \&.mh_profile
1099 and being located directly in the user's home directory.
1100 And the MH directory, where all his mail messages and also his personal
1101 forms, scan formats, other configuration files are stored. The location
1102 of this directory could be user-chosen. The default was to name it
1103 .Fn Mail
1104 and have it directly in the home directory.
1105 .P
1106 I've never liked the data storage and the configuration to be intermixed.
1107 They are different kinds of data. One part, are the messages,
1108 which are the data to operate on. The other part, are the personal
1109 configuration files, which are able to change the behavior of the operations.
1110 The actual operations are defined in the profile, however.
1111 .P
1112 When storing data, one should try to group data by its type.
1113 There's sense in the Unix file system hierarchy, where configuration
1114 file are stored separate (\c
1115 .Fn /etc )
1116 to the programs (\c
1117 .Fn /bin
1118 and
1119 .Fn /usr/bin )
1120 to their sources (\c
1121 .Fn /usr/src ).
1122 Such separation eases the backup management, for instance.
1123 .P
1124 In mmh, I've reorganized the file locations.
1125 Still there are two places:
1126 There's the mail storage directory, which, like in MH, contains all the
1127 messages, but, unlike in MH, nothing else.
1128 Its location still is user-chosen, with the default name
1129 .Fn Mail ,
1130 in the user's home directory. This is much similar to the case in nmh.
1131 The configuration files, however, are grouped together in the new directory
1132 .Fn \&.mmh
1133 in the user's home directory.
1134 The user's profile now is a file, named
1135 .Fn profile ,
1136 in this mmh directory.
1137 Consistently, the context file and all the personal forms, scan formats,
1138 and the like, are also there.
1139 .P
1140 The naming changed with the relocation.
1141 The directory where everything, except the profile, had been stored (\c
1142 .Fn $HOME/Mail ),
1143 used to be called \fIMH directory\fP. Now, this directory is called the
1144 user's \fImail storage\fP. The name \fImmh directory\fP is now given to
1145 the new directory
1146 (\c
1147 .Fn $HOME/.mmh ),
1148 containing all the personal configuration files.
1149 .P
1150 The separation of the files by type of content is logical and convenient.
1151 There are no functional differences as any possible setup known to me
1152 can be implemented with both approaches, although likely a bit easier
1153 with the new approach. The main goal of the change had been to provide
1154 sensible storage locations for any type of personal mmh file.
1155 .P
1156 In order for one user to have multiple MH setups, he can use the
1157 environment variable
1158 .Ev MH
1159 the point to a different profile file.
1160 The MH directory (mail storage plus personal configuration files) is
1161 defined by the
1162 .Pe Path
1163 profile entry.
1164 The context file could be defined by the
1165 .Pe context
1166 profile entry or by the
1167 .Ev MHCONTEXT
1168 environment variable.
1169 The latter is useful to have a distinct context (e.g. current folders)
1170 in each terminal window, for instance.
1171 In mmh, there are three environment variables now.
1172 .Ev MMH
1173 may be used to change the location of the mmh directory.
1174 .Ev MMHP
1175 and
1176 .Ev MMHC
1177 change the profile and context files, respectively.
1178 Besides providing a more consistent feel (which simply is the result
1179 of being designed anew), the set of personal configuration files can
1180 be chosen independently from the profile (including mail storage location)
1181 and context, now. Being it relevant for practical use or not, it
1182 de-facto is an improvement. However, the main achievement is the
1183 split between mail storage and personal configuration files.
1186 .H2 "Modularization
1187 .P
1188 whatnowproc
1189 .P
1190 The \fIMH library\fP
1191 .Fn libmh.a
1192 collects a bunch of standard functions that many of the MH tools need,
1193 like reading the profile or context files.
1194 This doesn't hurt the separation.
1197 .H2 "Style
1198 .P
1199 Code layout, goto, ...
1204 .H1 "Concept Exploitation/Homogeniety
1207 .H2 "Draft Folder
1208 .P
1209 Historically, MH provided exactly one draft message, named
1210 .Fn draft
1211 and
1212 being located in the MH directory. When starting to compose another message
1213 before the former one was sent, the user had been questioned whether to use,
1214 refile or replace the old draft. Working on multiple drafts at the same time
1215 was impossible. One could only work on them in alteration by refiling the
1216 previous one to some directory and fetching some other one for reediting.
1217 This manual draft management needed to be done each time the user wanted
1218 to switch between editing one draft to editing another.
1219 .P
1220 To allow true parallel editing of drafts, in a straight forward way, the
1221 draft folder facility exists. It had been introduced already in July 1984
1222 by Marshall T. Rose. The facility was deactivated by default.
1223 Even in nmh, the draft folder facility remained deactivated by default.
1224 At least, Richard Coleman added the man page
1225 .Mp mh-draft(5)
1226 to document
1227 the feature well.
1228 .P
1229 The only advantage of not using the draft folder facility is the static
1230 name of the draft file. This could be an issue for MH frontends like mh-e.
1231 But as they likely want to provide working on multiple drafts in parallel,
1232 the issue is only concerning compatibility. The aim of nmh to stay compatible
1233 prevented the default activation of the draft folder facility.
1234 .P
1235 On the other hand, a draft folder is the much more natural concept than
1236 a draft message. MH's mail storage consists of folders and messages,
1237 the messages named with ascending numbers. A draft message breaks with this
1238 concept by introducing a message in a file named
1239 .Fn draft .
1240 This draft
1241 message is special. It can not be simply listed with the available tools,
1242 but instead requires special switches. I.e. corner-cases were
1243 introduced. A draft folder, in contrast, does not introduce such
1244 corner-cases. The available tools can operate on the messages within that
1245 folder like on any messages within any mail folders. The only difference
1246 is the fact that the default folder for
1247 .Pn send
1248 is the draft folder,
1249 instead of the current folder, like for all other tools.
1250 .P
1251 The trivial part of the change was activating the draft folder facility
1252 by default and setting a default name for this folder. Obviously, I chose
1253 the name
1254 .Fn +drafts .
1255 This made the
1256 .Sw -draftfolder
1257 and
1258 .Sw -draftmessage
1259 switches useless, and I could remove them.
1260 The more difficult but also the part that showed the real improvement,
1261 was updating the tools to the new concept.
1262 .Sw -draft
1263 switches could
1264 be dropped, as operating on a draft message became indistinguishable to
1265 operating on any other message for the tools.
1266 .Pn comp
1267 still has its
1268 .Sw -use
1269 switch for switching between its two modes: (1) Compose a new
1270 draft, possibly by taking some existing message as a form. (2) Modify
1271 an existing draft. In either case, the behavior of
1272 .Pn comp is
1273 deterministic. There is no more need to query the user. I consider this
1274 a major improvement. By making
1275 .Pn send
1276 simply operate on the current
1277 message in the draft folder by default, with message and folder both
1278 overridable by specifying them on the command line, it is now possible
1279 to send a draft anywhere within the storage by simply specifying its folder
1280 and name.
1281 .P
1282 All theses changes converted special cases to regular cases, thus
1283 simplifying the tools and increasing the flexibility.
1286 .H2 "Trash Folder
1287 .P
1288 Similar to the situation for drafts is the situation for removed messages.
1289 Historically, a message was deleted by renaming. A specific
1290 \fIbackup prefix\fP, often comma (\c
1291 .Fn , )
1292 or hash (\c
1293 .Fn # ),
1294 being prepended to the file name. Thus, MH wouldn't recognize the file
1295 as a message anymore, as only files whose name consists of digits only
1296 are treated as messages. The removed messages remained as files in the
1297 same directory and needed some maintenance job to truly delete them after
1298 some grace time. Usually, by running a command similar to
1299 .VS
1300 find /home/user/Mail -ctime +7 -name ',*' | xargs rm
1301 VE
1302 in a cron job. Within the grace time interval
1303 the original message could be restored by stripping the
1304 the backup prefix from the file name. If however, the last message of
1305 a folder is been removed \(en say message
1306 .Fn 6
1307 becomes file
1308 .Fn ,6
1309 \(en and a new message enters the same folder, thus the same
1310 numbered being given again \(en in our case
1311 .Fn 6
1312 \(en, if that one
1313 is removed too, then the backup of the former message gets overwritten.
1314 Thus, the ability to restore removed messages does not only depend on
1315 the ``sweeping cron job'' but also on the removing of further messages.
1316 This is undesirable, because the real mechanism is hidden from the user
1317 and the consequences of further removals are not always obvious.
1318 Further more, the backup files are scattered within the whole mail
1319 storage, instead of being collected at one place.
1320 .P
1321 To improve the situation, the profile entry
1322 .Pe rmmproc
1323 (previously named
1324 .Pe Delete-Prog )
1325 was introduced, very early.
1326 It could be set to any command, which would care for the mail removal
1327 instead of taking the default action, described above.
1328 Refiling the to-be-removed files to some garbage folder was a common
1329 example. Nmh's man page
1330 .Mp rmm(1)
1331 proposes
1332 .Cl "refile +d
1333 to move messages to the garbage folder and
1334 .Cl "rm `mhpath +d all`
1335 the empty the garbage folder.
1336 Managing the message removal this way is a sane approach. It keeps
1337 the removed messages in one place, makes it easy to remove the backup
1338 files, and, most important, enables the user to use the tools of MH
1339 itself to operate on the removed messages. One can
1340 .Pn scan
1341 them,
1342 .Pn show
1343 them, and restore them with
1344 .Pn refile .
1345 There's no more
1346 need to use
1347 .Pn mhpath
1348 to switch over from MH tools to Unix tools \(en MH can do it all itself.
1349 .P
1350 This approach matches perfect with the concepts of MH, thus making
1351 it powerful. Hence, I made it the default. And even more, I also
1352 removed the old backup prefix approach, as it is clearly less powerful.
1353 Keeping unused alternative in the code is a bad choice as they likely
1354 gather bugs, by not being constantly tested. Also, the increased code
1355 size and more conditions crease the maintenance costs. By strictly
1356 converting to the trash folder approach, I simplified the code base.
1357 .Pn rmm
1358 calls
1359 .Pn refile
1360 internally to move the to-be-removed
1361 message to the trash folder (\c
1362 .Fn +trash
1363 by default). Messages
1364 there can be operated on like on any other message in the storage.
1365 The sweep clean, one can use
1366 .Cl "rmm -unlink +trash a" ,
1367 where the
1368 .Sw -unlink
1369 switch causes the files to be truly unliked instead
1370 of moved to the trash folder.
1373 .H2 "Path Notations
1374 .P
1375 foo
1378 .H2 "MIME Integration
1379 .P
1380 user-visible access to whole messages and MIME parts are inherently
1381 different
1384 .H2 "Of One Cast
1385 .P