commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-2.2-246-g0fac46a


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-246-g0fac46a
Date: Wed, 01 Dec 2010 22:41:37 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=0fac46ab0e306070a46c5016cf2cf52c776c791c

The branch, master has been updated
       via  0fac46ab0e306070a46c5016cf2cf52c776c791c (commit)
       via  9e863ef5b4acb7d30672a7313fa04c4f329f8a7a (commit)
       via  c70959cac82e02e7c6e8d72c21815e0f2ebc4088 (commit)
      from  435f1918df505d58b8cd3fea9b3ab6bba296faa9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0fac46ab0e306070a46c5016cf2cf52c776c791c
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Dec 2 00:27:07 2010 +0200

    Fixes in message_stream.
    
    * libmailutils/mailbox/message.c (_message_stream_seek): Fix
    ESPIPE conditional.
    (_message_stream_read): Keep running until buffer is full
    or _mss_eof state is reached.
    (_message_stream_readdelim): Keep running until buffer is full,
    _mss_eof state is reached or delimiter is found.

commit 9e863ef5b4acb7d30672a7313fa04c4f329f8a7a
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed Dec 1 20:39:06 2010 +0200

    sieve: rewrite lexer to use MU streams API.
    
    * libmu_sieve/sieve.l (input_string_ptr, input_string_level): Remove.
    (input_stream): New static variable.
    (fillbuf): Use mu_stream_read
    (buffer_ctx)<yyin>: Replace with mu_stream_t input;
    (push_source, pop_source): Use stream API.
    (mu_sv_lex_begin_string): Likewise.
    * sieve/sieve.c (options): New option --expression.
    (expression_option): New variable.
    (parser): Handle the --expression option.
    (main): Treat SCRIPT as program text if given the --expression option.

commit c70959cac82e02e7c6e8d72c21815e0f2ebc4088
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed Dec 1 19:35:01 2010 +0200

    Revise TODO.

-----------------------------------------------------------------------

Summary of changes:
 TODO                           |  160 ++++++++++++++++-----------------------
 libmailutils/mailbox/message.c |   13 +++-
 libmu_sieve/sieve.l            |   79 +++++++++++---------
 sieve/sieve.c                  |   17 ++++-
 4 files changed, 132 insertions(+), 137 deletions(-)

diff --git a/TODO b/TODO
index e80dd28..e8c21f6 100644
--- a/TODO
+++ b/TODO
@@ -1,89 +1,104 @@
-GNU mailutils TODO list. 2008-08-20
+GNU mailutils TODO list. 2010-12-01
 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 Free
 Software Foundation, Inc.
 
-* Configuration callback functions should not modify node->tag and node->label.
+* Provide a generic way to store UID, UIDNEXT and UIDVALIDITY in mailboxes.
 
-* Debug handling in cfg vs. argp
+* prog_stream: find a way to initialize start directory value and environment
 
-* Fix folder_imap_list in libproto/imap/folder.c
+* stream: associate with input location (mu_locus_t or the like).
 
-* Documentation
+* redo the support of the default user email and mail domain.
 
-* Review the code and use mu_vartab_* and mu_kwd_* functions where
-necessary.
+* use the above in message_stream.
 
-* mailbox 
+* eliminate uses of strtok(_r)
 
-** Generic search interface
+* mail: rewrite I/O support using streams.
 
-** Locking
+* redo debugging & logging support the way it is implemented in dico/mailfromd
 
-*** Implement a read/write locker_lock() flag so that when MU_LOCKER_WRONLY
-is set in the locker flags, only write locks actually lock the file,
-read locks don't do anything.
+* re-implement imap4 client (in progress)
+
+* re-implement nntp client
+
+* properties:
+
+** implement libproperty - a library of various storage backends for 
mu_property_t.
+
+** consider a possibility of typed properties (integer, unsigned, string, ...)
+
+* vacation: link with libproperty when it is ready
+
+* remove libmu_auth, rewrite mu_auth support via mu_property_t
+
+* filter interface: need API to send line wrap length
+
+See reset_line_length in examples/base64.c, libmailutils/tests/fltst.c
+and mu/filter.c.
+
+* locale-dependent variant of mu_rfc2047_decode
+
+See rfc2047_decode_wrapper in frm/common.c for a prototype.
+
+* observer: allow for procedure-data closures
+
+See frm/common.c (near line 425).
+
+* sieve.scm is exempted from installcheck.
+
+See guimb/scm/Makefile.am for a discussion.
+
+* lib/mailcap.c: rewrite using streams
+
+* mu_address_createv: pass hints as in mu_address_create_hint?
+
+* fix Python support
 
-*** what kind of locking should mh use? See FIXME in mbx_mh.c
+* fix C++ support
 
-*** why does mimetest fail on a symlink, but succeed on a dotlocked file?
+* redo libraries as loadable modules (where possible)
 
-*** implement a force unlock mode... so that when a mailbox
-is closed or destroyed it can make sure that the lock
-is definitely gone.
+* move obsolete interfaces to libmu-compat:
 
-** mailboxes don't remember whether or not they've been opened
+argcv
+vartab
 
-** does IMAP do an EXAMINE instead of a select if the mailbox is being
-opened readonly? Does list return whether a mailbox is readonly?
-Check against CMUs anon server, it is a read-only mailbox.
+* Configuration callback functions should not modify node->tag and node->label.
 
-** mu_cpystr - the size_t* size outputs only give strlen(), not the
-actual length?
-Sam Roberts:
-  My recollection is that when you give a buffer to output APIs, you give
-  the total size. But the size_t* that returns the required size, returns
-  the required size, minus the NUL. The units are different, in a sense.
+* mailbox 
 
-** need code to find a "real" envelope from... an actual email address
-that DSNs can be sent to.
+** Generic search interface
 
-** need to be able to map some addresses (like mail to "root") to a
-user for the box, a la nullmailer, perhaps
-Sam Roberts:
-  If you have a really simple workstation with a basic mail system,
-  you  may want mail.local to deliver all email addressed to "root" and
-  "postmaster", etc., to a particular user, like yourself. 
-Sergey Poznyakoff:
-  In short, that is kind of aliasing support. We have aliasing support
-  in MH, possibly it could be used in libmailbox as well.
+** Locking
 
-** mailer_t: the SMTP mailer isn't as fully implemented as the sendmail
-mailer.
+*** Implement a read/write locker_lock() flag so that when MU_LOCKER_WRONLY
+is set in the locker flags, only write locks actually lock the file,
+read locks don't do anything.
 
-** make the smtp mailer calls usable standalone, as well as url based,
-and use them in mail.remote.
+*** reportedly mimetest fail on a symlink, but succeed on a dotlocked file?
 
-** support AUTH=anonymous (imap://cyrus.andrew.cmu.edu/archive.info-cyrus)
+* mu_cpystr - revise the use of. 
 
-** filter_trans needs readline method.
+* support AUTH=anonymous (imap://cyrus.andrew.cmu.edu/archive.info-cyrus)
 
-* pop3
+* mail aliasing support in libmailutils
 
-** pop3d_readline - should this use select(), avoid the race condition,
-and touch the lockfile in time intervals smaller than MU_LOCKER_EXPIRE_TIME?
+Use code from MH.
 
 * imap4d
 
 ** Check interaction with various imap clients. Currently tested with:
-mail (from mailutils itself), mutt, pine, netscape, mozilla.
+mail (from mailutils itself), mutt, pine, netscape, mozilla,
+thunderbird, roundcube.
 
-** Better support of multi-access mailbox
+** Better support of multi-access mailboxes?
 
 ** implement charsets in search: 1 SEARCH CHARSET ISO-8859-2 TEXT ...
 
 ** implement AUTHENTICATE KERBEROS_V4 and SKEY and SRP?
 
-* Implement extensions:
+** Implement extensions:
 
  - QUOTA     : RFC 2087
  - ACL       : RFC 4314
@@ -102,55 +117,12 @@ The framework is implemented. Needs extensive testing.
 * Mime.types API is available in mimeview. Do we need to move it to
 libmailbox?
 
-* examples
-
-** unify the mbox-* and mimetest examples with messages, it would be nice
-to have a general purpose tool
-
 * mh -- see mh/TODO
 
-* sieve
-
-** run as daemon, sieveing mail on arrival (need interface for notification
-of message arrival, this is supported by imap, but we'll have to fake
-for pop and local spools my polling, why can't you select() on a unix
-file?)
-
 * utilities
 
 ** mimeview: support nametemplate
 
-** all
-
-* Testsuite:
-
-Tcl is not able to handle binary data properly. This makes impossible
-to test some aspects of MU functionalities. Following testcases are
-affected:
-
-** mailbox/testsuite/mailbox/base64.exp
-
-The ability of the test program to read given file instead of the
-stdin is used to override the issue.
-
-** mailbox/testsuite/mailbox/encode2047.exp
-
-Input data are represented in octal format (see
-mailbox/testsuite/Encode2047). 
-
-** mailbox/testsuite/mailbox/argcv.exp
-
-The affected testcase is not run (see mailbox/testsuite/Argcv and
-search for FIXME). 
-
-* add nightly build
-
-* add more features
-
-* optimize everything
-
-* test everything
-
 
 Local variables:
 mode: outline
diff --git a/libmailutils/mailbox/message.c b/libmailutils/mailbox/message.c
index b1249bc..21d127f 100644
--- a/libmailutils/mailbox/message.c
+++ b/libmailutils/mailbox/message.c
@@ -159,9 +159,8 @@ _message_stream_seek (struct _mu_stream *str, mu_off_t off, 
mu_off_t *ppos)
     return rc;
   mu_header_size (sp->msg->header, &hsize);
   mu_body_size (sp->msg->body, &size);
-  size += hsize;
   
-  if (off < 0 || off >= size)
+  if (off < 0 || off >= size + hsize)
     return ESPIPE;
 
   switch (sp->state)
@@ -224,6 +223,10 @@ _message_stream_read (struct _mu_stream *str, char *buf, 
size_t bufsize,
       if (sp->state == _mss_eof)
        break;
       rc = mu_stream_read (sp->transport, buf, bufsize, &n);
+      if (rc)
+       break;
+      if (n == 0)
+       continue;
       nread += n;
       buf += n;
       bufsize -= n;
@@ -249,9 +252,13 @@ _message_stream_readdelim (struct _mu_stream *str, char 
*buf, size_t bufsize,
       if (sp->state == _mss_eof)
        break;
       rc = mu_stream_readdelim (sp->transport, buf, bufsize, delim, &n);
-      if (rc || n == 0)
+      if (rc)
        break;
+      if (n == 0)
+       continue;
       nread += n;
+      if (buf[n-1] == delim)
+       break;
       buf += n;
       bufsize -= n;
     }
diff --git a/libmu_sieve/sieve.l b/libmu_sieve/sieve.l
index 27a92d4..0f3632f 100644
--- a/libmu_sieve/sieve.l
+++ b/libmu_sieve/sieve.l
@@ -57,45 +57,44 @@ static void sieve_searchpath (void);
 static char *str_unescape (char *text, size_t len);
 static int isemptystr (char *text);
 
-static const char *input_string_ptr;
-static int input_string_level; 
+static mu_stream_t input_stream;
  
 static int
-fillbuf(char *buf, int max_size)
+fillbuf (char *buf, size_t max_size)
 {
-  if (input_string_ptr)
+  int rc;
+
+  if (!input_stream)
+    return 0;
+  
+  rc = mu_stream_read (input_stream, buf, max_size, &max_size);
+  if (rc)
     {
-      int n = input_string_level;
-      if (n > max_size)
-       n = max_size;
-      memcpy (buf, input_string_ptr, n);
-      input_string_ptr += n;
-      input_string_level -= n;
-      return n;
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_stream_read",
+                      mu_sieve_locus.source_file, rc);
+      return 0;
     }
-  else if (feof (yyin))
-    return 0;
-  else
-    return fread (buf, 1, max_size, yyin);
-} 
+  return max_size;
+}
  
 #undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result = fillbuf(buf, max_size)
+#define YY_INPUT(buf,result,max_size) result = fillbuf (buf, max_size)
 #define LEX_BUFFER_STATE YY_BUFFER_STATE
 #define SET_BUFFER_STATE(s) do { \
         (s) = YY_CURRENT_BUFFER; \
-        yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); \
+        yy_switch_to_buffer(yy_create_buffer (yyin, YY_BUF_SIZE)); \
 } while (0)
 #define RESTORE_BUFFER_STATE(s) do { \
-        yy_delete_buffer(YY_CURRENT_BUFFER); \
-        yy_switch_to_buffer(s); \
+        yy_delete_buffer (YY_CURRENT_BUFFER); \
+        yy_switch_to_buffer (s); \
 } while (0)
 
-struct buffer_ctx {
+struct buffer_ctx
+{
   struct buffer_ctx *prev;
   mu_sieve_locus_t locus;
   ino_t i_node;
-  FILE *yyin;
+  mu_stream_t input;
   LEX_BUFFER_STATE state;
 };
 
@@ -119,7 +118,8 @@ ctx_lookup (ino_t ino)
 int
 push_source (const char *name)
 {
-  FILE *fp;
+  int rc;
+  mu_stream_t stream;
   struct buffer_ctx *ctx;
   struct stat st;
         
@@ -148,13 +148,13 @@ push_source (const char *name)
                             name);
       return 1;
     }
-                
-  fp = fopen (name, "r");
-  if (!fp)
+
+  rc = mu_file_stream_create (&stream, name, MU_STREAM_READ);
+  if (rc)
     {
       mu_sv_compile_error (&mu_sieve_locus, 
                            _("cannot open file `%s': %s"),
-                          name, strerror (errno));
+                          name, mu_strerror (rc));
       return 1;
     }
 
@@ -164,16 +164,14 @@ push_source (const char *name)
       ctx = mu_sieve_alloc (sizeof (*ctx));
       ctx->locus = mu_sieve_locus;
       ctx->i_node = sieve_source_inode;
-      ctx->yyin = yyin;
+      ctx->input = input_stream;
       ctx->prev = context_stack;
       context_stack = ctx;
-      
+
       /* Switch to the new context */
-      yyin = fp;
       SET_BUFFER_STATE (ctx->state);
     }
-  else
-    yyrestart (fp);
+  input_stream = stream;
   
   mu_sieve_locus.source_file = strdup (name);
   mu_sieve_locus.source_line = 1;
@@ -189,14 +187,13 @@ pop_source ()
 {
   struct buffer_ctx *ctx;
 
-  if (yyin)
-    fclose (yyin);
+  mu_stream_destroy (&input_stream);
 
   if (mu_sieve_locus.source_file)
     free (mu_sieve_locus.source_file);
   if (!context_stack)
     {
-      yyin = NULL;
+      input_stream = NULL;
       mu_sieve_locus.source_file = NULL;
       return 1;
     }
@@ -429,12 +426,20 @@ int
 mu_sv_lex_begin_string (const char *buf, int bufsize,
                        const char *fname, int line)
 {
+  int rc;
+  
   if (!fname)
     return 1;
   yyrestart (NULL);
 
-  input_string_ptr = buf;
-  input_string_level = bufsize;
+  rc = mu_static_memory_stream_create (&input_stream, buf, bufsize);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_static_memory_stream_create",
+                      NULL, rc);
+      return 1;
+    }
+
   mu_sieve_locus.source_file = strdup (fname);
   mu_sieve_locus.source_line = line;
   sieve_source_inode = 0;
diff --git a/sieve/sieve.c b/sieve/sieve.c
index 0a4ec61..179c596 100644
--- a/sieve/sieve.c
+++ b/sieve/sieve.c
@@ -92,7 +92,9 @@ static struct argp_option options[] =
    
   {"email", 'e', N_("ADDRESS"), 0,
    N_("override user email address"), 0},
-
+  {"expression", 'E', NULL, 0,
+   N_("treat SCRIPT as Sieve program text"), 0},
+  
   {"no-program-name", ARG_NO_PROGRAM_NAME, NULL, 0,
    N_("do not prefix diagnostic messages with the program name"), 0},
   
@@ -106,6 +108,7 @@ int debug_level;
 int sieve_debug;
 int verbose;
 char *script;
+int expression_option;
 
 static int sieve_print_locus = 1; /* Should the log messages include the
                                     locus */
@@ -172,6 +175,10 @@ parser (int key, char *arg, struct argp_state *state)
   
   switch (key)
     {
+    case 'E':
+      expression_option = 1;
+      break;
+      
     case 'e':
       mu_argp_node_list_new (lst, "email", arg);
       break;
@@ -510,8 +517,12 @@ main (int argc, char *argv[])
   mu_sieve_set_debug (mach, _sieve_debug_printer);
   if (verbose)
     mu_sieve_set_logger (mach, _sieve_action_log);
-  
-  rc = mu_sieve_compile (mach, script);
+
+  if (expression_option)
+    rc = mu_sieve_compile_buffer (mach, script, strlen (script),
+                                 "stdin", 1);
+  else
+    rc = mu_sieve_compile (mach, script);
   if (rc)
     return EX_CONFIG;
 


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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