[maemo-commits] [maemo-commits] r9567 - in projects/haf/trunk/osso-gnome-vfs2/debian: . patches

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Feb 2 16:10:13 EET 2007
Author: richard
Date: 2007-02-02 16:10:12 +0200 (Fri, 02 Feb 2007)
New Revision: 9567

Added:
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-http-mime-type-and-name.patch
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-case-and-query.diff
Removed:
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-NB10173-http-mime-type.patch
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-caseless-strip-fragment.patch
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/06-mime-http-strip-fragment.patch
Modified:
   projects/haf/trunk/osso-gnome-vfs2/debian/changelog
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/07-mmc-card-name.patch
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/27-workaround-broken-http-servers.patch
Log:
Prepare for release.

Modified: projects/haf/trunk/osso-gnome-vfs2/debian/changelog
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/changelog	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/changelog	2007-02-02 14:10:12 UTC (rev 9567)
@@ -1,8 +1,11 @@
 osso-gnome-vfs2 (2.16.3-1osso6) unstable; urgency=low
 
   * Split out samba package into its own binary package
+  * Port NB#50018 from stable branch, jam when network goes down
+  * Fixes: NB#48919, Mime type of files with "#" in the name is not detected
+  * Fixes: NB#41904, File Manager; Non Translated; After renaming the MMC...
 
- -- Richard Hult <richard at imendio.com>  Tue, 30 Jan 2007 10:14:36 +0100
+-- Richard Hult <richard at imendio.com>  Fri,  2 Feb 2007 15:09:38 +0100
 
 osso-gnome-vfs2 (2.16.3-1osso5) unstable; urgency=low
 

Deleted: projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-NB10173-http-mime-type.patch
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-NB10173-http-mime-type.patch	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-NB10173-http-mime-type.patch	2007-02-02 14:10:12 UTC (rev 9567)
@@ -1,39 +0,0 @@
-? compile
-? gnome-vfs-zip
-? index.html
-Index: modules/http-neon-method.c
-===================================================================
-RCS file: /cvs/gnome/gnome-vfs/modules/http-neon-method.c,v
-retrieving revision 1.40
-diff -u -p -r1.40 http-neon-method.c
---- modules/http-neon-method.c	15 Sep 2006 19:31:00 -0000	1.40
-+++ modules/http-neon-method.c	10 Oct 2006 11:12:17 -0000
-@@ -1104,9 +1104,7 @@ std_headers_to_file_info (ne_request *re
- 	
- 	value  = ne_get_response_header (req, "Content-Type");
- 
--	if (value != NULL) {
--		g_free (info->mime_type);
--
-+	if (value != NULL && info->mime_type == NULL) {
- 		info->mime_type = strip_semicolon (value);
- 		info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
- 	}
-@@ -1827,9 +1825,17 @@ http_get_file_info (HttpContext *context
- 	ne_propfind_handler *pfh;
- 	ne_request *req;
- 	int res;
-+	const gchar *mime_type;
- 
- 	DEBUG_HTTP_CONTEXT (context);
- 	
-+	/* Let's fill in the mime type first */
-+	mime_type = gnome_vfs_mime_type_from_name_or_default (context->path, NULL);
-+	if (!mime_type || strcmp (mime_type, "application/octet-stream") != 0) {
-+		info->mime_type = g_strdup (mime_type);
-+		info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
-+	}
-+
- 	/* no dav server */
- 	if (context->dav_mode == FALSE || context->dav_class == NO_DAV) 
- 		goto head_start;

Added: projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-http-mime-type-and-name.patch
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-http-mime-type-and-name.patch	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/01-http-mime-type-and-name.patch	2007-02-02 14:10:12 UTC (rev 9567)
@@ -0,0 +1,85 @@
+--- modules/http-neon-method.c-unmod	2007-02-01 12:26:44.000000000 +0100
++++ modules/http-neon-method.c	2007-02-01 17:30:33.000000000 +0100
+@@ -1104,9 +1104,8 @@ std_headers_to_file_info (ne_request *re
+ 	
+ 	value  = ne_get_response_header (req, "Content-Type");
+ 
+-	if (value != NULL) {
+-		g_free (info->mime_type);
+-
++	if (value != NULL && info->mime_type == NULL) {
++		g_print ("get from server: %s\n", value);
+ 		info->mime_type = strip_semicolon (value);
+ 		info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
+ 	}
+@@ -1819,6 +1818,19 @@ http_follow_redirect (HttpContext *conte
+ /* ************************************************************************** */
+ /* Http operations */
+ 
++static char *
++strip_query (const char *path)
++{
++	const char *tmp;
++
++	tmp = strchr (path, '?');
++	if (tmp == NULL) {
++		return g_strdup (path);
++	}
++
++	return g_strndup (path, tmp - path);
++}
++
+ static GnomeVFSResult
+ http_get_file_info (HttpContext *context, GnomeVFSFileInfo *info)
+ {
+@@ -1827,9 +1839,21 @@ http_get_file_info (HttpContext *context
+ 	ne_propfind_handler *pfh;
+ 	ne_request *req;
+ 	int res;
++	char *stripped;
++	const char *mime_type;
+ 
+ 	DEBUG_HTTP_CONTEXT (context);
+ 	
++	/* First try getting the local mime type just from the filename. See
++	 * NB#10173.
++	 */
++	stripped = strip_query (context->path);
++	mime_type = gnome_vfs_mime_type_from_name_or_default (stripped, NULL);
++	g_free (stripped);
++	if (mime_type && strcmp (mime_type, "application/octet-stream") == 0) {
++		mime_type = NULL;
++	}
++
+ 	/* no dav server */
+ 	if (context->dav_mode == FALSE || context->dav_class == NO_DAV) 
+ 		goto head_start;
+@@ -1917,13 +1941,26 @@ http_get_file_info (HttpContext *context
+ 	result = resolve_result (res, req);	
+ 	
+ 	if (result == GNOME_VFS_OK) {
+-		const char *name;	
++		const char *name;
++		char *stripped;
+ 		
+ 		name = gnome_vfs_uri_get_path (context->uri);
+ 	
+ 		gnome_vfs_file_info_clear (info);
++
++		/* Keep any mime type we got from the filename above. */
++		if (mime_type) {
++			info->mime_type = g_strdup (mime_type);
++			info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
++		}
++
++		/* Remove any "?foobar", that shouldn't be part of the name. See
++		 * NB#19530.
++		 */
++		stripped = strip_query (name);
++		info->name  = g_path_get_basename (stripped);
++		g_free (stripped);
+ 		
+-		info->name  = g_path_get_basename (name);
+ 		info->type  = GNOME_VFS_FILE_TYPE_REGULAR;
+ 		info->flags = GNOME_VFS_FILE_FLAGS_NONE;
+ 		

Added: projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-case-and-query.diff
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-case-and-query.diff	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-case-and-query.diff	2007-02-02 14:10:12 UTC (rev 9567)
@@ -0,0 +1,96 @@
+--- libgnomevfs/gnome-vfs-mime.c-unmod	2007-02-01 17:00:23.000000000 +0100
++++ libgnomevfs/gnome-vfs-mime.c	2007-02-01 17:38:39.000000000 +0100
+@@ -99,15 +99,21 @@ gnome_vfs_mime_type_from_name_or_default
+ {
+ 	const char *mime_type;
+ 	const char *separator;
++	char       *lower;
+ 
+ 	if (filename == NULL) {
+ 		return defaultv;
+ 	}
+ 
+-	separator = strrchr (filename, '/');
++	/* Convert to lower case to implement a poor man's case insensitive mime
++         * type lookup. See NB#18581.
++         */
++ 	lower = g_utf8_strdown (filename, -1);
++
++	separator = strrchr (lower, '/');
+ #ifdef G_OS_WIN32
+ 	{
+-		const char *sep2 = strrchr (filename, '\\');
++		const char *sep2 = strrchr (lower, '\\');
+ 		if (separator == NULL ||
+ 		    (sep2 != NULL && sep2 > separator))
+ 			separator = sep2;
+@@ -115,16 +121,20 @@ gnome_vfs_mime_type_from_name_or_default
+ #endif
+ 	if (separator != NULL) {
+ 		separator++;
+-		if (*separator == '\000')
++		if (*separator == '\000') {
++			g_free (lower);
+ 			return defaultv;
++		}
+ 	} else {
+-		separator = filename;
++		separator = lower;
+ 	}
+ 
+ 	G_LOCK (gnome_vfs_mime_mutex);
+ 	mime_type = xdg_mime_get_mime_type_from_file_name (separator);
+ 	G_UNLOCK (gnome_vfs_mime_mutex);
+ 
++ 	g_free (lower);
++
+ 	if (mime_type)
+ 		return mime_type;
+ 	else
+@@ -209,20 +219,37 @@ gnome_vfs_get_mime_type_for_name_and_dat
+ 	return mime_type;
+ }
+ 
++static char *
++strip_query (const char *path)
++{
++	const char *tmp;
++
++	tmp = strchr (path, '?');
++	if (tmp == NULL) {
++		return g_strdup (path);
++	}
++
++	return g_strndup (path, tmp - path);
++}
++
+ static const char *
+ gnome_vfs_get_mime_type_from_uri_internal (GnomeVFSURI *uri)
+ {
+-	char *base_name;
++	const char *path;
+ 	const char *mime_type;
++	char       *stripped;
+ 
+-	/* Return a mime type based on the file extension or NULL if no match. */
+-	base_name = gnome_vfs_uri_extract_short_path_name (uri);
+-	if (base_name == NULL) {
+-		return NULL;
+-	}
+-
+-	mime_type = gnome_vfs_mime_type_from_name_or_default (base_name, NULL);
+-	g_free (base_name);
++	/* Strip off any query string, see NB#19530. The reason we get the path
++	 * instead of gnome_vfs_uri_extract_short_name is that the latter will
++	 * do the wrong thing for things like: http://foo.bar/file?abc=/dsa/gfd
++	 * (it will just take the last slash and return the part after it,
++	 * instead of "file".
++	 */
++	path = gnome_vfs_uri_get_path (uri);
++	stripped = strip_query (path);
++	mime_type = gnome_vfs_mime_type_from_name_or_default (stripped, NULL);
++	g_free (stripped);
++	
+ 	return mime_type;
+ }
+ 

Deleted: projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-caseless-strip-fragment.patch
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-caseless-strip-fragment.patch	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/05-mime-caseless-strip-fragment.patch	2007-02-02 14:10:12 UTC (rev 9567)
@@ -1,80 +0,0 @@
---- libgnomevfs/gnome-vfs-mime.c-unmod	2006-10-18 12:34:42.000000000 +0200
-+++ libgnomevfs/gnome-vfs-mime.c	2006-10-18 12:46:05.000000000 +0200
-@@ -99,15 +99,31 @@ gnome_vfs_mime_type_from_name_or_default
- {
- 	const char *mime_type;
- 	const char *separator;
-+	char       *lower;
-+	char       *tail;
- 
- 	if (filename == NULL) {
- 		return defaultv;
- 	}
- 
--	separator = strrchr (filename, '/');
-+	/* Convert to lower case to implement a poor man's case insensitive mime
-+         * type lookup.
-+         */
-+ 	lower = g_utf8_strdown (filename, -1);
-+
-+	/* Strip out any fragments or query strings. */
-+        tail = g_utf8_strchr (lower, -1, '?');
-+        if (!tail) {
-+                tail = g_utf8_strchr (lower, -1, '#');
-+        }
-+        if (tail) {
-+                *tail = '\0';
-+        }
-+	
-+	separator = strrchr (lower, '/');
- #ifdef G_OS_WIN32
- 	{
--		const char *sep2 = strrchr (filename, '\\');
-+		const char *sep2 = strrchr (lower, '\\');
- 		if (separator == NULL ||
- 		    (sep2 != NULL && sep2 > separator))
- 			separator = sep2;
-@@ -115,16 +131,20 @@ gnome_vfs_mime_type_from_name_or_default
- #endif
- 	if (separator != NULL) {
- 		separator++;
--		if (*separator == '\000')
-+		if (*separator == '\000') {
-+			g_free (lower);
- 			return defaultv;
-+		}
- 	} else {
--		separator = filename;
-+		separator = lower;
- 	}
- 
- 	G_LOCK (gnome_vfs_mime_mutex);
- 	mime_type = xdg_mime_get_mime_type_from_file_name (separator);
- 	G_UNLOCK (gnome_vfs_mime_mutex);
- 
-+ 	g_free (lower);
-+
- 	if (mime_type)
- 		return mime_type;
- 	else
-@@ -212,17 +232,12 @@ gnome_vfs_get_mime_type_for_name_and_dat
- static const char *
- gnome_vfs_get_mime_type_from_uri_internal (GnomeVFSURI *uri)
- {
--	char *base_name;
-+	const char *path;
- 	const char *mime_type;
- 
--	/* Return a mime type based on the file extension or NULL if no match. */
--	base_name = gnome_vfs_uri_extract_short_path_name (uri);
--	if (base_name == NULL) {
--		return NULL;
--	}
-+	path = gnome_vfs_uri_get_path (uri);
-+	mime_type = gnome_vfs_mime_type_from_name_or_default (path, NULL);
- 
--	mime_type = gnome_vfs_mime_type_from_name_or_default (base_name, NULL);
--	g_free (base_name);
- 	return mime_type;
- }
- 

Deleted: projects/haf/trunk/osso-gnome-vfs2/debian/patches/06-mime-http-strip-fragment.patch
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/06-mime-http-strip-fragment.patch	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/06-mime-http-strip-fragment.patch	2007-02-02 14:10:12 UTC (rev 9567)
@@ -1,36 +0,0 @@
---- modules/http-neon-method.c-unmod	2006-10-18 12:46:15.000000000 +0200
-+++ modules/http-neon-method.c	2006-10-18 12:46:24.000000000 +0200
-@@ -1923,10 +1923,21 @@ http_get_file_info (HttpContext *context
- 	result = resolve_result (res, req);	
- 	
- 	if (result == GNOME_VFS_OK) {
--		const char *name;	
--		
--		name = gnome_vfs_uri_get_path (context->uri);
--	
-+		const gchar *name;	
-+		gchar *tail;
-+
-+		name = gnome_vfs_uri_get_path (context->uri); 
-+
-+		/* Strip out any fragments or query strings. */
-+		tail = g_utf8_strchr (name, -1, '?');
-+		if (!tail) {
-+			tail = g_utf8_strchr (name, -1, '#');
-+		}
-+
-+		if (tail) {
-+			*tail = '\0';
-+		}
-+
- 		gnome_vfs_file_info_clear (info);
- 		
- 		info->name  = g_path_get_basename (name);
-@@ -1942,7 +1953,6 @@ http_get_file_info (HttpContext *context
- 		    && ! g_ascii_strcasecmp (info->mime_type, "audio/mpeg")) {
- 			ne_close_connection (ne_get_session (req));
- 		}
--		
- 	}
- 	
- 	ne_request_destroy (req);

Modified: projects/haf/trunk/osso-gnome-vfs2/debian/patches/07-mmc-card-name.patch
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/07-mmc-card-name.patch	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/07-mmc-card-name.patch	2007-02-02 14:10:12 UTC (rev 9567)
@@ -1,5 +1,5 @@
---- libgnomevfs/gnome-vfs-volume-monitor-daemon.c-orig	2006-10-18 12:10:56.000000000 +0200
-+++ libgnomevfs/gnome-vfs-volume-monitor-daemon.c	2006-10-18 12:11:17.000000000 +0200
+--- libgnomevfs/gnome-vfs-volume-monitor-daemon.c-unmod	2007-02-02 10:45:54.000000000 +0100
++++ libgnomevfs/gnome-vfs-volume-monitor-daemon.c	2007-02-02 14:51:36.000000000 +0100
 @@ -25,6 +25,12 @@
  
  #include <string.h>
@@ -13,7 +13,7 @@
  #include <libgnomevfs/gnome-vfs-utils.h>
  #include <glib/gi18n-lib.h>
  
-@@ -837,10 +843,76 @@ modify_volume_name_for_display (const ch
+@@ -837,10 +843,119 @@ modify_volume_name_for_display (const ch
  	return name;
  }
  
@@ -24,14 +24,51 @@
 +#define MMC_LABEL_UNDEFINED_NAME          "mmc-undefined-name"
 +#define MMC_LABEL_UNDEFINED_NAME_INTERNAL "mmc-undefined-name-internal"
 +
++/* Same as make_utf8 but without adding "Invalid unicode". */
 +static char *
++make_utf8_barebone (const char *name)
++{
++	GString    *string;
++	const char *remainder, *invalid;
++	int         remaining_bytes, valid_bytes;
++
++	string = NULL;
++	remainder = name;
++	remaining_bytes = strlen (name);
++
++	while (remaining_bytes != 0) {
++		if (g_utf8_validate (remainder, remaining_bytes, &invalid)) {
++			break;
++		}
++		valid_bytes = invalid - remainder;
++
++		if (string == NULL) {
++			string = g_string_sized_new (remaining_bytes);
++		}
++		g_string_append_len (string, remainder, valid_bytes);
++		g_string_append_c (string, '?');
++
++		remaining_bytes -= valid_bytes + 1;
++		remainder = invalid + 1;
++	}
++
++	if (string == NULL) {
++		return g_strdup (name);
++	}
++
++	g_string_append (string, remainder);
++
++	return g_string_free (string, FALSE);
++}
++
++static char *
 +get_mmc_name_from_label_file (const char *label_file,
 +			      gboolean    internal)
 +{
 +	int     fd;
 +	ssize_t size_read;
 +	char    buf[MMC_LABEL_LENGTH + 1];
-+	
++
 +	if (!g_file_test (label_file, G_FILE_TEST_EXISTS)) {
 +		goto unknown;
 +	}
@@ -46,6 +83,11 @@
 +	
 +	if (size_read > 0) {
 +		buf[size_read] = '\0';
++
++		if (!g_utf8_validate (buf, size_read, NULL)) {
++			return make_utf8_barebone (buf);
++		}
++		
 +		return g_strndup (buf, size_read);
 +	}
 +
@@ -66,6 +108,7 @@
 +	const char *mmc_mount;
 +
 +	mmc_mount = g_getenv ("MMC_MOUNTPOINT");
++
 +	if (mmc_mount && g_str_has_prefix (mount_path, mmc_mount)) {
 +		gchar *mmc_name;
 +		

Modified: projects/haf/trunk/osso-gnome-vfs2/debian/patches/27-workaround-broken-http-servers.patch
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/27-workaround-broken-http-servers.patch	2007-02-02 14:08:11 UTC (rev 9566)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/27-workaround-broken-http-servers.patch	2007-02-02 14:10:12 UTC (rev 9567)
@@ -1,8 +1,8 @@
---- modules/http-neon-method.c-unmod	2006-12-19 10:44:47.000000000 +0100
-+++ modules/http-neon-method.c	2006-12-19 10:45:49.000000000 +0100
-@@ -1817,6 +1817,41 @@ http_follow_redirect (HttpContext *conte
- /* ************************************************************************** */
- /* Http operations */
+--- modules/http-neon-method.c-unmod	2007-02-02 14:59:12.000000000 +0100
++++ modules/http-neon-method.c	2007-02-02 15:00:39.000000000 +0100
+@@ -1831,6 +1831,41 @@ strip_query (const char *path)
+ 	return g_strndup (path, tmp - path);
+ }
  
 +/* Sends a HEAD/GET request where we are not interested in any information
 + * except headers. Some broken servers send the content for HEAD requests, so we
@@ -42,7 +42,7 @@
  static GnomeVFSResult
  http_get_file_info (HttpContext *context, GnomeVFSFileInfo *info)
  {
-@@ -1903,9 +1938,18 @@ http_get_file_info (HttpContext *context
+@@ -1921,9 +1956,18 @@ http_get_file_info (HttpContext *context
  
   head_start:
  	req  = ne_request_create (context->session, "HEAD", context->path);
@@ -63,7 +63,7 @@
  	if (res == NE_REDIRECT) {
  		ne_request_destroy (req);
  		req = NULL;
-@@ -1947,12 +1991,6 @@ http_get_file_info (HttpContext *context
+@@ -1967,13 +2011,6 @@ http_get_file_info (HttpContext *context
  		info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE;
  
  		std_headers_to_file_info (req, info);
@@ -73,6 +73,7 @@
 -		    && ! g_ascii_strcasecmp (info->mime_type, "audio/mpeg")) {
 -			ne_close_connection (ne_get_session (req));
 -		}
+-		
  	}
  	
  	ne_request_destroy (req);


More information about the maemo-commits mailing list