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-519-gc42e619


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-519-gc42e619
Date: Mon, 12 Dec 2011 00:18:09 +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=c42e619475166b5a6385d52fa0ed5f301d9db0b8

The branch, master has been updated
       via  c42e619475166b5a6385d52fa0ed5f301d9db0b8 (commit)
       via  eae05c42b532d99b2b946eeb04e442d462d223b5 (commit)
      from  61378abc8e046b457365a30c6b80559b0540177e (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 c42e619475166b5a6385d52fa0ed5f301d9db0b8
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 12 02:16:21 2011 +0200

    Bugfix in imap4d.
    
    * imap4d/util.c (util_getfullpath): Use mu_stpcpy.

commit eae05c42b532d99b2b946eeb04e442d462d223b5
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 12 01:48:21 2011 +0200

    Fix UID generation in mboxes (complements f9a034c7)
    
    * libproto/mbox/mboxscan.c (mbox_scan_internal): Fix UID generation.
    * testsuite/lstuid.c: New test program.
    * testsuite/lstuid00.at: New test case.
    * testsuite/lstuid01.at: Likewise.
    * testsuite/lstuid02.at: Likewise.
    * testsuite/Makefile.am: Add new test cases.
    * testsuite/testsuite.at: Likewise.

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

Summary of changes:
 imap4d/util.c                                     |    2 +-
 libproto/mbox/mboxscan.c                          |   10 ++----
 testsuite/Makefile.am                             |    4 ++
 testsuite/{mbdel.c => lstuid.c}                   |   34 ++++++++++----------
 testsuite/{testsuite.at => lstuid00.at}           |   20 ++++++++----
 imap4d/tests/create01.at => testsuite/lstuid01.at |   32 ++++++++++---------
 imap4d/tests/create01.at => testsuite/lstuid02.at |   32 ++++++++++---------
 testsuite/testsuite.at                            |    3 ++
 8 files changed, 76 insertions(+), 61 deletions(-)
 copy testsuite/{mbdel.c => lstuid.c} (61%)
 copy testsuite/{testsuite.at => lstuid00.at} (76%)
 copy imap4d/tests/create01.at => testsuite/lstuid01.at (73%)
 copy imap4d/tests/create01.at => testsuite/lstuid02.at (73%)

diff --git a/imap4d/util.c b/imap4d/util.c
index a017cd8..e520735 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -37,7 +37,7 @@ util_getfullpath (const char *name, const char *delim)
        malloc (strlen (imap4d_homedir) + strlen (delim) + strlen (exp) + 1);
       if (!s)
        imap4d_bye (ERR_NO_MEM);
-      p = strcpy (s, imap4d_homedir);
+      p = mu_stpcpy (s, imap4d_homedir);
       p = mu_stpcpy (p, (char*) delim);
       strcpy (p, exp);
       free (exp);
diff --git a/libproto/mbox/mboxscan.c b/libproto/mbox/mboxscan.c
index 4fcceea..d0c5ace 100644
--- a/libproto/mbox/mboxscan.c
+++ b/libproto/mbox/mboxscan.c
@@ -367,14 +367,12 @@ mbox_scan_internal (mu_mailbox_t mailbox, mbox_message_t 
mum,
                  mum->body_end = total - n - newline;
                  mum->body_lines = --lines - newline;
 
-                 if (mum->uid <= min_uid)
+                 if (mum->uid == 0)
                    {
                      mum->uid = ++min_uid;
                      /* Note that modification for when expunging.  */
                      mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
                    }
-                 else
-                   min_uid = mum->uid;
 
                  if (flags & MBOX_SCAN_ONEMSG)
                    break;
@@ -403,7 +401,7 @@ mbox_scan_internal (mu_mailbox_t mailbox, mbox_message_t 
mum,
            {
              char *p;
              unsigned long n = strtoul (buf + 6, &p, 10);
-             if (*p == 0 || mu_isspace (*p))
+             if ((*p == 0 || mu_isspace (*p)) && n > min_uid)
                mum->uid = min_uid = n;
            }
          else if (mud->messages_count == 1 && IS_X_IMAPBASE (buf))
@@ -451,14 +449,12 @@ mbox_scan_internal (mu_mailbox_t mailbox, mbox_message_t 
mum,
       mum->body_end = total - newline;
       mum->body_lines = lines - newline;
 
-      if (mum->uid <= min_uid)
+      if (mum->uid == 0)
        {
          mum->uid = ++min_uid;
          /* Note that modification for when expunging.  */
          mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
        }
-      else
-       min_uid = mum->uid;
       
       if (flags & MBOX_SCAN_NOTIFY)
        DISPATCH_ADD_MSG (mailbox, mud);
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 61144e3..1707985 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -50,6 +50,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
 
 INCLUDES = @MU_LIB_COMMON_INCLUDES@ 
 noinst_PROGRAMS = \
+ lstuid\
  mbdel\
  mimetest\
  smtpsend\
@@ -77,6 +78,9 @@ smtpsend_LDADD = \
 ## ------------ ##
 
 TESTSUITE_AT = \
+ lstuid00.at\
+ lstuid01.at\
+ lstuid02.at\
  mbdel.at\
  mime.at\
  ufms.at\
diff --git a/testsuite/mbdel.c b/testsuite/lstuid.c
similarity index 61%
copy from testsuite/mbdel.c
copy to testsuite/lstuid.c
index 8451df5..95274cd 100644
--- a/testsuite/mbdel.c
+++ b/testsuite/lstuid.c
@@ -1,5 +1,5 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+/* lstuid.c: List UIDs in mailbox
+   Copyright (C) 2011 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -25,30 +25,30 @@
 int
 main (int argc, char **argv)
 {
-  int rc;
   mu_mailbox_t mbox;
+  size_t i, count;
+  mu_message_t msg;
   
   if (argc != 2)
     {
-      fprintf (stderr, "usage: %s URL\n", argv[0]);
+      fprintf (stderr, "usage: %s MBOX\n", argv[0]);
       return 1;
     }
 
-  mu_register_all_mbox_formats ();
-  
+  mu_registrar_record (mu_mbox_record);
+
+  /* Open the mailbox */
   MU_ASSERT (mu_mailbox_create (&mbox, argv[1]));
-  rc = mu_mailbox_remove (mbox);
-  if (rc)
+  MU_ASSERT (mu_mailbox_open (mbox, MU_STREAM_RDWR));
+  mu_mailbox_messages_count (mbox, &count);
+  for (i = 1; i <= count; i++)
     {
-      if (rc == ENOTEMPTY)
-       {
-         printf ("mailbox removed, but has subfolders\n");
-         rc = 0;
-       }
-      else
-       fprintf (stderr, "%s\n", mu_strerror (rc));
+      size_t uid;
+      MU_ASSERT (mu_mailbox_get_message (mbox, i, &msg));
+      MU_ASSERT (mu_message_get_uid (msg, &uid));
+      printf ("%lu: %lu\n", (unsigned long) i, (unsigned long) uid);
     }
+  mu_mailbox_close (mbox);
   mu_mailbox_destroy (&mbox);
-  
-  return rc != 0;
+  return 0;
 }
diff --git a/testsuite/testsuite.at b/testsuite/lstuid00.at
similarity index 76%
copy from testsuite/testsuite.at
copy to testsuite/lstuid00.at
index 92e9c54..ee37189 100644
--- a/testsuite/testsuite.at
+++ b/testsuite/lstuid00.at
@@ -1,5 +1,5 @@
 # This file is part of GNU Mailutils. -*- Autotest -*-
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011 Free Software Foundation, Inc.
 #
 # GNU Mailutils is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -14,10 +14,18 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
-m4_include([testsuite.inc])
+AT_SETUP([Assigning UIDs])
 
-AT_INIT
+AT_CHECK([
+MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox1)
+lstuid mbox:mbox1
+],
+[0],
+[1: 1
+2: 2
+3: 3
+4: 4
+5: 5
+])
 
-m4_include([mime.at])
-m4_include([mbdel.at])
-m4_include([ufms.at])
+AT_CLEANUP
\ No newline at end of file
diff --git a/imap4d/tests/create01.at b/testsuite/lstuid01.at
similarity index 73%
copy from imap4d/tests/create01.at
copy to testsuite/lstuid01.at
index 986eb86..06c13a7 100644
--- a/imap4d/tests/create01.at
+++ b/testsuite/lstuid01.at
@@ -14,25 +14,27 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
-AT_SETUP([create])
-AT_KEYWORDS([create create00])
+AT_SETUP([Assigning UIDs (with gaps)])
+
+AT_DATA([x-uid.sed],
+[/^Subject: Jabberwocky/a\
+X-UID: 2
+
+/^Subject: Simple MIME/a\
+X-UID: 10
 
-AT_CHECK([
-AT_DATA([input],[dnl
-1 create flat
-X LOGOUT
 ])
 
-imap4d IMAP4D_OPTIONS < input | tr -d '\r'
-find . -name flat
+AT_CHECK([
+sed -f x-uid.sed $abs_top_srcdir/testsuite/spool/mbox1 > mbox1
+lstuid mbox:mbox1
 ],
 [0],
-[* PREAUTH IMAP4rev1 Test mode
-1 OK CREATE Completed
-* BYE Session terminating.
-X OK LOGOUT Completed
-./flat
+[1: 2
+2: 3
+3: 10
+4: 11
+5: 12
 ])
 
-AT_CLEANUP
-
+AT_CLEANUP
\ No newline at end of file
diff --git a/imap4d/tests/create01.at b/testsuite/lstuid02.at
similarity index 73%
copy from imap4d/tests/create01.at
copy to testsuite/lstuid02.at
index 986eb86..42d9729 100644
--- a/imap4d/tests/create01.at
+++ b/testsuite/lstuid02.at
@@ -14,25 +14,27 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
-AT_SETUP([create])
-AT_KEYWORDS([create create00])
+AT_SETUP([Assigning UIDs (with fixups)])
+
+AT_DATA([x-uid.sed],
+[/^Subject: Jabberwocky/a\
+X-UID: 2
+
+/^Subject: Simple MIME/a\
+X-UID: 1
 
-AT_CHECK([
-AT_DATA([input],[dnl
-1 create flat
-X LOGOUT
 ])
 
-imap4d IMAP4D_OPTIONS < input | tr -d '\r'
-find . -name flat
+AT_CHECK([
+sed -f x-uid.sed $abs_top_srcdir/testsuite/spool/mbox1 > mbox1
+lstuid mbox:mbox1
 ],
 [0],
-[* PREAUTH IMAP4rev1 Test mode
-1 OK CREATE Completed
-* BYE Session terminating.
-X OK LOGOUT Completed
-./flat
+[1: 2
+2: 3
+3: 4
+4: 5
+5: 6
 ])
 
-AT_CLEANUP
-
+AT_CLEANUP
\ No newline at end of file
diff --git a/testsuite/testsuite.at b/testsuite/testsuite.at
index 92e9c54..48bbe1a 100644
--- a/testsuite/testsuite.at
+++ b/testsuite/testsuite.at
@@ -18,6 +18,9 @@ m4_include([testsuite.inc])
 
 AT_INIT
 
+m4_include([lstuid00.at])
+m4_include([lstuid01.at])
+m4_include([lstuid02.at])
 m4_include([mime.at])
 m4_include([mbdel.at])
 m4_include([ufms.at])


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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