Bugzilla – Attachment 233121 Details for
Bug 368628
gvfs: Random crashes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
gvfs-from-0.2.3-to-20080812.patch
gvfs-from-0.2.3-to-20080812.patch (text/plain), 30.55 KB, created by
Hans Petter Jansson
on 2008-08-13 07:25:32 UTC
(
hide
)
Description:
gvfs-from-0.2.3-to-20080812.patch
Filename:
MIME Type:
Creator:
Hans Petter Jansson
Created:
2008-08-13 07:25:32 UTC
Size:
30.55 KB
patch
obsolete
>diff -upr gvfs-0.2.3-pre/client/gdaemonfile.c gvfs-0.2.3-post/client/gdaemonfile.c >--- gvfs-0.2.3-pre/client/gdaemonfile.c 2008-04-08 03:27:44.000000000 +0200 >+++ gvfs-0.2.3-post/client/gdaemonfile.c 2008-08-13 06:48:47.930196000 +0200 >@@ -1892,6 +1892,8 @@ g_daemon_file_set_attribute (GFile *file > NULL, NULL, NULL, > cancellable, &my_error); > >+ dbus_message_unref (message); >+ > if (reply == NULL) > { > if (g_error_matches (my_error, G_VFS_ERROR, G_VFS_ERROR_RETRY)) >diff -upr gvfs-0.2.3-pre/client/gdaemonvfs.c gvfs-0.2.3-post/client/gdaemonvfs.c >--- gvfs-0.2.3-pre/client/gdaemonvfs.c 2008-04-08 03:27:44.000000000 +0200 >+++ gvfs-0.2.3-post/client/gdaemonvfs.c 2008-08-13 06:48:47.945181000 +0200 >@@ -298,6 +298,8 @@ g_daemon_vfs_init (GDaemonVfs *vfs) > > vfs->wrapped_vfs = g_vfs_get_local (); > >+ dbus_connection_set_exit_on_disconnect (vfs->async_bus, FALSE); >+ > _g_dbus_connection_integrate_with_main (vfs->async_bus); > > modules = g_io_modules_load_all_in_directory (GVFS_MODULE_DIR); >@@ -950,6 +952,13 @@ void g_vfs_uri_mapper_sftp_register (GIO > void > g_io_module_load (GIOModule *module) > { >+ /* This is so that system daemons can use gio >+ * without spawning private dbus instances. >+ * See bug 526454. >+ */ >+ if (g_getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) >+ return; >+ > g_daemon_vfs_register_type (G_TYPE_MODULE (module)); > g_daemon_volume_monitor_register_types (G_TYPE_MODULE (module)); > >diff -upr gvfs-0.2.3-pre/client/gvfsfusedaemon.c gvfs-0.2.3-post/client/gvfsfusedaemon.c >--- gvfs-0.2.3-pre/client/gvfsfusedaemon.c 2008-04-08 03:27:44.000000000 +0200 >+++ gvfs-0.2.3-post/client/gvfsfusedaemon.c 2008-08-13 06:48:47.939189000 +0200 >@@ -1,7 +1,8 @@ > /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ >-/* GIO - GLib Input, Output and Streaming Library >+ >+/* gvfsfusedaemon.c - FUSE file system mapping daemon for GVFS > * >- * Copyright (C) 2006-2007 Red Hat, Inc. >+ * Copyright (C) 2007-2008 Hans Petter Jansson > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Lesser General Public >@@ -18,10 +19,9 @@ > * Free Software Foundation, Inc., 59 Temple Place, Suite 330, > * Boston, MA 02111-1307, USA. > * >- * Author: Alexander Larsson <alexl@redhat.com> >+ * Author: Hans Petter Jansson <hpj@novell.com> > */ > >- > #include <config.h> > > #include <stdio.h> >@@ -55,8 +55,8 @@ > > #define DEBUG_ENABLED 0 > >-#define GET_FILE_HANDLE(fi) (GUINT_TO_POINTER ((guint) (fi)->fh)) >-#define SET_FILE_HANDLE(fi, fh) ((fi)->fh = (guint64) GPOINTER_TO_UINT (fh)) >+#define GET_FILE_HANDLE(fi) ((gpointer) (fi)->fh) >+#define SET_FILE_HANDLE(fi, fh) ((fi)->fh = (guint64) (fh)) > > typedef struct { > time_t creation_time; >@@ -71,7 +71,10 @@ typedef enum { > } FileOp; > > typedef struct { >+ gint refcount; >+ > GMutex *mutex; >+ gchar *path; > FileOp op; > gpointer stream; > gint length; >@@ -183,17 +186,44 @@ errno_from_error (GError *error) > } > > static FileHandle * >-file_handle_new (void) >+file_handle_new (const gchar *path) > { > FileHandle *file_handle; > > file_handle = g_new0 (FileHandle, 1); >+ file_handle->refcount = 1; > file_handle->mutex = g_mutex_new (); > file_handle->op = FILE_OP_NONE; >+ file_handle->path = g_strdup (path); > > return file_handle; > } > >+static FileHandle * >+file_handle_ref (FileHandle *file_handle) >+{ >+ g_atomic_int_inc (&file_handle->refcount); >+ return file_handle; >+} >+ >+static void >+file_handle_unref (FileHandle *file_handle) >+{ >+ if (g_atomic_int_dec_and_test (&file_handle->refcount)) >+ { >+ g_static_mutex_lock (&global_mutex); >+ >+ /* Test again, since e.g. get_file_handle_for_path() might have >+ * snatched the global mutex and revived the file handle between >+ * g_atomic_int_dec_and_test() and us obtaining the lock. */ >+ >+ if (g_atomic_int_get (&file_handle->refcount) == 0) >+ g_hash_table_remove (global_fh_table, file_handle->path); >+ >+ g_static_mutex_unlock (&global_mutex); >+ } >+} >+ > static void > file_handle_close_stream (FileHandle *file_handle) > { >@@ -220,11 +250,13 @@ file_handle_close_stream (FileHandle *fi > } > } > >+/* Called on hash table removal */ > static void > file_handle_free (FileHandle *file_handle) > { > file_handle_close_stream (file_handle); > g_mutex_free (file_handle->mutex); >+ g_free (file_handle->path); > g_free (file_handle); > } > >@@ -234,7 +266,11 @@ get_file_handle_for_path (const gchar *p > FileHandle *fh; > > g_static_mutex_lock (&global_mutex); >+ > fh = g_hash_table_lookup (global_fh_table, path); >+ if (fh) >+ file_handle_ref (fh); >+ > g_static_mutex_unlock (&global_mutex); > > return fh; >@@ -245,16 +281,22 @@ get_or_create_file_handle_for_path (cons > { > FileHandle *fh; > >- fh = get_file_handle_for_path (path); >- if (!fh) >- { >- fh = file_handle_new (); >+ g_static_mutex_lock (&global_mutex); > >- g_static_mutex_lock (&global_mutex); >- g_hash_table_insert (global_fh_table, g_strdup (path), fh); >- g_static_mutex_unlock (&global_mutex); >+ fh = g_hash_table_lookup (global_fh_table, path); >+ >+ if (fh) >+ { >+ file_handle_ref (fh); >+ } >+ else >+ { >+ fh = file_handle_new (path); >+ g_hash_table_insert (global_fh_table, fh->path, fh); > } > >+ g_static_mutex_unlock (&global_mutex); >+ > return fh; > } > >@@ -271,28 +313,15 @@ reindex_file_handle_for_path (const gcha > (gpointer *) &fh)) > goto out; > >- g_free (old_path_internal); >- g_hash_table_insert (global_fh_table, g_strdup (new_path), fh); >+ g_hash_table_steal (global_fh_table, old_path); > >- out: >- g_static_mutex_unlock (&global_mutex); >-} >+ g_free (fh->path); >+ fh->path = g_strdup (new_path); > >-static gboolean >-free_file_handle_for_path (const gchar *path) >-{ >- FileHandle *fh; >+ g_hash_table_insert (global_fh_table, fh->path, fh); > >- fh = get_file_handle_for_path (path); >- if (fh) >- { >- g_static_mutex_lock (&global_mutex); >- g_hash_table_remove (global_fh_table, path); >- g_static_mutex_unlock (&global_mutex); >- return TRUE; >- } >- >- return FALSE; >+ out: >+ g_static_mutex_unlock (&global_mutex); > } > > static MountRecord * >@@ -795,7 +824,10 @@ vfs_getattr (const gchar *path, struct s > } > > if (fh) >- g_mutex_unlock (fh->mutex); >+ { >+ g_mutex_unlock (fh->mutex); >+ file_handle_unref (fh); >+ } > > debug_print ("vfs_getattr: -> %s\n", strerror (-result)); > >@@ -929,10 +961,16 @@ vfs_open (const gchar *path, struct fuse > > /* Set up a stream here, so we can check for errors */ > >+ g_mutex_lock (fh->mutex); >+ > if (fi->flags & O_WRONLY || fi->flags & O_RDWR) > result = setup_output_stream (file, fh); > else > result = setup_input_stream (file, fh); >+ >+ g_mutex_unlock (fh->mutex); >+ >+ /* The added reference to the file handle is released in vfs_release() */ > } > else if (file_type == G_FILE_TYPE_DIRECTORY) > { >@@ -1015,10 +1053,15 @@ vfs_create (const gchar *path, mode_t mo > > SET_FILE_HANDLE (fi, fh); > >- g_assert (fh->stream == NULL); >+ g_mutex_lock (fh->mutex); > >+ file_handle_close_stream (fh); > fh->stream = file_output_stream; > fh->op = FILE_OP_WRITE; >+ >+ g_mutex_unlock (fh->mutex); >+ >+ /* The added reference to the file handle is released in vfs_release() */ > } > else > { >@@ -1047,7 +1090,7 @@ vfs_release (const gchar *path, struct f > debug_print ("vfs_release: %s\n", path); > > if (fh) >- free_file_handle_for_path (path); >+ file_handle_unref (fh); > > return 0; > } >@@ -1479,6 +1522,7 @@ vfs_rename (const gchar *old_path, const > if (fh) > { > g_mutex_unlock (fh->mutex); >+ file_handle_unref (fh); > } > > if (result == -EISDIR) >@@ -1530,6 +1574,7 @@ vfs_unlink (const gchar *path) > if (fh) > { > g_mutex_unlock (fh->mutex); >+ file_handle_unref (fh); > } > > if (error) >@@ -1748,7 +1793,10 @@ vfs_truncate (const gchar *path, off_t s > } > > if (fh) >- g_mutex_unlock (fh->mutex); >+ { >+ g_mutex_unlock (fh->mutex); >+ file_handle_unref (fh); >+ } > > g_object_unref (file); > } >@@ -1998,6 +2046,9 @@ subthread_main (gpointer data) > g_object_unref (volume_monitor); > volume_monitor = NULL; > >+ /* Tell the main thread to unmount. Using kill() is necessary according to FUSE maintainers. */ >+ kill (getpid (), SIGHUP); >+ > return NULL; > } > >@@ -2025,14 +2076,20 @@ dbus_filter_func (DBusConnection *connec > *new_owner == 0) > { > /* The daemon died, unmount */ >- kill (getpid(), SIGHUP); >+ g_main_loop_quit (subthread_main_loop); > } > } >+ else if (dbus_message_is_signal (message, >+ DBUS_INTERFACE_LOCAL, >+ "Disconnected")) >+ { >+ /* Session bus died, unmount */ >+ g_main_loop_quit (subthread_main_loop); >+ } > > return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; > } > >- > static gpointer > vfs_init (struct fuse_conn_info *conn) > { >@@ -2046,7 +2103,7 @@ vfs_init (struct fuse_conn_info *conn) > > mount_list_mutex = g_mutex_new (); > global_fh_table = g_hash_table_new_full (g_str_hash, g_str_equal, >- g_free, (GDestroyNotify) file_handle_free); >+ NULL, (GDestroyNotify) file_handle_free); > > dbus_error_init (&error); > >@@ -2059,6 +2116,8 @@ vfs_init (struct fuse_conn_info *conn) > return NULL; > } > >+ dbus_connection_set_exit_on_disconnect (dbus_conn, FALSE); >+ > _g_dbus_connection_integrate_with_main (dbus_conn); > > dbus_bus_add_match (dbus_conn, >diff -upr gvfs-0.2.3-pre/common/gmounttracker.c gvfs-0.2.3-post/common/gmounttracker.c >--- gvfs-0.2.3-pre/common/gmounttracker.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/common/gmounttracker.c 2008-08-13 06:48:40.688456000 +0200 >@@ -236,7 +236,8 @@ g_mount_tracker_finalize (GObject *objec > > tracker = G_MOUNT_TRACKER (object); > >- g_mutex_free (tracker->lock); >+ if (tracker->lock) >+ g_mutex_free (tracker->lock); > > g_list_foreach (tracker->mounts, > (GFunc)g_mount_info_unref, NULL); >diff -upr gvfs-0.2.3-pre/configure.ac gvfs-0.2.3-post/configure.ac >--- gvfs-0.2.3-pre/configure.ac 2008-04-08 03:27:45.000000000 +0200 >+++ gvfs-0.2.3-post/configure.ac 2008-08-13 06:48:47.802328000 +0200 >@@ -58,7 +58,7 @@ DBUS_SERVICE_DIR=$with_dbus_service_dir > AC_SUBST(DBUS_SERVICE_DIR) > > dnl **** gio module path handling **** >-giomodulesdir=`pkg-config --variable=giomoduledir gio-2.0` >+giomodulesdir=`pkg-config --define-variable=libdir=$libdir --variable=giomoduledir gio-2.0` > AC_SUBST(giomodulesdir) > > dnl **************************** >diff -upr gvfs-0.2.3-pre/daemon/gvfsbackendarchive.c gvfs-0.2.3-post/daemon/gvfsbackendarchive.c >--- gvfs-0.2.3-pre/daemon/gvfsbackendarchive.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/daemon/gvfsbackendarchive.c 2008-08-13 06:48:40.747400000 +0200 >@@ -322,6 +322,13 @@ create_root_file (GVfsBackendArchive *ba > g_file_info_set_content_type (info, "inode/directory"); > g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, "inode/directory"); > >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, FALSE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, TRUE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE); >+ > icon = g_themed_icon_new ("folder"); > g_file_info_set_icon (info, icon); > g_object_unref (icon); >@@ -340,19 +347,19 @@ archive_file_set_info_from_entry (Archiv > g_file_info_set_attribute_uint64 (info, > G_FILE_ATTRIBUTE_TIME_ACCESS, > archive_entry_atime (entry)); >- g_file_info_set_attribute_uint64 (info, >+ g_file_info_set_attribute_uint32 (info, > G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, > archive_entry_atime_nsec (entry) / 1000); > g_file_info_set_attribute_uint64 (info, > G_FILE_ATTRIBUTE_TIME_CHANGED, > archive_entry_ctime (entry)); >- g_file_info_set_attribute_uint64 (info, >+ g_file_info_set_attribute_uint32 (info, > G_FILE_ATTRIBUTE_TIME_CHANGED_USEC, > archive_entry_ctime_nsec (entry) / 1000); > g_file_info_set_attribute_uint64 (info, > G_FILE_ATTRIBUTE_TIME_MODIFIED, > archive_entry_mtime (entry)); >- g_file_info_set_attribute_uint64 (info, >+ g_file_info_set_attribute_uint32 (info, > G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, > archive_entry_mtime_nsec (entry) / 1000); > >@@ -387,6 +394,13 @@ archive_file_set_info_from_entry (Archiv > g_file_info_set_size (info, > archive_entry_size (entry)); > >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, FALSE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, type == G_FILE_TYPE_DIRECTORY); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE); >+ > /* FIXME: add info for these > dev_t archive_entry_dev(struct archive_entry *); > dev_t archive_entry_devmajor(struct archive_entry *); >@@ -508,11 +522,11 @@ do_mount (GVfsBackend *backend, > return; > } > >- archive->file = g_file_new_for_uri (filename); >+ archive->file = g_file_new_for_commandline_arg (filename); > g_free (filename); > } > else >- archive->file = g_file_new_for_uri (file); >+ archive->file = g_file_new_for_commandline_arg (file); > > DEBUG ("Trying to mount %s\n", g_file_get_uri (archive->file)); > >@@ -714,6 +728,19 @@ do_enumerate (GVfsBackend *backend, > g_vfs_job_succeeded (G_VFS_JOB (job)); > } > >+static gboolean >+try_query_fs_info (GVfsBackend *backend, >+ GVfsJobQueryFsInfo *job, >+ const char *filename, >+ GFileInfo *info, >+ GFileAttributeMatcher *attribute_matcher) >+{ >+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE); >+ g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW, G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL); >+ g_vfs_job_succeeded (G_VFS_JOB (job)); >+ return TRUE; >+} >+ > static void > g_vfs_backend_archive_class_init (GVfsBackendArchiveClass *klass) > { >@@ -729,4 +756,5 @@ g_vfs_backend_archive_class_init (GVfsBa > backend_class->read = do_read; > backend_class->enumerate = do_enumerate; > backend_class->query_info = do_query_info; >+ backend_class->try_query_fs_info = try_query_fs_info; > } >diff -upr gvfs-0.2.3-pre/daemon/gvfsbackenddav.c gvfs-0.2.3-post/daemon/gvfsbackenddav.c >--- gvfs-0.2.3-pre/daemon/gvfsbackenddav.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/daemon/gvfsbackenddav.c 2008-08-13 06:48:47.703423000 +0200 >@@ -1409,6 +1409,8 @@ g_mount_spec_from_dav_uri (SoupURI *uri) > g_free (port); > } > >+ g_mount_spec_set_mount_prefix (spec, uri->path); >+ > return spec; > } > >diff -upr gvfs-0.2.3-pre/daemon/gvfsbackendftp.c gvfs-0.2.3-post/daemon/gvfsbackendftp.c >--- gvfs-0.2.3-pre/daemon/gvfsbackendftp.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/daemon/gvfsbackendftp.c 2008-08-13 06:48:40.738412000 +0200 >@@ -135,6 +135,8 @@ G_DEFINE_TYPE (GVfsBackendFtp, g_vfs_bac > > #define STATUS_GROUP(status) ((status) / 100) > >+typedef void (* Ftp550Handler) (FtpConnection *conn, const FtpFile *file); >+ > /*** FTP CONNECTION ***/ > > struct _FtpConnection >@@ -250,8 +252,8 @@ ftp_connection_set_error_from_response ( > case 550: /* Requested action not taken. File unavailable (e.g., file not found, no access). */ > /* FIXME: This is a lot of different errors. So we have to pretend to > * be smart here. */ >- code = G_IO_ERROR_NOT_FOUND; >- msg = _("File unavailable"); >+ code = G_IO_ERROR_FAILED; >+ msg = _("Operation failed"); > break; > case 451: /* Requested action aborted: local error in processing. */ > code = G_IO_ERROR_FAILED; >@@ -298,6 +300,7 @@ ftp_connection_set_error_from_response ( > * RESPONSE_PASS_300: Don't treat 3XX responses, but return them > * RESPONSE_PASS_400: Don't treat 4XX responses, but return them > * RESPONSE_PASS_500: Don't treat 5XX responses, but return them >+ * RESPONSE_PASS_550: Don't treat 550 responses, but return them > * RESPONSE_FAIL_200: Fail on a 2XX response > */ > >@@ -306,7 +309,8 @@ typedef enum { > RESPONSE_PASS_300 = (1 << 1), > RESPONSE_PASS_400 = (1 << 2), > RESPONSE_PASS_500 = (1 << 3), >- RESPONSE_FAIL_200 = (1 << 4) >+ RESPONSE_PASS_550 = (1 << 4), >+ RESPONSE_FAIL_200 = (1 << 5) > } ResponseFlags; > > /** >@@ -460,7 +464,7 @@ ftp_connection_receive (FtpConnection *c > return 0; > break; > case 5: >- if (flags & RESPONSE_PASS_500) >+ if ((flags & RESPONSE_PASS_500) || (response == 550 && (flags & RESPONSE_PASS_550))) > break; > ftp_connection_set_error_from_response (conn, response); > return 0; >@@ -565,6 +569,57 @@ ftp_connection_send (FtpConnection *conn > } > > static void >+ftp_connection_check_file (FtpConnection *conn, >+ const Ftp550Handler *handlers, >+ const FtpFile *file) >+{ >+ while (*handlers && !ftp_connection_in_error (conn)) >+ { >+ (*handlers) (conn, file); >+ handlers++; >+ } >+} >+ >+static guint >+ftp_connection_send_and_check (FtpConnection *conn, >+ ResponseFlags flags, >+ const Ftp550Handler *handlers, >+ const FtpFile *file, >+ const char *format, >+ ...) G_GNUC_PRINTF (5, 6); >+static guint >+ftp_connection_send_and_check (FtpConnection *conn, >+ ResponseFlags flags, >+ const Ftp550Handler *handlers, >+ const FtpFile *file, >+ const char *format, >+ ...) >+{ >+ va_list varargs; >+ guint response; >+ >+ /* check that there's no 550 handling used - don't allow bad use of API */ >+ g_return_val_if_fail ((flags & RESPONSE_PASS_550) == 0, 0); >+ g_return_val_if_fail (handlers != NULL, 0); >+ g_return_val_if_fail (file != NULL, 0); >+ >+ va_start (varargs, format); >+ response = ftp_connection_sendv (conn, >+ flags | RESPONSE_PASS_550, >+ format, >+ varargs); >+ va_end (varargs); >+ if (response == 550) >+ { >+ ftp_connection_check_file (conn, handlers, file); >+ if (!ftp_connection_in_error (conn)) >+ ftp_connection_set_error_from_response (conn, response); >+ response = 0; >+ } >+ return response; >+} >+ >+static void > ftp_connection_parse_features (FtpConnection *conn) > { > struct { >@@ -1462,6 +1517,21 @@ do_unmount (GVfsBackend * backend, > } > > static void >+error_550_is_directory (FtpConnection *conn, const FtpFile *file) >+{ >+ guint response = ftp_connection_send (conn, >+ RESPONSE_PASS_550, >+ "CWD %s", file); >+ >+ if (STATUS_GROUP (response) == 2) >+ { >+ g_set_error (&conn->error, G_IO_ERROR, >+ G_IO_ERROR_IS_DIRECTORY, >+ _("File is directory")); >+ } >+} >+ >+static void > do_open_for_read (GVfsBackend *backend, > GVfsJobOpenForRead *job, > const char *filename) >@@ -1469,6 +1539,7 @@ do_open_for_read (GVfsBackend *backend, > GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend); > FtpConnection *conn; > FtpFile *file; >+ static const Ftp550Handler open_read_handlers[] = { error_550_is_directory, NULL }; > > conn = g_vfs_backend_ftp_pop_connection (ftp, G_VFS_JOB (job)); > if (!conn) >@@ -1477,9 +1548,11 @@ do_open_for_read (GVfsBackend *backend, > ftp_connection_ensure_data_connection (conn); > > file = ftp_filename_from_gvfs_path (conn, filename); >- ftp_connection_send (conn, >- RESPONSE_PASS_100 | RESPONSE_FAIL_200, >- "RETR %s", file); >+ ftp_connection_send_and_check (conn, >+ RESPONSE_PASS_100 | RESPONSE_FAIL_200, >+ &open_read_handlers[0], >+ file, >+ "RETR %s", file); > g_free (file); > > if (ftp_connection_in_error (conn)) >@@ -1782,6 +1855,8 @@ do_enumerate_directory (FtpConnection *c > if (got_boundary) > { > name[bytes_read - 1] = 0; >+ if (bytes_read >= 2 && name[bytes_read - 2] == '\r') >+ name[bytes_read - 2] = 0; > DEBUG ("--- %s\n", name); > list = g_list_prepend (list, g_strdup (name)); > bytes_read = 0; >diff -upr gvfs-0.2.3-pre/daemon/gvfsbackendgphoto2.c gvfs-0.2.3-post/daemon/gvfsbackendgphoto2.c >--- gvfs-0.2.3-pre/daemon/gvfsbackendgphoto2.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/daemon/gvfsbackendgphoto2.c 2008-08-13 06:48:47.739389000 +0200 >@@ -1394,6 +1394,8 @@ do_mount (GVfsBackend *backend, > return; > } > >+ dbus_connection_set_exit_on_disconnect (gphoto2_backend->dbus_connection, FALSE); >+ > gphoto2_backend->hal_ctx = libhal_ctx_new (); > if (gphoto2_backend->hal_ctx == NULL) > { >diff -upr gvfs-0.2.3-pre/daemon/gvfsbackendhttp.c gvfs-0.2.3-post/daemon/gvfsbackendhttp.c >--- gvfs-0.2.3-pre/daemon/gvfsbackendhttp.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/daemon/gvfsbackendhttp.c 2008-08-13 06:48:40.762387000 +0200 >@@ -75,9 +75,13 @@ g_vfs_backend_http_finalize (GObject *ob > (*G_OBJECT_CLASS (g_vfs_backend_http_parent_class)->finalize) (object); > } > >+#define DEBUG_MAX_BODY_SIZE (100 * 1024 * 1024) >+ > static void > g_vfs_backend_http_init (GVfsBackendHttp *backend) > { >+ const char *debug; >+ > g_vfs_backend_set_user_visible (G_VFS_BACKEND (backend), FALSE); > > backend->session = soup_session_sync_new_with_options ("user-agent", >@@ -87,6 +91,28 @@ g_vfs_backend_http_init (GVfsBackendHttp > backend->session_async = soup_session_async_new_with_options ("user-agent", > "gvfs/" VERSION, > NULL); >+ >+ /* Logging */ >+ debug = g_getenv ("GVFS_HTTP_DEBUG"); >+ if (debug) >+ { >+ SoupLogger *logger; >+ SoupLoggerLogLevel level; >+ >+ if (g_ascii_strcasecmp (debug, "all") || >+ g_ascii_strcasecmp (debug, "body")) >+ level = SOUP_LOGGER_LOG_BODY; >+ else if (g_ascii_strcasecmp (debug, "header")) >+ level = SOUP_LOGGER_LOG_HEADERS; >+ else >+ level = SOUP_LOGGER_LOG_MINIMAL; >+ >+ logger = soup_logger_new (level, DEBUG_MAX_BODY_SIZE); >+ soup_logger_attach (logger, backend->session); >+ soup_logger_attach (logger, backend->session_async); >+ g_object_unref (logger); >+ } >+ > } > > /* ************************************************************************* */ >diff -upr gvfs-0.2.3-pre/daemon/gvfsbackendsmb.c gvfs-0.2.3-post/daemon/gvfsbackendsmb.c >--- gvfs-0.2.3-pre/daemon/gvfsbackendsmb.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/daemon/gvfsbackendsmb.c 2008-08-13 06:48:47.717411000 +0200 >@@ -612,17 +612,33 @@ do_open_for_read (GVfsBackend *backend, > GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend); > char *uri; > SMBCFILE *file; >+ struct stat st; > smbc_open_fn smbc_open; >+ smbc_stat_fn smbc_stat; >+ int res; >+ int olderr; >+ > > uri = create_smb_uri (op_backend->server, op_backend->share, filename); > smbc_open = smbc_getFunctionOpen (op_backend->smb_context); > file = smbc_open (op_backend->smb_context, uri, O_RDONLY, 0); >- g_free (uri); > > if (file == NULL) >- g_vfs_job_failed_from_errno (G_VFS_JOB (job), errno); >+ { >+ olderr = errno; >+ smbc_stat = smbc_getFunctionStat (op_backend->smb_context); >+ res = smbc_stat (op_backend->smb_context, uri, &st); >+ g_free (uri); >+ if ((res == 0) && (S_ISDIR (st.st_mode))) >+ g_vfs_job_failed (G_VFS_JOB (job), >+ G_IO_ERROR, G_IO_ERROR_IS_DIRECTORY, >+ _("Can't open directory")); >+ else >+ g_vfs_job_failed_from_errno (G_VFS_JOB (job), olderr); >+ } > else > { >+ > g_vfs_job_open_for_read_set_can_seek (job, TRUE); > g_vfs_job_open_for_read_set_handle (job, file); > g_vfs_job_succeeded (G_VFS_JOB (job)); >diff -upr gvfs-0.2.3-pre/daemon/gvfsbackendtrash.c gvfs-0.2.3-post/daemon/gvfsbackendtrash.c >--- gvfs-0.2.3-pre/daemon/gvfsbackendtrash.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/daemon/gvfsbackendtrash.c 2008-08-13 06:48:47.748380000 +0200 >@@ -148,17 +148,21 @@ escape_pathname (const char *dir) > while (*dir == '/') > dir++; > >- /* Underscores are doubled, count them */ >+ /* count characters that need to be escaped. */ > count = 0; > p = dir; > while (*p) > { > if (*p == '_') > count++; >+ if (*p == '/') >+ count++; >+ if (*p == '%') >+ count++; > p++; > } > >- res = g_malloc (strlen (dir) + count + 1); >+ res = g_malloc (strlen (dir) + count*2 + 1); > > p = dir; > d = res; >@@ -167,18 +171,27 @@ escape_pathname (const char *dir) > c = *p++; > if (c == '_') > { >- *d++ = '_'; >- *d++ = '_'; >+ *d++ = '%'; >+ *d++ = '5'; >+ *d++ = 'f'; > } > else if (c == '/') > { >- *d++ = '_'; >+ *d++ = '%'; >+ *d++ = '2'; >+ *d++ = 'f'; > > /* Skip consecutive slashes, they are unnecessary, > and break our escaping */ > while (*p == '/') > p++; > } >+ else if (c == '%') >+ { >+ *d++ = '%'; >+ *d++ = '2'; >+ *d++ = '5'; >+ } > else > *d++ = c; > } >@@ -216,20 +229,22 @@ unescape_pathname (const char *escaped_d > while (p < end) > { > c = *p++; >- if (c == '_') >+ if (c == '%' && p < (end-1)) > { >- if (p == end) >- *d++ = '_'; >- else >+ if (*(p) == '2' && *(p+1) == 'f') > { >- c = *p; >- if (c == '_') >- { >- p++; >- *d++ = '_'; >- } >- else >- *d++ = '/'; >+ *d++ = '/'; >+ p+=2; >+ } >+ else if (*(p) == '2' && *(p+1) == '5') >+ { >+ *d++ = '%'; >+ p+=2; >+ } >+ else if (*(p) == '5' && *(p+1) == 'f') >+ { >+ *d++ = '_'; >+ p+=2; > } > } > else >Only in gvfs-0.2.3-post/daemon: Makefile.am.rej >diff -upr gvfs-0.2.3-pre/hal/ghalvolumemonitor.c gvfs-0.2.3-post/hal/ghalvolumemonitor.c >--- gvfs-0.2.3-pre/hal/ghalvolumemonitor.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/hal/ghalvolumemonitor.c 2008-08-13 06:48:47.888240000 +0200 >@@ -845,6 +845,32 @@ get_mount_point_for_device (HalDevice *d > } > > static gboolean >+should_mount_be_ignored (HalPool *pool, HalDevice *d) >+{ >+ const char *device_mount_point; >+ >+ device_mount_point = hal_device_get_property_string (d, "volume.mount_point"); >+ if (device_mount_point != NULL && strlen (device_mount_point) > 0) >+ { >+ GUnixMountEntry *mount_entry; >+ >+ /*g_warning ("device_mount_point = '%s'", device_mount_point);*/ >+ >+ mount_entry = g_unix_mount_at (device_mount_point, NULL); >+ if (mount_entry != NULL) { >+ if (!g_unix_mount_guess_should_display (mount_entry)) >+ { >+ g_unix_mount_free (mount_entry); >+ return TRUE; >+ } >+ g_unix_mount_free (mount_entry); >+ } >+ } >+ >+ return FALSE; >+} >+ >+static gboolean > should_volume_be_ignored (HalPool *pool, HalDevice *d, GList *fstab_mount_points) > { > gboolean volume_ignore; >@@ -893,6 +919,9 @@ should_volume_be_ignored (HalPool *pool, > if (mount_point != NULL && !_g_unix_mount_point_guess_should_display (mount_point)) > return TRUE; > >+ if (hal_device_get_property_bool (d, "volume.is_mounted")) >+ return should_mount_be_ignored (pool, d); >+ > return FALSE; > } > >@@ -1207,13 +1236,29 @@ update_mounts (GHalVolumeMonitor *monito > { > GList *new_mounts; > GList *removed, *added; >- GList *l; >+ GList *l, *ll; > GHalMount *mount; > GHalVolume *volume; > const char *device_path; > const char *mount_path; > > new_mounts = g_unix_mounts_get (NULL); >+ >+ /* remove mounts we want to ignore - we do it here so we get to reevaluate >+ * on the next update whether they should still be ignored >+ */ >+ for (l = new_mounts; l != NULL; l = ll) >+ { >+ GUnixMountEntry *mount_entry = l->data; >+ ll = l->next; >+ >+ /* keep in sync with should_mount_be_ignored() */ >+ if (!g_unix_mount_guess_should_display (mount_entry)) >+ { >+ g_unix_mount_free (mount_entry); >+ new_mounts = g_list_delete_link (new_mounts, l); >+ } >+ } > > new_mounts = g_list_sort (new_mounts, (GCompareFunc) g_unix_mount_compare); > >diff -upr gvfs-0.2.3-pre/hal/hal-device.c gvfs-0.2.3-post/hal/hal-device.c >--- gvfs-0.2.3-pre/hal/hal-device.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/hal/hal-device.c 2008-08-13 06:48:47.875251000 +0200 >@@ -245,7 +245,7 @@ hal_device_new_from_udi_and_properties ( > HalDevice *device; > > device = HAL_DEVICE (g_object_new (HAL_TYPE_DEVICE, NULL)); >- device->priv->udi = udi; >+ device->priv->udi = g_strdup (udi); > device->priv->hal_ctx = hal_ctx; > device->priv->properties = properties; > return device; >diff -upr gvfs-0.2.3-pre/hal/hal-pool.c gvfs-0.2.3-post/hal/hal-pool.c >--- gvfs-0.2.3-pre/hal/hal-pool.c 2008-04-08 03:27:43.000000000 +0200 >+++ gvfs-0.2.3-post/hal/hal-pool.c 2008-08-13 06:48:47.880246000 +0200 >@@ -308,6 +308,8 @@ hal_pool_new (char **cap_only) > goto out; > } > >+ dbus_connection_set_exit_on_disconnect (dbus_connection, FALSE); >+ > hal_ctx = libhal_ctx_new (); > if (hal_ctx == NULL) > { >@@ -359,9 +361,8 @@ hal_pool_new (char **cap_only) > { > for (i = 0; i < num_devices; i++) > hal_pool_add_device_by_udi_and_properties (pool, devices[i], properties[i], FALSE); >- /* _add_device_by_udi_and_properties steals the given parameters */ >- free (devices); >- free (properties); >+ libhal_free_string_array (devices); >+ free (properties); /* hal_pool_add_device_by_udi_and_properties steals the given properties */ > goto out; > } > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 368628
:
213365
| 233121