docs/master

annotate ch03.roff @ 19:ab5253e48c74

Wrote about the directory split. style: New macro for env vars.
author markus schnalke <meillo@marmaro.de>
date Tue, 24 Apr 2012 18:02:08 +0200
parents db3567c9cc3f
children 7a100c80fa91
rev   line source
meillo@0 1 .H0 "Work Report
meillo@0 2 .P
meillo@0 3 foo
meillo@0 4 .P
meillo@0 5 bar
meillo@0 6
meillo@12 7 .H1 "Removal of Code Relicts
meillo@0 8 .P
meillo@12 9 The code base of mmh originates in the late 70s, had been extensively
meillo@12 10 worked on in the mid 80s, and had been partly reorganized and extended
meillo@12 11 in the 90s. Relicts of all those times had gathered in the code base.
meillo@12 12 My goal was to remove any ancient code parts. One part of the task was
meillo@12 13 converting obsolete code constructs to standard constructs, the other part
meillo@12 14 was dropping obsolete functions.
meillo@12 15 .P
meillo@12 16 As I'm not even thirty years old and have no more than seven years of
meillo@12 17 Unix experience, I needed to learn about the history in retroperspective.
meillo@12 18 Older people likely have used those ancient constructs themself
meillo@12 19 and have suffered from their incompatiblities and have longed for
meillo@12 20 standardization. Unfortunately, I have only read that others had done so.
meillo@12 21 This put me in a much more difficult positions when working on the old
meillo@12 22 code. I needed to recherche what other would have known by heart from
meillo@12 23 experience. All my programming experience comes from a time past ANSI C
meillo@12 24 and past POSIX. Although I knew about the times before, I took the
meillo@12 25 current state implicitely for granted most of the time.
meillo@12 26 .P
meillo@12 27 Being aware of
meillo@12 28 these facts, I rather let people with more historic experience solve the
meillo@12 29 task of converting the ancient code constructs to standardized ones.
meillo@12 30 Luckily, Lyndon Nerenberg focused on this task at the nmh project.
meillo@12 31 He converted large parts of the code to POSIX constructs, removing
meillo@12 32 the conditionals compilation for now standardized features.
meillo@12 33 I'm thankful for this task being solved. I only pulled the changes into
meillo@12 34 mmh.
meillo@12 35 .P
meillo@12 36 The other task of dropping ancient functionality to remove old code,
meillo@12 37 I did myself, though. My position to strip mmh to the bare minimum of
meillo@12 38 frequently used features is much more revolutional than the nmh community
meillo@12 39 sees it. Without the need to justify my decisions, I was able to quickly
meillo@12 40 remove code I considered ancient. The need to discuss my decisions with
meillo@12 41 peers likely would have slowed this process down. Of course, I did research
meillo@12 42 if a particular feature really should be dropped. Having not had any
meillo@12 43 contact to this feature within my computer life was a first indicator to
meillo@12 44 drop it, but I also asked others and searched the literature for modern
meillo@12 45 usage of the feature. If it appeared to be truly ancient, I dropped it.
meillo@12 46 The reason for dropping is always part of the commit message in the
meillo@12 47 version control system. Thus, it is easy for others to check their
meillo@12 48 view on the topic with mine and possibly to argue for reinclusion.
meillo@12 49
meillo@12 50 .U2 "MMDF maildrop support
meillo@12 51 .P
meillo@12 52 I did drop any support for the MMDF maildrop format. This type of format
meillo@12 53 is conceptionally similar to the mbox format, but uses four bytes with
meillo@12 54 value 1 (\fL^A^A^A^A\fP) as message delimiter,
meillo@18 55 instead of the string ``\fLFrom\ \fP''.
meillo@12 56 Due to the similarity and mbox being the de-facto standard maildrop
meillo@12 57 format on Unix, but also due to the larger influence of Sendmail than MMDF,
meillo@12 58 the MMDF maildrop format had vanished.
meillo@12 59 .P
meillo@12 60 The simplifications within the code were only moderate. Switches could
meillo@12 61 be removed from tools like
meillo@12 62 .L packf ,
meillo@12 63 which generate packed mailboxes. Only one packed mailbox format remained:
meillo@12 64 mbox.
meillo@12 65 The most important changes affect the equally named mail parsing routine in
meillo@12 66 .L sbr/m_getfld.c .
meillo@12 67 The direct MMDF code had been removed, but as now only one packed mailbox
meillo@12 68 format is left, code structure simplifications are likely possible.
meillo@12 69 The reason why they are still outstanding is the heavily optimized code
meillo@18 70 of
meillo@18 71 .Fu m_getfld() .
meillo@18 72 Changes beyond a small local scope \(en
meillo@12 73 which restructuring in its core is \(en cause a high risk of damaging
meillo@12 74 the intricate workings of the optimized code. This problem is know
meillo@12 75 to the developers of nmh, too. They also avoid touching this minefield
meillo@12 76 if possible.
meillo@12 77
meillo@12 78 .U2 "UUCP Bang Paths
meillo@12 79 .P
meillo@12 80 More questionably than the former topic is the removal of support for the
meillo@12 81 UUCP bang path address style. However, the user may translate the bang
meillo@12 82 paths on retrieval to Internet addresses and the other way on posting
meillo@12 83 messages. The former can be done my an MDA like procmail; the latter
meillo@12 84 by a sendmail wrapper. This would ensure that any address handling would
meillo@12 85 work as expected. However, it might just work well without any
meillo@12 86 such modifications, as mmh does not touch addresses much, in general.
meillo@12 87 But I can't ensure as I have never used an environment with bang paths.
meillo@12 88 Also, the behavior might break at any point in further development.
meillo@12 89
meillo@12 90 .U2 "Hardcopy terminal support
meillo@12 91 .P
meillo@12 92 More of a funny anecdote is the remaining of a check for printing to a
meillo@12 93 hardcopy terminal until Spring 2012, when I finally removed it.
meillo@12 94 I surely would be very happy to see such a terminal in action, maybe
meillo@12 95 actually being able to work on it, but I fear my chances are null.
meillo@12 96 .P
meillo@12 97 The check only prevented a pager to be placed between the outputting
meillo@18 98 program (\c
meillo@18 99 .Pn mhl )
meillo@18 100 and the terminal. This could have been ensured with
meillo@18 101 the
meillo@18 102 .Sw \-nomoreproc
meillo@18 103 at the command line statically, too.
meillo@12 104
meillo@12 105 .U2 "Removed support for header fields
meillo@12 106 .P
meillo@12 107 The `Encrypted' header had been introduced by RFC\^822, but already
meillo@12 108 marked legacy in RFC 2822. It was superseded by FIXME.
meillo@12 109 Mmh does no more support this header.
meillo@12 110 .P
meillo@12 111 `Content-MD5' headers were introduced by RFC\^1864. They provide only
meillo@12 112 a verification of data corruption during the transfer. By no means can
meillo@12 113 they ensure verbatim end-to-end delivery of the contents. This is clearly
meillo@12 114 stated in the RFC. The proper approach to provide verificationability
meillo@12 115 of content in an end-to-end relationship is the use of digital cryptography
meillo@12 116 (RFCs FIXME). On the other hand, transfer protocols should ensure the
meillo@12 117 integrity of the transmission. In combinations these two approaches
meillo@12 118 make the `Content-MD5' header field useless. In consequence, I removed
meillo@12 119 the support for it. By this removal, MD5 computation is not needed
meillo@12 120 anywhere in mmh. Hence, over 500 lines of code were removed by this one
meillo@12 121 change. Even if the `Content-MD5' header field is useful sometimes,
meillo@12 122 I value its usefulnes less than the improvement in maintainability, caused
meillo@12 123 by the removal.
meillo@12 124
meillo@12 125
meillo@14 126 .H1 "Draft and Trash Folders
meillo@16 127 .U2 "Draft Folder
meillo@14 128 .P
meillo@18 129 Historically, MH provided exactly one draft message, named
meillo@18 130 .Fn draft
meillo@18 131 and
meillo@14 132 being located in the MH directory. When starting to compose another message
meillo@14 133 before the former one was sent, the user had been questioned wether to use,
meillo@14 134 refile or replace the old draft. Working on multiple drafts at the same time
meillo@14 135 was impossible. One could only work on them in alteration by refiling the
meillo@14 136 previous one to some directory and fetching some other one for reediting.
meillo@14 137 This manual draft management needed to be done each time the user wanted
meillo@14 138 to switch between editing one draft to editing another.
meillo@14 139 .P
meillo@14 140 To allow true parallel editing of drafts, in a straight forward way, the
meillo@14 141 draft folder facility exists. It had been introduced already in July 1984
meillo@14 142 by Marshall T. Rose. The facility was deactivated by default.
meillo@14 143 Even in nmh, the draft folder facility remained deactivated by default.
meillo@18 144 At least, Richard Coleman added the man page
meillo@18 145 .Mp mh-draft(5)
meillo@18 146 to document
meillo@14 147 the feature well.
meillo@14 148 .P
meillo@14 149 The only advantage of not using the draft folder facility is the static
meillo@14 150 name of the draft file. This could be an issue for MH frontends like mh-e.
meillo@14 151 But as they likely want to provide working on multiple drafts in parallel,
meillo@14 152 the issue is only concerning compatibility. The aim of nmh to stay compatible
meillo@14 153 prevented the default activation of the draft folder facility.
meillo@14 154 .P
meillo@14 155 On the other hand, a draft folder is the much more natural concept than
meillo@14 156 a draft message. MH's mail storage consists of folders and messages,
meillo@14 157 the messages named with ascending numbers. A draft message breaks with this
meillo@18 158 concept by introducing a message in a file named
meillo@18 159 .Fn draft .
meillo@18 160 This draft
meillo@14 161 message is special. It can not be simply listed with the available tools,
meillo@17 162 but instead requires special switches. I.e. corner-cases were
meillo@14 163 introduced. A draft folder, in contrast, does not introduce such
meillo@14 164 corner-cases. The available tools can operate on the messages within that
meillo@14 165 folder like on any messages within any mail folders. The only difference
meillo@18 166 is the fact that the default folder for
meillo@18 167 .Pn send
meillo@18 168 is the draft folder,
meillo@14 169 instead of the current folder, like for all other tools.
meillo@14 170 .P
meillo@14 171 The trivial part of the change was activating the draft folder facility
meillo@14 172 by default and setting a default name for this folder. Obviously, I chose
meillo@18 173 the name
meillo@18 174 .Fn +drafts .
meillo@18 175 This made the
meillo@18 176 .Sw \-draftfolder
meillo@18 177 and
meillo@18 178 .Sw \-draftmessage
meillo@18 179 switches useless, and I could remove them.
meillo@14 180 The more difficult but also the part that showed the real improvement,
meillo@18 181 was updating the tools to the new concept.
meillo@18 182 .Sw \-draft
meillo@18 183 switches could
meillo@14 184 be dropped, as operating on a draft message became indistinguishable to
meillo@18 185 operating on any other message for the tools.
meillo@18 186 .Pn comp
meillo@18 187 still has its
meillo@18 188 .Sw \-use
meillo@18 189 switch for switching between its two modes: (1) Compose a new
meillo@14 190 draft, possibly by taking some existing message as a form. (2) Modify
meillo@18 191 an existing draft. In either case, the behavior of
meillo@18 192 .Pn comp is
meillo@14 193 deterministic. There is no more need to query the user. I consider this
meillo@18 194 a major improvement. By making
meillo@18 195 .Pn send
meillo@18 196 simply operate on the current
meillo@17 197 message in the draft folder by default, with message and folder both
meillo@14 198 overridable by specifying them on the command line, it is now possible
meillo@17 199 to send a draft anywhere within the storage by simply specifying its folder
meillo@17 200 and name.
meillo@14 201 .P
meillo@14 202 All theses changes converted special cases to regular cases, thus
meillo@14 203 simplifying the tools and increasing the flexibility.
meillo@14 204
meillo@16 205 .U2 "Trash Folder
meillo@16 206 .P
meillo@16 207 Similar to the situation for drafts is the situation for removed messages.
meillo@16 208 Historically, a message was deleted by renaming. A specific
meillo@18 209 \fIbackup prefix\fP, often comma (\c
meillo@18 210 .Fn , )
meillo@18 211 or hash (\c
meillo@18 212 .Fn # ),
meillo@16 213 being prepended to the file name. Thus, MH wouldn't recognize the file
meillo@16 214 as a message anymore, as only files whose name consists of digits only
meillo@16 215 are treated as messages. The removed messages remained as files in the
meillo@16 216 same directory and needed some maintenance job to truly delete them after
meillo@16 217 some grace time. Usually, by running a command similar to
meillo@16 218 .DS
meillo@16 219 find /home/user/Mail \-ctime +7 \-name ',*' | xargs rm
meillo@16 220 .DE
meillo@16 221 in a cron job. Within the grace time interval
meillo@16 222 the original message could be restored by stripping the
meillo@16 223 the backup prefix from the file name. If however, the last message of
meillo@18 224 a folder is been removed \(en say message
meillo@18 225 .Fn 6
meillo@18 226 becomes file
meillo@18 227 .Fn ,6
meillo@18 228 \(en and a new message enters the same folder, thus the same
meillo@18 229 numbered being given again \(en in our case
meillo@18 230 .Fn 6
meillo@18 231 \(en, if that one
meillo@17 232 is removed too, then the backup of the former message gets overwritten.
meillo@16 233 Thus, the ability to restore removed messages does not only depend on
meillo@16 234 the ``sweeping cron job'' but also on the removing of further messages.
meillo@16 235 This is undesireable, because the real mechanism is hidden from the user
meillo@16 236 and the concequences of further removals are not always obvious.
meillo@16 237 Further more, the backup files are scattered within the whole mail
meillo@16 238 storage, instead of being collected at one place.
meillo@16 239 .P
meillo@18 240 To improve the situation, the profile entry
meillo@18 241 .Pe rmmproc
meillo@18 242 (previously named
meillo@18 243 .Pe Delete-Prog )
meillo@18 244 was introduced, very early.
meillo@16 245 It could be set to any command, which would care for the mail removal
meillo@16 246 instead of taking the default action, described above.
meillo@16 247 Refiling the to-be-removed files to some wastebin folder was a common
meillo@18 248 example. Nmh's man page
meillo@18 249 .Mp rmm(1)
meillo@18 250 proposes
meillo@18 251 .Cl "refile +d
meillo@18 252 to move messages to the wastebin and
meillo@18 253 .Cl "rm `mhpath +d all`
meillo@16 254 the empty the wastebin.
meillo@16 255 Managing the message removal this way is a sane approach. It keeps
meillo@16 256 the removed messages in one place, makes it easy to remove the backup
meillo@16 257 files, and, most important, enables the user to use the tools of MH
meillo@18 258 itself to operate on the removed messages. One can
meillo@18 259 .Pn scan
meillo@18 260 them,
meillo@18 261 .Pn show
meillo@18 262 them, and restore them with
meillo@18 263 .Pn refile .
meillo@18 264 There's no more
meillo@18 265 need to use
meillo@18 266 .Pn mhpath
meillo@18 267 to switch over from MH tools to Unix tools \(en MH can do it all itself.
meillo@16 268 .P
meillo@18 269 This apporach matches perfect with the concepts of MH, thus making
meillo@16 270 it powerful. Hence, I made it the default. And even more, I also
meillo@16 271 removed the old backup prefix approach, as it is clearly less powerful.
meillo@16 272 Keeping unused alternative in the code is a bad choice as they likely
meillo@16 273 gather bugs, by not being constantly tested. Also, the increased code
meillo@16 274 size and more conditions crease the maintenance costs. By strictly
meillo@16 275 converting to the trash folder approach, I simplified the code base.
meillo@18 276 .Pn rmm
meillo@18 277 calls
meillo@18 278 .Pn refile
meillo@18 279 internally to move the to-be-removed
meillo@18 280 message to the trash folder (\c
meillo@18 281 .Fn +trash
meillo@18 282 by default). Messages
meillo@16 283 there can be operated on like on any other message in the storage.
meillo@18 284 The sweep clean, one can use
meillo@18 285 .Cl "rmm \-unlink +trash a" ,
meillo@18 286 where the
meillo@18 287 .Sw \-unlink
meillo@18 288 switch causes the files to be truly unliked instead
meillo@16 289 of moved to the trash folder.
meillo@16 290
meillo@0 291
meillo@17 292 .H1 "MH Directory Split
meillo@0 293 .P
meillo@19 294 In MH and nmh, a personal setup had consisted of two parts:
meillo@19 295 The MH profile, named
meillo@19 296 .Fn \&.mh_profile
meillo@19 297 and being located directly in the user's home directory.
meillo@19 298 And the MH directory, where all his mail messages and also his personal
meillo@19 299 forms, scan formats, other configuration files are stored. The location
meillo@19 300 of this directory could be user-chosen. The default was to name it
meillo@19 301 .Fn Mail
meillo@19 302 and have it directly in the home directory.
meillo@19 303 .P
meillo@19 304 I've never liked the data storage and the configuration to be intermixed.
meillo@19 305 They are different kinds of data. One part, are the messages,
meillo@19 306 which are the data to operate on. The other part, are the personal
meillo@19 307 configuration files, which are able to change the behavior of the operations.
meillo@19 308 The actual operations are defined in the profile, however.
meillo@19 309 .P
meillo@19 310 When storing data, one should try to group data by its type.
meillo@19 311 There's sense in the Unix file system hierarchy, where configuration
meillo@19 312 file are stored separate (\c
meillo@19 313 .Fn /etc )
meillo@19 314 to the programs (\c
meillo@19 315 .Fn /bin
meillo@19 316 and
meillo@19 317 .Fn /usr/bin )
meillo@19 318 to their sources (\c
meillo@19 319 .Fn /usr/src ).
meillo@19 320 Such separation eases the backup management, for instance.
meillo@19 321 .P
meillo@19 322 In mmh, I've reorganized the file locations.
meillo@19 323 Still there are two places:
meillo@19 324 There's the mail storage directory, which, like in MH, contains all the
meillo@19 325 messages, but, unlike in MH, nothing else.
meillo@19 326 Its location still is user-chosen, with the default name
meillo@19 327 .Fn Mail ,
meillo@19 328 in the user's home directory. This is much similar to the case in nmh.
meillo@19 329 The configuration files, however, are grouped together in the new directory
meillo@19 330 .Fn \&.mmh
meillo@19 331 in the user's home directory.
meillo@19 332 The user's profile now is a file, named
meillo@19 333 .Fn profile ,
meillo@19 334 in this mmh directory.
meillo@19 335 Consistently, the context file and all the personal forms, scan formats,
meillo@19 336 and the like, are also there.
meillo@19 337 .P
meillo@19 338 The naming changed with the relocation.
meillo@19 339 The directory where everything, except the profile, had been stored (\c
meillo@19 340 .Fn $HOME/Mail ),
meillo@19 341 used to be called \fIMH directory\fP. Now, this directory is called the
meillo@19 342 user's \fImail storage\fP. The name \fImmh directory\fP is now given to
meillo@19 343 the new directory
meillo@19 344 (\c
meillo@19 345 .Fn $HOME/.mmh ),
meillo@19 346 containing all the personal configuration files.
meillo@19 347 .P
meillo@19 348 The separation of the files by type of content is logical and convenient.
meillo@19 349 There are no functional differences as any possible setup known to me
meillo@19 350 can be implemented with both approaches, although likely a bit easier
meillo@19 351 with the new approach. The main goal of the change had been to provide
meillo@19 352 sensible storage locations for any type of personal mmh file.
meillo@19 353 .P
meillo@19 354 In order for one user to have multiple MH setups, he can use the
meillo@19 355 environment variable
meillo@19 356 .Ev MH
meillo@19 357 the point to a different profile file.
meillo@19 358 The MH directory (mail storage plus personal configuration files) is
meillo@19 359 defined by the
meillo@19 360 .Pe Path
meillo@19 361 profile entry.
meillo@19 362 The context file could be defined by the
meillo@19 363 .Pe context
meillo@19 364 profile entry or by the
meillo@19 365 .Ev MHCONTEXT
meillo@19 366 environment variable.
meillo@19 367 The latter is useful to have a distinct context (e.g. current folders)
meillo@19 368 in each terminal window, for instance.
meillo@19 369 In mmh, there are three environment variables now.
meillo@19 370 .Ev MMH
meillo@19 371 may be used to change the location of the mmh directory.
meillo@19 372 .Ev MMHP
meillo@19 373 and
meillo@19 374 .Ev MMHC
meillo@19 375 change the profile and context files, respectively.
meillo@19 376 Besides providing a more consistent feel (which simply is the result
meillo@19 377 of being designed anew), the set of personal configuration files can
meillo@19 378 be chosen independently from the profile (including mail storage location)
meillo@19 379 and context, now. Being it relevant for practical use or not, it
meillo@19 380 de-facto is an improvement. However, the main achievement is the
meillo@19 381 split between mail storage and personal configuration files.
meillo@17 382
meillo@0 383
meillo@0 384 .H1 "Path Notations
meillo@0 385 .P
meillo@0 386 foo
meillo@0 387
meillo@0 388 .H1 "Attachments
meillo@0 389 .P
meillo@0 390 foo
meillo@0 391
meillo@0 392 .H1 "Blind Carbon Copies
meillo@0 393 .P
meillo@0 394 foo
meillo@0 395
meillo@0 396 .H1 "Good Defaults
meillo@0 397 .P
meillo@0 398 foo
meillo@0 399
meillo@0 400 .H1 "Modularization
meillo@0 401 .P
meillo@0 402 foo
meillo@0 403
meillo@0 404 .H1 "Code style
meillo@0 405 .P
meillo@0 406 foo