ifile-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ifile-discuss] Re: Maildir format


From: clemens fischer
Subject: [Ifile-discuss] Re: Maildir format
Date: 15 May 2003 13:04:26 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (berkeley-unix)

Jack Bertram <address@hidden>:

> if [ -d $MAILDIR/$mbox && $mbox -ne '.' && $mbox -ne '..' ] 

it's simpler to use the executing shells filename globber.  provided
it is a bourne shell:

  for mbox in "$MAILDIR"/.[a-zA-Z0-9]*
  do
  [ -d "$mbox/cur" -a -d "$mbox/tmp" -a -d "$mbox/new" ] && {
        whatever ...
  }
  done

also, test(1) propably doesn't understand `&&', it ususally wants `-a'
instead.  the double quotes ensure that names containing spaces will
work as well.

>   rm -rf $BACKUP/$mbox && cp -aR $MAILDIR/$mbox $BACKUP/$mbox || exit

is the `-a' flag to cp(1) a linux'ism?  sounds like it might be
equivalent to freebsds "cp -Rp src dst".  isn't `-R' included in `-a'?

> Note that this may not work for very large Maildirs (thousands of
> messages) as the command line will be too long.  In this case you
> would have to do something more like (untested)
>
> Actually, you also need to pass the name of the message file to
> procmail in the environment, as you won't be using procmail
> delivery. Done above.
>
> ls $mbox/cur/* | xargs cat | procmail ...

this can easily overflow cat(1)s commandline the same way you wanted
to protect it from in the first place.  you could use "xargs -n 3333
..." to explicitly set this maximum number of arguments.

why not use ,,find "$mbox/cur" -print0 | xargs -0 procmail ...''?  or,
if procmail doesn't take a file name argument, replace it with "cat |
procmail"?

> # Find changed messages
>  
>   for newmsg in $MAILDIR/cur/*.new;
>   do

this isn't a standard maildir-format, right?  i only know qmails
original variant, which places new messages into ./tmp/ and renames
them into ./new/.

> # Find the name of the non-changed message
>  
>     msg = `echo $newmsg | sed -e 's/\.new//'` 

question:  what operating system are we talking about here?  i'm not
sure about the shell you're running, in freebsd's bourne shell you
could save the sed(1) and write:

      msg = "${newmsg%.new}"

which also works for filenames containg a "\.new" pattern somewhere
else in the name, but this certainly doesn't apply to qmails maildir
file names.

> # If it's different, replace it with the changed one
>
>     diff $newmsg $msg > /dev/null 2>/dev/null || mv $newmsg $msg
>     [ -f $newmsg ] && rm -r $newmsg
>   done

now wait a minute!  this cannot possibly be maildir-format!  what is
maildir for if you cancel it's biggest advantage and allow changing
messages within one of its subdirs??  maildirs accumulate new messages
using a time-stamped name in ./tmp/, rename(2) them into ./new/ with
applications moving them from ./new/ to ./cur/ when finished.  it
doesn't make any sense to operate on messages inside any of these
directories!  please tell me what software does that, for me to avoid
it in the future.

  clemens




reply via email to

[Prev in Thread] Current Thread [Next in Thread]