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

Re: serious bug. Evolution and Microsoft mentality.



Actually the attached patch is the "correct one". There is no need to
memset and you should use PATH_MAX rather than 4096.

Jeff

On Wed, 2002-01-09 at 23:36, Jonathan Walther wrote:
> On Wed, Jan 09, 2002 at 07:38:43PM -0500, Jeffrey Stedfast wrote:
> >Oops, copy/paste-o when migrating the patch to the 1-0 code base.
> 
> Here is the correct patch for the 1.0.x branch.  Hopefully the Debian
> maintainer will apply it?  I am creating an Evolution 1.0-5.1 package
> on my system with the patch applied.  I haven't seen so many signal 11's
> in aeons.
> 
> Index: camel/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
> --- evolution/camel/providers/local/camel-local-folder.c        2001/10/28 05:10:55     1.22
> +++ evolution/camel/providers/local/camel-local-folder.c        2002/01/09 21:44:15
> @@ -23,8 +23,9 @@
>  #include <config.h>
>  #endif
>  
>  #include <stdlib.h>
> +#include <limits.h>
>  #include <sys/types.h>
>  #include <dirent.h>
>  #include <sys/stat.h>
>  #include <unistd.h>
> @@ -173,8 +174,9 @@
>  	CamelFolder *folder;
>  	const char *root_dir_path, *name;
>  	struct stat st;
>  	int forceindex;
> +	char folder_path[4096];
>  
>  	folder = (CamelFolder *)lf;
>  
>  	name = strrchr(full_name, '/');
> @@ -190,8 +192,16 @@
>  	lf->base_path = g_strdup(root_dir_path);
>  	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 */
> +	  memset(folder_path, 0, sizeof folder_path);
> +	  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 */
-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj@ximian.com  - 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/10 17:30:10
@@ -1,3 +1,11 @@
+2002-01-09  Jeffrey Stedfast  <fejj@ximian.com>
+
+	* 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  <fejj@ximian.com>
 
 	* 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/10 17:30:10
@@ -24,6 +24,7 @@
 #endif
 
 #include <stdlib.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/stat.h>
@@ -172,6 +173,7 @@
 	CamelFolderInfo *fi;
 	CamelFolder *folder;
 	const char *root_dir_path, *name;
+	char folder_path[PATH_MAX];
 	struct stat st;
 	int forceindex;
 
@@ -191,7 +193,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 */

Reply to: