From: Danny B. <dan...@sc...> - 2005-09-08 20:43:46
|
I'm a bit lost, I need help. I am working on the SynCE file synchronisation. The directories I'm syncing in this example are : dell: {80} l /tmp/onlyfile/ total 1652 -rw-rw-r-- 1 danny backx 50089 Sep 3 07:47 \My Documents\foto \inge.gif -rw-rw-r-- 1 danny backx 58605 Sep 3 07:47 \My Documents\foto \kristof.gif -rw-rw-r-- 1 danny backx 3694 Sep 3 07:47 \My Documents\foto \tux068d.gif -rw-r--r-- 1 danny backx 1558120 Sep 1 21:16 wife_call.wmv dell: {81} pls foto/ AC-------- 58605 Sun 10 Jul 2005 10:46:26 CEST kristof.gif AC-------- 50089 Sun 10 Jul 2005 10:46:26 CEST inge.gif AC-------- 3694 Sun 10 Jul 2005 10:44:56 CEST tux068d.gif The contents of /tmp/onlyfile are mostly there by syncing, only the WMV file was put there by other means. New syncs now fail as shown here : msynctool --sync f Synchronizing group "f"=20 The previous synchronization was unlean. Slow-syncing Member 1 of type file-sync just connected Member 2 of type synce-plugin just connected All clients connected or error FilesReportFileChange(\My Documents\foto\kristof.gif) Received a entry \My Documents\foto\tux068d.gif without data from member 1. Changetype 1 FilesReportFileChange(\My Documents\foto\inge.gif) Received a entry \My Documents\foto\kristof.gif without data from member 2. Changetype 1 FilesReportFileChange(\My Documents\foto\tux068d.gif) Received a entry \My Documents\foto\kristof.gif without data from member 1. Changetype 1 Received a entry \My Documents\foto\inge.gif without data from member 2. Changetype 1 Received a entry \My Documents\foto\inge.gif without data from member 1. Changetype 1 Received a entry wife_call.wmv without data from member 1. Changetype 1 Received a entry \My Documents\foto\tux068d.gif without data from member 2. Changetype 1 Member 1 of type file-sync just sent all changes Received a entry \My Documents\foto\tux068d.gif with data of size 24 from member 1. Changetype 1 Received a entry \My Documents\foto\kristof.gif with data of size 24 from member 1. Changetype 1 Received a entry \My Documents\foto\inge.gif with data of size 24 from member 1. Changetype 1 Received a entry wife_call.wmv with data of size 24 from member 1. Changetype 1 Member 2 of type synce-plugin just sent all changes All clients sent changes or error Received a entry \My Documents\foto\kristof.gif with data of size 4 from member 2. Changetype 1 Received a entry \My Documents\foto\inge.gif with data of size 4 from member 2. Changetype 1 Segmentation fault (core dumped) And the reason of the crash is : #0 0xb7bdd923 in wstr_from_x (inbuf=3D0x0, code=3D0x806cd98 "ISO-8859-1") at wstr.c:133 133 size_t length =3D strlen(inbuf); (gdb) where #0 0xb7bdd923 in wstr_from_x (inbuf=3D0x0, code=3D0x806cd98 "ISO-8859-1") at wstr.c:133 #1 0xb7bdda8f in wstr_from_current (inbuf=3D0x0) at wstr.c:192 #2 0xb75e6bf7 in file_get_data (ctx=3D0x80755e0, change=3D0x805fac0) at synce_file.c:389 #3 0xb7f0a049 in osync_member_get_change_data (member=3D0x805e0f8, change=3D0x805fac0,=20 function=3D0xb7f1ebc0 <message_callback>, user_data=3D0x80786b8) at opensync_member.c:1093 #4 0xb7f1ee70 in client_message_handler () from /usr/local/lib/libosengine.so.0 #5 0xb7f1e719 in _queue_dispatch () from /usr/local/lib/libosengine.so.0 #6 0xb7f4f0c4 in g_main_dispatch () from /usr/local/lib/libglib-2.0.so.0 #7 0xb7f4ff1d in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.0 #8 0xb7f502df in g_main_context_iterate () from /usr/local/lib/libglib-2.0.so.0 #9 0xb7f508a3 in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.0 #10 0xb7f68bea in g_thread_create_proxy () from /usr/local/lib/libglib-2.0.so.0 #11 0xb7d553b0 in start_thread () from /lib/tls/libpthread.so.0 #12 0xb7cb826e in clone () from /lib/tls/libc.so.6 (gdb) up #1 0xb7bdda8f in wstr_from_current (inbuf=3D0x0) at wstr.c:192 192 return wstr_from_x(inbuf, get_current_codeset()); (gdb)=20 #2 0xb75e6bf7 in file_get_data (ctx=3D0x80755e0, change=3D0x805fac0) at synce_file.c:389 389 wfn =3D wstr_from_current(ff->data); (gdb) p *ff $1 =3D {mode =3D 0, userid =3D 0, groupid =3D 0, last_mod =3D 0, data =3D 0= x0, size =3D 0} This is in the file_get_data() function I wrote : extern void file_get_data(OSyncContext *ctx, OSyncChange *change) { synce_plugin_environment *env; fileFormat *ff; HANDLE h; size_t rsz; WCHAR *wfn; int r; osync_debug("SynCE-File", 4, "start : %s", __func__); env =3D (synce_plugin_environment *)osync_context_get_plugin_data(ctx); ff =3D (fileFormat *)osync_change_get_data(change); /* * There appears to be a trick being used here. * * First report some stuff, use the data field to pass random data (e.g. the file * name) to ourselves. * Then, in the get_data() call, read that data and replace it with the file content. */ wfn =3D wstr_from_current(ff->data); /* Read the file through SynCE */ h =3D CeCreateFile(wfn, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); free(ff->data); ff->data =3D malloc(ff->size); r =3D CeReadFile(h, ff->data, ff->size, &rsz, NULL); if (r =3D=3D 0) { /* Error */ DWORD e =3D CeGetLastError(); char *s =3D synce_strerror(e); osync_context_report_error(ctx, 1, "Error from CeReadFile (%s)", s); CeCloseHandle(h); return; } /* Send its contents */ osync_change_set_data(change, (char *)ff, sizeof(ff), TRUE); CeCloseHandle(h); wstr_free_string(wfn); osync_context_report_success(ctx); osync_debug("SynCE-File", 4, "end : %s", __func__); } Can anyone give me a clue why this function is being called with arguments filled with NULLs ? Thanks, Danny --=20 Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info |