On Wed, 2002-01-09 at 16:20, Jonathan Walther wrote: > On Wed, Jan 09, 2002 at 01:41:28PM -0500, Jeffrey Stedfast wrote: > >> Unfortunately, no. I made no changes whatsoever to the mailboxes. I > >> just entered them to see if the messages showed up, they did, then I > >> exited. Thats when I noticed the symlinks had been blown away, and the > >> resulting "copied" mailbox was bigger in size than the original! > > > >Ah, I bet I know why... Evolution added an X-Evolution header to each > >message for status purposes. The X-Evolution header contains an encoded > >UID and message flags. That would also explain why it got bigger than > >the original file. > > Fair enough. Pine does something similar. Can it be gauranteed that > the Quoted Printable encoding hasn't been decoded then reencoded in > the process?
not easily. Michael Zucchi and I will have to redesign libcamel to be able to guarantee this and so must wait until we have time. > > >Actually, this isn't guaranteed to work :-( > >rename() is unfortunately limited to renaming files on the same file > >system, once you add symlinks to the equation - you could be leaping > >across file system boundaries and there isn't a way to tell (well, ok, > >so you can check st.st_dev and compare the 2). > > > >The only way I can think of to get around this is to create the tmp mbox > >file in the same directory as the original (after being realpath()'d). > >This may also have problems - what if you don't have write-permission in > >that directory? > > You solved the problem. That is the correct solution. After running > realpath(), use dirname() and make the tmpfile in the same directory > as the mailbox. > [snip] The attached patch will fix this issue. > > >> Again, provided one uses Maildir mailboxes, things will be fine. But > >> the thought occurs, Evolution should do its "locking" on the file > >> returned from realpath() too. > > > >You are probably right. > > I've thought about it some more, and I'm upgrading my "maybe" to a > strong "this is the proper way to do it". Symlinks should not be > locked. They should be followed with realpath() and the real mailbox > should be locked, like other MUA's do. This will truly make it > compatible and play nicely on the Unix system. It also fixes this. -- Jeffrey Stedfast Evolution Hacker - Ximian, Inc. [EMAIL PROTECTED] - www.ximian.com
Index: ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/camel/ChangeLog,v retrieving revision 1.1311.2.11 diff -u -r1.1311.2.11 ChangeLog --- ChangeLog 2002/01/04 22:17:52 1.1311.2.11 +++ ChangeLog 2002/01/09 21:44:15 @@ -1,3 +1,11 @@ +2002-01-09 Jeffrey Stedfast <[EMAIL PROTECTED]> + + * providers/local/camel-local-folder.c + (camel_local_folder_construct): If the mbox file is a symlink, + follow the symlink and get the One True Path so that we can + rewrite the mbox later without worrying about clobbering the + symlink. + 2001-12-12 Jeffrey Stedfast <[EMAIL PROTECTED]> * camel-folder-summary.c (content_info_load): Don't try setting a Index: providers/local/camel-local-folder.c =================================================================== RCS file: /cvs/gnome/evolution/camel/providers/local/camel-local-folder.c,v retrieving revision 1.22 diff -u -r1.22 camel-local-folder.c --- providers/local/camel-local-folder.c 2001/10/28 05:10:55 1.22 +++ providers/local/camel-local-folder.c 2002/01/09 21:44:15 @@ -24,6 +24,7 @@ #endif #include <stdlib.h> +#include <limits.h> #include <sys/types.h> #include <dirent.h> #include <sys/stat.h> @@ -191,7 +192,14 @@ lf->folder_path = g_strdup_printf("%s/%s", root_dir_path, full_name); lf->summary_path = g_strdup_printf("%s/%s.ev-summary", root_dir_path, full_name); lf->index_path = g_strdup_printf("%s/%s.ibex", root_dir_path, full_name); - + + /* follow any symlinks to the mailbox */ + if (lstat (lf->folder_path, &st) != -1 && S_ISLNK (st.st_mode) && + realpath (lf->folder_path, folder_path) != NULL) { + g_free (lf->folder_path); + lf->folder_path = g_strdup (folder_path); + } + lf->changes = camel_folder_change_info_new(); /* if we have no index file, force it */