docs/master

annotate ch03.roff @ 64:a0b678a9b583

style: Don't change PO for nroff.
author markus schnalke <meillo@marmaro.de>
date Fri, 01 Jun 2012 22:57:10 +0200
parents 24aabbfe5794
children 4c9f4d05d90e
rev   line source
meillo@58 1 .H0 "Discussion
meillo@0 2 .P
meillo@58 3 This main chapter discusses the practical work done in the mmh project.
meillo@58 4 It is structured along the goals to achieve. The concrete work done
meillo@58 5 is described in the examples of how the general goals were achieved.
meillo@58 6
meillo@58 7
meillo@58 8
meillo@58 9
meillo@58 10 .H1 "Stream-lining
meillo@58 11
meillo@0 12 .P
meillo@58 13 MH had been considered an all-in-one system for mail handling.
meillo@58 14 The community around nmh has a similar understanding.
meillo@58 15 In fundamental difference, I believe that mmh should be a MUA but
meillo@58 16 nothing more. I believe that all-in-one mail systems are not the way
meillo@58 17 to go. There are excellent specialized MTAs, like Postfix;
meillo@58 18 there are specialized MDAs, like Procmail; there are specialized
meillo@58 19 MRAs, like Fetchmail. I believe it's best to use them instead of
meillo@58 20 providing the same function ourselves. Doing something well requires to
meillo@58 21 focus on this particular aspect or a small set of aspects. The more
meillo@58 22 it is possible to focus, the better the result in this particular
meillo@58 23 area will be. The limiting resource in Free Software community development
meillo@58 24 usually is human power. If the low development power is even parted
meillo@58 25 into multiple development areas, it will hardly be possible to
meillo@58 26 compete with the specialists in the various fields. This is even
meillo@58 27 increased, given the small community \(en developers and users \(en
meillo@58 28 that MH-based mail systems have. In consequence, I believe that the
meillo@58 29 available resources should be concentrated at the point where MH is
meillo@58 30 most unique. This is clearly the MUA part.
meillo@58 31 .P
meillo@60 32 The goal for mmh was to remove peripheral parts and stream-line
meillo@60 33 it for the MUA task.
meillo@60 34
meillo@60 35
meillo@60 36 .H2 "Removal of Mail Transfer Facilities
meillo@60 37 .P
meillo@60 38 In contrast to nmh, which also provides mail submission and mail retrieval
meillo@60 39 facilities, mmh is a MUA only.
meillo@60 40 .P
meillo@60 41 The MSA is called ``Message Transfer Service'' (MTS) in nmh.
meillo@60 42 The facility establishes TCP/IP connections and speaks SMTP to submit
meillo@60 43 messages for relay to the outside world.
meillo@60 44 This part is implemented in the
meillo@60 45 .Pn post
meillo@60 46 command.
meillo@60 47 Demanded by the changes in
meillo@60 48 emailing, this part of nmh required changes in the last years.
meillo@60 49 Encrypted connections needed to be supported, hence SASL was introduced
meillo@60 50 into nmh. This added complexity to the nmh without improving it in
meillo@60 51 its core functions. Also, keeping up with recent developments in
meillo@60 52 this field needs requires development power and specialists.
meillo@60 53 Mmh cuts this whole facility off and depends on an external MTA instead.
meillo@60 54 The only outgoing interface available to mmh is the
meillo@60 55 .Pn sendmail
meillo@60 56 command.
meillo@60 57 Almost any MTA provides a
meillo@60 58 .Pn sendmail
meillo@60 59 command.
meillo@60 60 It not, any program can be substituted if it reads the
meillo@60 61 message from the standard input, extracts the recipient addresses
meillo@60 62 from the message header and does not conflict
meillo@60 63 with sendmail-specific command line arguments.
meillo@60 64 .P
meillo@60 65 To retrieve mail, the
meillo@60 66 .Pn inc
meillo@60 67 command in nmh has the ability to establish TCP/IP connections
meillo@60 68 and speaks POP3 to retrieve mail from remote servers.
meillo@60 69 As with mail submission, here encrypted connections are required
meillo@60 70 today, thus SASL support was added.
meillo@60 71 As POP3 is superseded by IMAP more and more, support for message
meillo@60 72 retrieval through IMAP will become necessary to be added soon.
meillo@60 73 Mmh has no support for retrieving mail from remote locations.
meillo@60 74 It depends on an external tool to cover this task.
meillo@60 75 There are two ways for messages to enter mmh's mail storage:
meillo@60 76 Incorporate them with
meillo@60 77 .Pn inc
meillo@60 78 from the system maildrop, or with
meillo@60 79 .Pn rcvstore
meillo@60 80 from the standard input.
meillo@60 81 .P
meillo@60 82 In consequence, mmh includes neither networking nor SASL code anymore.
meillo@60 83 Two large separate functional units are removed.
meillo@60 84 They account for about XXX lines of code and XXX libraries.
meillo@60 85 .P
meillo@60 86 With the removal of the MSA and MRA, mmh converted from an all-in-one
meillo@60 87 mail system to the core: the MUA.
meillo@60 88 Following the Unix philosophy, it focuses on one job and to do that well.
meillo@60 89 Now, of course, mmh depends on third-party software.
meillo@60 90 An external MTA/MSA is required to transfer mail to the outside world;
meillo@60 91 an external MRA is required to retrieve mail from remote machines.
meillo@60 92 There exist excellent implementations of such software,
meillo@60 93 which do this specific task likely much better than the internal
meillo@60 94 versions of nmh do it. Also, this provides the choice for the best
meillo@60 95 suiting one of the available implementation.
meillo@60 96 .P
meillo@60 97 As it had already been possible to use an external MSA or MRA,
meillo@60 98 why not keep the internal version for convenience?
meillo@60 99 If this would question the sense in having a fall-back pager in all
meillo@60 100 the command line tools, in case
meillo@60 101 .Pn more
meillo@60 102 or
meillo@60 103 .Pn less
meillo@60 104 wouldn't be available, the answer is intuitively seen.
meillo@60 105 Now, an MSA or MRA is clearly more complex than a text pager, but
meillo@60 106 still the concept holds: If programs become complex, split them;
meillo@60 107 if projects become complex, split them.
meillo@60 108 Complexity is demanded by the problem to solve. Decades ago,
meillo@60 109 emailing had been small and simple.
meillo@60 110 (Remember,
meillo@60 111 .Pn /bin/mail
meillo@60 112 had once covered anything there was to email.)
meillo@60 113 As the complexity in emailing increased, MH remainded mostly unchanged.
meillo@60 114 Nontheless, in nmh the POP server, which the original MH had included,
meillo@60 115 was removed. Now is the time to take one step further and remove
meillo@60 116 the MSA and MRA.
meillo@60 117 Not only does it decrease the code amount of the project,
meillo@60 118 but more important, it removes the whole field of message transfer
meillo@60 119 with all its implications from the project.
meillo@60 120 .P
meillo@60 121 Users of MH are usually able to set up an external MSA and MRA.
meillo@60 122 Also, the popular MSAs and MRAs have large communities and a lot
meillo@60 123 of documentation available.
meillo@60 124 .P
meillo@60 125 Choices for MSAs range from the full-featured
meillo@60 126 .I Postfix
meillo@60 127 over mid-size solutions like
meillo@60 128 .I masqmail
meillo@60 129 and
meillo@60 130 .I dma
meillo@60 131 to small forwarders like
meillo@60 132 .I ssmtp
meillo@60 133 and
meillo@60 134 .I nullmailer .
meillo@60 135 Choices for MRAs include
meillo@60 136 .I fetchmail ,
meillo@60 137 .I getmail ,
meillo@60 138 .I mpop
meillo@60 139 and
meillo@60 140 .I fdm .
meillo@60 141
meillo@60 142
meillo@60 143 .H2 "Removal of non-MUA Tools
meillo@60 144 .P
meillo@62 145 Some of nmh's tools were removed from mmh because they didn't
meillo@58 146 match the main focus of adding to the MUA's task.
meillo@62 147 .BU
meillo@58 148 .Pn conflict
meillo@58 149 was removed because it is a mail system maintenance tool.
meillo@62 150 Besides, it even checks
meillo@58 151 .Fn /etc/passwd
meillo@58 152 and
meillo@58 153 .Fn /etc/group
meillo@62 154 for consistency, which has nothing at all to do with emailing.
meillo@58 155 The tool might be useful, but it should not be shipped with mmh.
meillo@62 156 .BU
meillo@58 157 .Pn rcvtty
meillo@58 158 was removed because its usecase of writing to the user's terminal
meillo@58 159 on receiving of mail is hardly wanted today. If users like to be
meillo@58 160 informed of new mail, then using the shell's
meillo@58 161 .Ev MAILPATH
meillo@62 162 variable or graphical notifications are likely more
meillo@62 163 appealing.
meillo@62 164 Writing directly to a terminals is hardly ever wanted today.
meillo@62 165 If though one wants to have it this way, the standard tool
meillo@58 166 .Pn write
meillo@58 167 can be used in a way similar to:
meillo@58 168 .DS
meillo@58 169 scan -file - | write `id -un`
meillo@58 170 .DE
meillo@62 171 .BU
meillo@58 172 .Pn viamail
meillo@62 173 was removed when the new attachment system was introduced, because
meillo@58 174 .Pn forw
meillo@62 175 could can now the task itself.
meillo@62 176 The program
meillo@58 177 .Pn sendfiles
meillo@62 178 was rewritten as a shell script wrapper around
meillo@58 179 .Pn forw .
meillo@62 180 .BU
meillo@58 181 .Pn msgchk
meillo@62 182 was removed, because it lost its usefulness when POP support was removed.
meillo@58 183 .Pn msgchk
meillo@62 184 provides hardly more information than:
meillo@58 185 .DS
meillo@58 186 ls -l /var/mail/meillo
meillo@58 187 .DE
meillo@62 188 It does separate between old and new mail, but that's merely a detail
meillo@62 189 and can be done with
meillo@58 190 .Pn stat (1)
meillo@62 191 too.
meillo@62 192 A very small shell script could be written to output the information
meillo@62 193 in a convenient way, if truly necessary.
meillo@58 194 As mmh's inc only incorporates mail from the user's local maildrop
meillo@62 195 and thus no data transfers over slow networks are involved,
meillo@62 196 there's hardly need to check for new mail before incorporating it.
meillo@62 197 .BU
meillo@58 198 .Pn msh
meillo@62 199 was removed because the tool was in conflict with the
meillo@58 200 philosophy of MH. It provided an interactive shell to access the
meillo@58 201 features of MH. One major feature of MH is being a tool chest.
meillo@58 202 .Pn msh
meillo@58 203 wouldn't be just another shell, tailored to the needs of mail
meillo@58 204 handling, but one large program to have the MH tools built in.
meillo@58 205 It's main use was for accessing Bulletin Boards, which have seized to
meillo@62 206 be popular.
meillo@62 207 .P
meillo@62 208 Removing
meillo@58 209 .Pn msh ,
meillo@62 210 together with the truly obsolete code relicts
meillo@58 211 .Pn vmh
meillo@58 212 and
meillo@58 213 .Pn wmh ,
meillo@62 214 saved more than 7\|000 lines of C code \(en
meillo@63 215 about 15\|% of the project's source code amount.
meillo@63 216 Having the same functionality in less code (with equal readability,
meillo@63 217 of course) is an advantage.
meillo@63 218 Less code means less bugs and less maintenance work.
meillo@63 219 If
meillo@63 220 .Pn rcvtty
meillo@63 221 and
meillo@63 222 .Pn msgchk
meillo@63 223 are rarely used and can be implemented in different ways,
meillo@63 224 then why should one keep them?
meillo@63 225 .Pn viamail 's
meillo@63 226 use case is now partly obsolete and partly covered by
meillo@63 227 .Pn forw ,
meillo@63 228 hence there's no reason to still have
meillo@63 229 .Pn viamail
meillo@63 230 around.
meillo@63 231 .Pn conflict
meillo@63 232 is not related with the mail client, and
meillo@63 233 .Pn msh
meillo@63 234 conflicts with the basic concept of MH.
meillo@63 235 Both tools could still be useful, but not as part of mmh.
meillo@63 236 .P
meillo@63 237 It is a design goal of mmh to remove those parts that are rarely used.
meillo@63 238 The project shall become more stream-lined.
meillo@63 239 Rarely used and loosely related tools distract from the lean appearance.
meillo@63 240 They require maintenance cost without adding to the core task.
meillo@63 241 Therefore they were removed.
meillo@0 242
meillo@58 243
meillo@62 244 .H2 "Merge of \f(CWshow\fP and \f(CWmhshow\fP
meillo@58 245 .P
meillo@58 246 Since the very beginning, already in the first concept paper,
meillo@58 247 .Pn show
meillo@62 248 had been MH's message display program.
meillo@58 249 .Pn show
meillo@58 250 found out which pathnames the relevant messages had and invoked
meillo@58 251 .Pn mhl
meillo@62 252 then to have the content formated.
meillo@58 253 With the advent of MIME, this approach wasn't sufficient anymore.
meillo@58 254 MIME messages can consist of multiple parts, some of which aren't
meillo@62 255 directly displayable, and text content might be encoded in
meillo@58 256 foreign charsets.
meillo@58 257 .Pn show 's
meillo@58 258 simple approach and
meillo@58 259 .Pn mhl 's
meillo@58 260 limited display facilities couldn't cope with the task any longer.
meillo@62 261 .P
meillo@58 262 Instead of extending these tools, new ones were written from scratch
meillo@58 263 and then added to the MH tool chest. Doing so is encouraged by the
meillo@58 264 tool chest approach. The new tools could be added without interfering
meillo@62 265 with the existing ones. This is great. The ease of adding new tools
meillo@62 266 even made MH the first MUA to implement MIME.
meillo@58 267 .P
meillo@62 268 First, the new MIME features were added in form of the single program
meillo@58 269 .Pn mhn .
meillo@58 270 The command
meillo@62 271 .Cl "mhn \-show 42
meillo@58 272 would show the MIME message numbered 42.
meillo@58 273 With the 1.0 release of nmh in February 1999, Richard Coleman finished
meillo@58 274 the split of
meillo@58 275 .Pn mhn
meillo@58 276 into a set of specialized programs, which together covered the
meillo@62 277 multiple aspects of MIME. One of these resulting tools was
meillo@58 278 .Pn mhshow .
meillo@62 279 .Pn mhshow
meillo@62 280 resembled the
meillo@62 281 .Cl "mhn \-show
meillo@62 282 call.
meillo@62 283 .P
meillo@58 284
meillo@58 285
meillo@58 286 .H2 "Removal of Configure Options
meillo@58 287 .P
meillo@58 288
meillo@63 289
meillo@58 290 .H2 "Removal of switches
meillo@58 291 .P
meillo@58 292
meillo@58 293
meillo@58 294
meillo@58 295
meillo@58 296 .H1 "Moderizing
meillo@58 297
meillo@58 298
meillo@58 299 .H2 "Removal of Code Relicts
meillo@0 300 .P
meillo@51 301 The code base of mmh originates from the late Seventies,
meillo@51 302 had been extensively
meillo@51 303 worked on in the mid Eighties, and had been partly reorganized and extended
meillo@51 304 in the Nineties. Relicts of all those times had gathered in the code base.
meillo@12 305 My goal was to remove any ancient code parts. One part of the task was
meillo@12 306 converting obsolete code constructs to standard constructs, the other part
meillo@12 307 was dropping obsolete functions.
meillo@12 308 .P
meillo@12 309 As I'm not even thirty years old and have no more than seven years of
meillo@51 310 Unix experience, I needed to learn about the history in retrospective.
meillo@51 311 Older people likely have used those ancient constructs themselves
meillo@51 312 and have suffered from their incompatibilities and have longed for
meillo@12 313 standardization. Unfortunately, I have only read that others had done so.
meillo@12 314 This put me in a much more difficult positions when working on the old
meillo@12 315 code. I needed to recherche what other would have known by heart from
meillo@12 316 experience. All my programming experience comes from a time past ANSI C
meillo@12 317 and past POSIX. Although I knew about the times before, I took the
meillo@51 318 current state implicitly for granted most of the time.
meillo@12 319 .P
meillo@12 320 Being aware of
meillo@12 321 these facts, I rather let people with more historic experience solve the
meillo@12 322 task of converting the ancient code constructs to standardized ones.
meillo@12 323 Luckily, Lyndon Nerenberg focused on this task at the nmh project.
meillo@12 324 He converted large parts of the code to POSIX constructs, removing
meillo@12 325 the conditionals compilation for now standardized features.
meillo@12 326 I'm thankful for this task being solved. I only pulled the changes into
meillo@12 327 mmh.
meillo@12 328 .P
meillo@20 329 The other task \(en dropping ancient functionality to remove old code \(en
meillo@12 330 I did myself, though. My position to strip mmh to the bare minimum of
meillo@12 331 frequently used features is much more revolutional than the nmh community
meillo@20 332 likes it. Without the need to justify my decisions, I was able to quickly
meillo@20 333 remove functionality I considered ancient.
meillo@20 334 The need to discuss my decisions with
meillo@20 335 peers likely would have slowed this process down. Of course, I researched
meillo@12 336 if a particular feature really should be dropped. Having not had any
meillo@12 337 contact to this feature within my computer life was a first indicator to
meillo@12 338 drop it, but I also asked others and searched the literature for modern
meillo@12 339 usage of the feature. If it appeared to be truly ancient, I dropped it.
meillo@12 340 The reason for dropping is always part of the commit message in the
meillo@12 341 version control system. Thus, it is easy for others to check their
meillo@12 342 view on the topic with mine and possibly to argue for reinclusion.
meillo@12 343
meillo@12 344 .U2 "MMDF maildrop support
meillo@12 345 .P
meillo@12 346 I did drop any support for the MMDF maildrop format. This type of format
meillo@12 347 is conceptionally similar to the mbox format, but uses four bytes with
meillo@12 348 value 1 (\fL^A^A^A^A\fP) as message delimiter,
meillo@18 349 instead of the string ``\fLFrom\ \fP''.
meillo@12 350 Due to the similarity and mbox being the de-facto standard maildrop
meillo@12 351 format on Unix, but also due to the larger influence of Sendmail than MMDF,
meillo@12 352 the MMDF maildrop format had vanished.
meillo@12 353 .P
meillo@12 354 The simplifications within the code were only moderate. Switches could
meillo@12 355 be removed from tools like
meillo@12 356 .L packf ,
meillo@12 357 which generate packed mailboxes. Only one packed mailbox format remained:
meillo@12 358 mbox.
meillo@12 359 The most important changes affect the equally named mail parsing routine in
meillo@12 360 .L sbr/m_getfld.c .
meillo@12 361 The direct MMDF code had been removed, but as now only one packed mailbox
meillo@12 362 format is left, code structure simplifications are likely possible.
meillo@12 363 The reason why they are still outstanding is the heavily optimized code
meillo@18 364 of
meillo@18 365 .Fu m_getfld() .
meillo@18 366 Changes beyond a small local scope \(en
meillo@12 367 which restructuring in its core is \(en cause a high risk of damaging
meillo@12 368 the intricate workings of the optimized code. This problem is know
meillo@12 369 to the developers of nmh, too. They also avoid touching this minefield
meillo@12 370 if possible.
meillo@12 371
meillo@12 372 .U2 "UUCP Bang Paths
meillo@12 373 .P
meillo@12 374 More questionably than the former topic is the removal of support for the
meillo@12 375 UUCP bang path address style. However, the user may translate the bang
meillo@12 376 paths on retrieval to Internet addresses and the other way on posting
meillo@12 377 messages. The former can be done my an MDA like procmail; the latter
meillo@12 378 by a sendmail wrapper. This would ensure that any address handling would
meillo@12 379 work as expected. However, it might just work well without any
meillo@12 380 such modifications, as mmh does not touch addresses much, in general.
meillo@12 381 But I can't ensure as I have never used an environment with bang paths.
meillo@12 382 Also, the behavior might break at any point in further development.
meillo@12 383
meillo@12 384 .U2 "Hardcopy terminal support
meillo@12 385 .P
meillo@12 386 More of a funny anecdote is the remaining of a check for printing to a
meillo@12 387 hardcopy terminal until Spring 2012, when I finally removed it.
meillo@12 388 I surely would be very happy to see such a terminal in action, maybe
meillo@12 389 actually being able to work on it, but I fear my chances are null.
meillo@12 390 .P
meillo@12 391 The check only prevented a pager to be placed between the outputting
meillo@18 392 program (\c
meillo@18 393 .Pn mhl )
meillo@18 394 and the terminal. This could have been ensured with
meillo@18 395 the
meillo@18 396 .Sw \-nomoreproc
meillo@18 397 at the command line statically, too.
meillo@12 398
meillo@12 399 .U2 "Removed support for header fields
meillo@12 400 .P
meillo@12 401 The `Encrypted' header had been introduced by RFC\^822, but already
meillo@12 402 marked legacy in RFC 2822. It was superseded by FIXME.
meillo@12 403 Mmh does no more support this header.
meillo@12 404 .P
meillo@21 405 Native support for `Face' headers
meillo@21 406 had been removed, as well.
meillo@21 407 The feature is similar to the `X-Face' header in its intent,
meillo@21 408 but takes a different approach to store the image.
meillo@21 409 Instead of encoding the image data directly into the header,
meillo@21 410 the the header contains the hostname and UDP port where the image
meillo@21 411 date could be retrieved.
meillo@21 412 Neither `X-Face' nor the here described `Face' system
meillo@21 413 \**
meillo@21 414 .FS
meillo@21 415 There is also a newer but different system, invented 2005,
meillo@21 416 using `Face' headers.
meillo@21 417 It is the successor of `X-Face' providing colored PNG images.
meillo@21 418 .FE
meillo@21 419 became well used in the large scale.
meillo@21 420 It's still possible to use a Face systems,
meillo@21 421 although mmh does not provide support for any of the different systems
meillo@21 422 anymore. It's fairly easy to write a small shell script to
meillo@21 423 extract the embedded or fetch the external Face data and display the image.
meillo@21 424 Own Face headers can be added into the draft template files.
meillo@21 425 .P
meillo@12 426 `Content-MD5' headers were introduced by RFC\^1864. They provide only
meillo@12 427 a verification of data corruption during the transfer. By no means can
meillo@12 428 they ensure verbatim end-to-end delivery of the contents. This is clearly
meillo@12 429 stated in the RFC. The proper approach to provide verificationability
meillo@12 430 of content in an end-to-end relationship is the use of digital cryptography
meillo@12 431 (RFCs FIXME). On the other hand, transfer protocols should ensure the
meillo@12 432 integrity of the transmission. In combinations these two approaches
meillo@12 433 make the `Content-MD5' header field useless. In consequence, I removed
meillo@12 434 the support for it. By this removal, MD5 computation is not needed
meillo@12 435 anywhere in mmh. Hence, over 500 lines of code were removed by this one
meillo@12 436 change. Even if the `Content-MD5' header field is useful sometimes,
meillo@12 437 I value its usefulnes less than the improvement in maintainability, caused
meillo@12 438 by the removal.
meillo@12 439
meillo@20 440 .U2 "Prompter's Control Keys
meillo@20 441 .P
meillo@20 442 The program
meillo@20 443 .Pn prompter
meillo@20 444 queries the user to fill in a message form. When used by
meillo@20 445 .Pn comp
meillo@20 446 as:
meillo@20 447 .DS
meillo@20 448 comp \-editor prompter
meillo@20 449 .DE
meillo@20 450 the resulting behavior is similar to
meillo@20 451 .Pn mailx .
meillo@51 452 Apparently,
meillo@20 453 .Pn prompter
meillo@20 454 hadn't been touched lately. Otherwise it's hardly explainable why it
meillo@20 455 still offered the switches
meillo@20 456 .Sn \-erase \fUchr\fP
meillo@20 457 and
meillo@20 458 .Sn \-kill \fUchr\fP
meillo@20 459 to name the characters for command line editing.
meillo@21 460 The times when this had been necessary are long time gone.
meillo@20 461 Today these things work out-of-the-box, and if not, are configured
meillo@20 462 with the standard tool
meillo@20 463 .Pn stty .
meillo@20 464
meillo@21 465 .U2 "Vfork and Retry Loops
meillo@21 466 .P
meillo@51 467 MH creates many processes, which is a consequence of the tool chest approach.
meillo@21 468 In earlier times
meillo@21 469 .Fu fork()
meillo@21 470 had been an expensive system call, as the process's whole image needed
meillo@21 471 to be duplicated. One common case is replacing the image with
meillo@21 472 .Fu exec()
meillo@21 473 right after having forked the child process.
meillo@21 474 To speed up this case, the
meillo@21 475 .Fu vfork()
meillo@21 476 system call was invented at Berkeley. It completely omits copying the
meillo@21 477 image. If the image gets replaced right afterwards then unnecessary
meillo@21 478 work is omited. On old systems this results in large speed ups.
meillo@21 479 MH uses
meillo@21 480 .Fu vfork()
meillo@21 481 whenever possible.
meillo@21 482 .P
meillo@21 483 Memory management units that support copy-on-write semantics make
meillo@21 484 .Fu fork()
meillo@21 485 almost as fast as
meillo@21 486 .Fu vfork()
meillo@21 487 in the cases when they can be exchanged.
meillo@21 488 With
meillo@21 489 .Fu vfork()
meillo@51 490 being more error-prone and hardly faster, it's preferable to simply
meillo@21 491 use
meillo@21 492 .Fu fork()
meillo@21 493 instead.
meillo@21 494 .P
meillo@21 495 Related to the costs of
meillo@21 496 .Fu fork()
meillo@21 497 is the probability of its success.
meillo@21 498 Today on modern systems, the system call will succeed almost always.
meillo@51 499 In the Eighties on heavy loaded systems, as they were common at
meillo@21 500 universities, this had been different. Thus, many of the
meillo@21 501 .Fu fork()
meillo@21 502 calls were wrapped into loops to retry to fork several times in
meillo@21 503 short intervals, in case of previous failure.
meillo@21 504 In mmh, the program aborts at once if the fork failed.
meillo@21 505 The user can reexecute the command then. This is expected to be a
meillo@21 506 very rare case on modern systems, especially personal ones, which are
meillo@21 507 common today.
meillo@21 508
meillo@12 509
meillo@58 510 .H2 "Attachments
meillo@22 511 .P
meillo@58 512 MIME
meillo@58 513
meillo@58 514
meillo@58 515 .H2 "Digital Cryptography
meillo@22 516 .P
meillo@58 517 Signing and encryption.
meillo@58 518
meillo@58 519
meillo@58 520 .H2 "Good Defaults
meillo@22 521 .P
meillo@58 522 foo
meillo@58 523
meillo@58 524
meillo@58 525
meillo@58 526
meillo@58 527 .H1 "Code style
meillo@22 528 .P
meillo@58 529 foo
meillo@58 530
meillo@58 531
meillo@58 532 .H2 "Standard Code
meillo@22 533 .P
meillo@58 534 POSIX
meillo@22 535
meillo@22 536
meillo@58 537 .H2 "Separation
meillo@14 538
meillo@58 539 .U2 "MH Directory Split
meillo@0 540 .P
meillo@19 541 In MH and nmh, a personal setup had consisted of two parts:
meillo@19 542 The MH profile, named
meillo@19 543 .Fn \&.mh_profile
meillo@19 544 and being located directly in the user's home directory.
meillo@19 545 And the MH directory, where all his mail messages and also his personal
meillo@19 546 forms, scan formats, other configuration files are stored. The location
meillo@19 547 of this directory could be user-chosen. The default was to name it
meillo@19 548 .Fn Mail
meillo@19 549 and have it directly in the home directory.
meillo@19 550 .P
meillo@19 551 I've never liked the data storage and the configuration to be intermixed.
meillo@19 552 They are different kinds of data. One part, are the messages,
meillo@19 553 which are the data to operate on. The other part, are the personal
meillo@19 554 configuration files, which are able to change the behavior of the operations.
meillo@19 555 The actual operations are defined in the profile, however.
meillo@19 556 .P
meillo@19 557 When storing data, one should try to group data by its type.
meillo@19 558 There's sense in the Unix file system hierarchy, where configuration
meillo@19 559 file are stored separate (\c
meillo@19 560 .Fn /etc )
meillo@19 561 to the programs (\c
meillo@19 562 .Fn /bin
meillo@19 563 and
meillo@19 564 .Fn /usr/bin )
meillo@19 565 to their sources (\c
meillo@19 566 .Fn /usr/src ).
meillo@19 567 Such separation eases the backup management, for instance.
meillo@19 568 .P
meillo@19 569 In mmh, I've reorganized the file locations.
meillo@19 570 Still there are two places:
meillo@19 571 There's the mail storage directory, which, like in MH, contains all the
meillo@19 572 messages, but, unlike in MH, nothing else.
meillo@19 573 Its location still is user-chosen, with the default name
meillo@19 574 .Fn Mail ,
meillo@19 575 in the user's home directory. This is much similar to the case in nmh.
meillo@19 576 The configuration files, however, are grouped together in the new directory
meillo@19 577 .Fn \&.mmh
meillo@19 578 in the user's home directory.
meillo@19 579 The user's profile now is a file, named
meillo@19 580 .Fn profile ,
meillo@19 581 in this mmh directory.
meillo@19 582 Consistently, the context file and all the personal forms, scan formats,
meillo@19 583 and the like, are also there.
meillo@19 584 .P
meillo@19 585 The naming changed with the relocation.
meillo@19 586 The directory where everything, except the profile, had been stored (\c
meillo@19 587 .Fn $HOME/Mail ),
meillo@19 588 used to be called \fIMH directory\fP. Now, this directory is called the
meillo@19 589 user's \fImail storage\fP. The name \fImmh directory\fP is now given to
meillo@19 590 the new directory
meillo@19 591 (\c
meillo@19 592 .Fn $HOME/.mmh ),
meillo@19 593 containing all the personal configuration files.
meillo@19 594 .P
meillo@19 595 The separation of the files by type of content is logical and convenient.
meillo@19 596 There are no functional differences as any possible setup known to me
meillo@19 597 can be implemented with both approaches, although likely a bit easier
meillo@19 598 with the new approach. The main goal of the change had been to provide
meillo@19 599 sensible storage locations for any type of personal mmh file.
meillo@19 600 .P
meillo@19 601 In order for one user to have multiple MH setups, he can use the
meillo@19 602 environment variable
meillo@19 603 .Ev MH
meillo@19 604 the point to a different profile file.
meillo@19 605 The MH directory (mail storage plus personal configuration files) is
meillo@19 606 defined by the
meillo@19 607 .Pe Path
meillo@19 608 profile entry.
meillo@19 609 The context file could be defined by the
meillo@19 610 .Pe context
meillo@19 611 profile entry or by the
meillo@19 612 .Ev MHCONTEXT
meillo@19 613 environment variable.
meillo@19 614 The latter is useful to have a distinct context (e.g. current folders)
meillo@19 615 in each terminal window, for instance.
meillo@19 616 In mmh, there are three environment variables now.
meillo@19 617 .Ev MMH
meillo@19 618 may be used to change the location of the mmh directory.
meillo@19 619 .Ev MMHP
meillo@19 620 and
meillo@19 621 .Ev MMHC
meillo@19 622 change the profile and context files, respectively.
meillo@19 623 Besides providing a more consistent feel (which simply is the result
meillo@19 624 of being designed anew), the set of personal configuration files can
meillo@19 625 be chosen independently from the profile (including mail storage location)
meillo@19 626 and context, now. Being it relevant for practical use or not, it
meillo@19 627 de-facto is an improvement. However, the main achievement is the
meillo@19 628 split between mail storage and personal configuration files.
meillo@17 629
meillo@0 630
meillo@58 631 .H2 "Modularization
meillo@0 632 .P
meillo@58 633 whatnowproc
meillo@0 634 .P
meillo@49 635 The \fIMH library\fP
meillo@49 636 .Fn libmh.a
meillo@49 637 collects a bunch of standard functions that many of the MH tools need,
meillo@49 638 like reading the profile or context files.
meillo@49 639 This doesn't hurt the separation.
meillo@49 640
meillo@58 641
meillo@58 642 .H2 "Style
meillo@58 643 .P
meillo@58 644 Code layout, goto, ...
meillo@58 645
meillo@58 646
meillo@58 647
meillo@58 648
meillo@58 649 .H1 "Concept Exploitation/Homogeniety
meillo@58 650
meillo@58 651
meillo@58 652 .H2 "Draft Folder
meillo@58 653 .P
meillo@58 654 Historically, MH provided exactly one draft message, named
meillo@58 655 .Fn draft
meillo@58 656 and
meillo@58 657 being located in the MH directory. When starting to compose another message
meillo@58 658 before the former one was sent, the user had been questioned whether to use,
meillo@58 659 refile or replace the old draft. Working on multiple drafts at the same time
meillo@58 660 was impossible. One could only work on them in alteration by refiling the
meillo@58 661 previous one to some directory and fetching some other one for reediting.
meillo@58 662 This manual draft management needed to be done each time the user wanted
meillo@58 663 to switch between editing one draft to editing another.
meillo@58 664 .P
meillo@58 665 To allow true parallel editing of drafts, in a straight forward way, the
meillo@58 666 draft folder facility exists. It had been introduced already in July 1984
meillo@58 667 by Marshall T. Rose. The facility was deactivated by default.
meillo@58 668 Even in nmh, the draft folder facility remained deactivated by default.
meillo@58 669 At least, Richard Coleman added the man page
meillo@58 670 .Mp mh-draft(5)
meillo@58 671 to document
meillo@58 672 the feature well.
meillo@58 673 .P
meillo@58 674 The only advantage of not using the draft folder facility is the static
meillo@58 675 name of the draft file. This could be an issue for MH frontends like mh-e.
meillo@58 676 But as they likely want to provide working on multiple drafts in parallel,
meillo@58 677 the issue is only concerning compatibility. The aim of nmh to stay compatible
meillo@58 678 prevented the default activation of the draft folder facility.
meillo@58 679 .P
meillo@58 680 On the other hand, a draft folder is the much more natural concept than
meillo@58 681 a draft message. MH's mail storage consists of folders and messages,
meillo@58 682 the messages named with ascending numbers. A draft message breaks with this
meillo@58 683 concept by introducing a message in a file named
meillo@58 684 .Fn draft .
meillo@58 685 This draft
meillo@58 686 message is special. It can not be simply listed with the available tools,
meillo@58 687 but instead requires special switches. I.e. corner-cases were
meillo@58 688 introduced. A draft folder, in contrast, does not introduce such
meillo@58 689 corner-cases. The available tools can operate on the messages within that
meillo@58 690 folder like on any messages within any mail folders. The only difference
meillo@58 691 is the fact that the default folder for
meillo@58 692 .Pn send
meillo@58 693 is the draft folder,
meillo@58 694 instead of the current folder, like for all other tools.
meillo@58 695 .P
meillo@58 696 The trivial part of the change was activating the draft folder facility
meillo@58 697 by default and setting a default name for this folder. Obviously, I chose
meillo@58 698 the name
meillo@58 699 .Fn +drafts .
meillo@58 700 This made the
meillo@58 701 .Sw \-draftfolder
meillo@58 702 and
meillo@58 703 .Sw \-draftmessage
meillo@58 704 switches useless, and I could remove them.
meillo@58 705 The more difficult but also the part that showed the real improvement,
meillo@58 706 was updating the tools to the new concept.
meillo@58 707 .Sw \-draft
meillo@58 708 switches could
meillo@58 709 be dropped, as operating on a draft message became indistinguishable to
meillo@58 710 operating on any other message for the tools.
meillo@58 711 .Pn comp
meillo@58 712 still has its
meillo@58 713 .Sw \-use
meillo@58 714 switch for switching between its two modes: (1) Compose a new
meillo@58 715 draft, possibly by taking some existing message as a form. (2) Modify
meillo@58 716 an existing draft. In either case, the behavior of
meillo@58 717 .Pn comp is
meillo@58 718 deterministic. There is no more need to query the user. I consider this
meillo@58 719 a major improvement. By making
meillo@58 720 .Pn send
meillo@58 721 simply operate on the current
meillo@58 722 message in the draft folder by default, with message and folder both
meillo@58 723 overridable by specifying them on the command line, it is now possible
meillo@58 724 to send a draft anywhere within the storage by simply specifying its folder
meillo@58 725 and name.
meillo@58 726 .P
meillo@58 727 All theses changes converted special cases to regular cases, thus
meillo@58 728 simplifying the tools and increasing the flexibility.
meillo@58 729
meillo@58 730
meillo@58 731 .H2 "Trash Folder
meillo@58 732 .P
meillo@58 733 Similar to the situation for drafts is the situation for removed messages.
meillo@58 734 Historically, a message was deleted by renaming. A specific
meillo@58 735 \fIbackup prefix\fP, often comma (\c
meillo@58 736 .Fn , )
meillo@58 737 or hash (\c
meillo@58 738 .Fn # ),
meillo@58 739 being prepended to the file name. Thus, MH wouldn't recognize the file
meillo@58 740 as a message anymore, as only files whose name consists of digits only
meillo@58 741 are treated as messages. The removed messages remained as files in the
meillo@58 742 same directory and needed some maintenance job to truly delete them after
meillo@58 743 some grace time. Usually, by running a command similar to
meillo@58 744 .DS
meillo@58 745 find /home/user/Mail \-ctime +7 \-name ',*' | xargs rm
meillo@58 746 .DE
meillo@58 747 in a cron job. Within the grace time interval
meillo@58 748 the original message could be restored by stripping the
meillo@58 749 the backup prefix from the file name. If however, the last message of
meillo@58 750 a folder is been removed \(en say message
meillo@58 751 .Fn 6
meillo@58 752 becomes file
meillo@58 753 .Fn ,6
meillo@58 754 \(en and a new message enters the same folder, thus the same
meillo@58 755 numbered being given again \(en in our case
meillo@58 756 .Fn 6
meillo@58 757 \(en, if that one
meillo@58 758 is removed too, then the backup of the former message gets overwritten.
meillo@58 759 Thus, the ability to restore removed messages does not only depend on
meillo@58 760 the ``sweeping cron job'' but also on the removing of further messages.
meillo@58 761 This is undesirable, because the real mechanism is hidden from the user
meillo@58 762 and the consequences of further removals are not always obvious.
meillo@58 763 Further more, the backup files are scattered within the whole mail
meillo@58 764 storage, instead of being collected at one place.
meillo@58 765 .P
meillo@58 766 To improve the situation, the profile entry
meillo@58 767 .Pe rmmproc
meillo@58 768 (previously named
meillo@58 769 .Pe Delete-Prog )
meillo@58 770 was introduced, very early.
meillo@58 771 It could be set to any command, which would care for the mail removal
meillo@58 772 instead of taking the default action, described above.
meillo@58 773 Refiling the to-be-removed files to some garbage folder was a common
meillo@58 774 example. Nmh's man page
meillo@58 775 .Mp rmm(1)
meillo@58 776 proposes
meillo@58 777 .Cl "refile +d
meillo@58 778 to move messages to the garbage folder and
meillo@58 779 .Cl "rm `mhpath +d all`
meillo@58 780 the empty the garbage folder.
meillo@58 781 Managing the message removal this way is a sane approach. It keeps
meillo@58 782 the removed messages in one place, makes it easy to remove the backup
meillo@58 783 files, and, most important, enables the user to use the tools of MH
meillo@58 784 itself to operate on the removed messages. One can
meillo@58 785 .Pn scan
meillo@58 786 them,
meillo@58 787 .Pn show
meillo@58 788 them, and restore them with
meillo@58 789 .Pn refile .
meillo@58 790 There's no more
meillo@58 791 need to use
meillo@58 792 .Pn mhpath
meillo@58 793 to switch over from MH tools to Unix tools \(en MH can do it all itself.
meillo@58 794 .P
meillo@58 795 This approach matches perfect with the concepts of MH, thus making
meillo@58 796 it powerful. Hence, I made it the default. And even more, I also
meillo@58 797 removed the old backup prefix approach, as it is clearly less powerful.
meillo@58 798 Keeping unused alternative in the code is a bad choice as they likely
meillo@58 799 gather bugs, by not being constantly tested. Also, the increased code
meillo@58 800 size and more conditions crease the maintenance costs. By strictly
meillo@58 801 converting to the trash folder approach, I simplified the code base.
meillo@58 802 .Pn rmm
meillo@58 803 calls
meillo@58 804 .Pn refile
meillo@58 805 internally to move the to-be-removed
meillo@58 806 message to the trash folder (\c
meillo@58 807 .Fn +trash
meillo@58 808 by default). Messages
meillo@58 809 there can be operated on like on any other message in the storage.
meillo@58 810 The sweep clean, one can use
meillo@58 811 .Cl "rmm \-unlink +trash a" ,
meillo@58 812 where the
meillo@58 813 .Sw \-unlink
meillo@58 814 switch causes the files to be truly unliked instead
meillo@58 815 of moved to the trash folder.
meillo@58 816
meillo@58 817
meillo@58 818 .H2 "Path Notations
meillo@58 819 .P
meillo@58 820 foo
meillo@58 821
meillo@58 822
meillo@58 823 .H2 "MIME Integration
meillo@58 824 .P
meillo@58 825 user-visible access to whole messages and MIME parts are inherently
meillo@58 826 different
meillo@58 827
meillo@58 828
meillo@58 829 .H2 "Of One Cast
meillo@58 830 .P