Bug#313426: libgnomevfs2-0: extra info + testcase
Jesse van den Kieboom
Jesse van den Kieboom <jesse@icecrew.nl>, 313426@bugs.debian.org
Mon, 13 Jun 2005 20:14:47 +0200
This is a multi-part MIME message sent by reportbug.
--===============0837542069==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Package: libgnomevfs2-0
Version: 2.10.1-4
Followup-For: Bug #313426
Attached is a simple test application which simply outputs the different
phases and states the xfer is put through. You'll see that it tries to
transfer a file which doesn't exists and completes without complaining.
Also, the second file (which might still be valid) is skipped after a
non existent file is tried to transfer.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-k7
Locale: LANG=nl_NL.UTF-8@euro, LC_CTYPE=nl_NL.UTF-8@euro (charmap=UTF-8)
Versions of packages libgnomevfs2-0 depends on:
ii libbonobo2-0 2.8.1-2 Bonobo CORBA interfaces library
ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an
ii libgconf2-4 2.10.0-2 GNOME configuration database syste
ii libglib2.0-0 2.6.4-1 The GLib library of C routines
ii libgnomevfs2-common 2.10.1-4 The GNOME virtual file-system libr
ii libgnutls11 1.0.16-13.1 GNU TLS library - runtime library
ii liborbit2 1:2.12.2-1 libraries for ORBit2 - a CORBA ORB
ii libxml2 2.6.16-7 GNOME XML library
ii zlib1g 1:1.2.2-4 compression library - runtime
-- no debconf information
--===============0837542069==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gvfs_test.c"
#include <libgnomevfs/gnome-vfs.h>
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
int print_error(GnomeVFSResult result, const char *uri_string);
static int
update_transfer_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSXferProgressInfo *progress_info,
gpointer data) {
printf("Transupate: status = %d, phase = %d\n", progress_info->status, progress_info->phase);
return 1;
}
static int
sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data) {
printf("Synctrans: status = %d, phase = %d\n", progress_info->status, progress_info->phase);
if (progress_info->phase == GNOME_VFS_XFER_PHASE_COMPLETED) {
exit(EXIT_SUCCESS);
}
return 1;
}
int
main (int argc, char **argv) {
GMainLoop *loop;
GnomeVFSAsyncHandle *handle;
GList *source_uri, *dest_uri;
GnomeVFSURI *source, *dest;
GnomeVFSResult result;
gchar *s_dest;
/* remember to initialize GnomeVFS! */
if (!gnome_vfs_init ()) {
printf ("Could not initialize GnomeVFS\n");
exit(EXIT_FAILURE);
}
s_dest = g_strconcat(g_get_tmp_dir(), G_DIR_SEPARATOR_S, "test.txt", NULL);
source = gnome_vfs_uri_new("http://www.icecrew.nl/nonexistent.txt");
dest = gnome_vfs_uri_new(s_dest);
g_free(s_dest);
/* Add it twice to show it says it completes after the first one fails */
source_uri = g_list_append(NULL, source);
source_uri = g_list_append(source_uri, source);
dest_uri = g_list_append(NULL, dest);
dest_uri = g_list_append(dest_uri, dest);
result = gnome_vfs_async_xfer(&handle, source_uri, dest_uri, GNOME_VFS_XFER_DEFAULT,
GNOME_VFS_XFER_ERROR_MODE_QUERY, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
GNOME_VFS_PRIORITY_DEFAULT, update_transfer_callback, NULL,
sync_transfer_callback, NULL);
gnome_vfs_uri_unref(source);
gnome_vfs_uri_unref(dest);
g_list_free(source_uri);
g_list_free(dest_uri);
if (result != GNOME_VFS_OK) {
print_error(result, NULL);
} else {
loop = g_main_loop_new(NULL, TRUE);
g_main_loop_run(loop);
gnome_vfs_shutdown();
}
return 0;
}
int
print_error (GnomeVFSResult result, const char *uri_string) {
const char *error_string;
/* get the string corresponding to this GnomeVFSResult value */
error_string = gnome_vfs_result_to_string (result);
printf ("Error %s occured opening location %s\n", error_string, uri_string);
return 1;
}
--===============0837542069==--