Subject: Re: How are these msg.* filenames built?

From: [email-masked] (Stephen R. van den Berg)
Date: Tue, 29 Mar 1994 16:09:18 +0200

Hans-Albert Schneider <[email-masked]> wrote:
>I would have expected the first file to be named msg.1 or msg.001
>or something like this, so:
> How are these names built?

$MSGPREFIX<inode-number-of-the-file>

> Where is the count stored?

It is "not", procmail creates a temporary file, finds out the inode number it
got, and renames the file into $MSGPREFIX<inode-nr>.
This means procmail does not need read access to the directory to create the
unique filename.

>Why did it start with '5qT', and how will the names continue after 'ZqT'?

The filesystem will decide which inode-nr a new file gets.  Procmail has
virtually no way to influence this.

The inode number is encoded using little-endian 6-bit bytes, where each
character represents a 6-bit value according to the ordered set:
0-9 A-Z a-z - _

I.e. '0' ==  0
     'A' == 10
     'a' == 36
     'z' == 61
     '-' == 62
     '_' == 63
               0       1       2
So, 5qt == 5*64 + 52*64 + 55*64  = 228613

Why do we do this, you ask?  It makes for shorter filenames (and the longer
the filenames, the more problems you will encounter (in general)).

>Will procmail be confused when there are files that do not fit
>into that numbering scheme, e.g., when I use the same directory
>both MH style and "msg style" (how is it called correctly?), or
>put some other files in it?

Procmail will not get confused.  A directory can safely be an MH-folder
and a directory-folder at the same time.  As far as procmail is concerned
you do not need any lockfiles at all while delivering to a directory- or
MH-folder or both.

For an interesting effect, try the following as the target:

DIRECTORY DIRECTORY/.

If I'm not mistaken, this will create two files (hardlinked to each other)
in the same directory.  One according to the MH-folder scheme, and one
according to the directory-folder scheme.

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).

I've never been superstitious!  Knock on wood.