Discussion:
[Synce-devel] type inconsistency between librapi2 and my user application
Laurent Vivier
2007-06-10 13:09:20 UTC
Permalink
Hi,

I'm trying to debug my application syncefs.

the problem is as following :

in my application, sizeof(CE_FIND_DATA) = 552 but in librapi2, in
_CeFindAllFiles it seems to be 560 :

src/rapi/file_management.c

71: CE_FIND_DATA* array = calloc(count, sizeof
(CE_FIND_DATA));

0xb7f78c31 <_CeFindAllFiles+200>: mov 0xffffffec(%ebp),%eax
0xb7f78c34 <_CeFindAllFiles+203>: movl $0x230,0x4(%esp)
0xb7f78c3c <_CeFindAllFiles+211>: mov %eax,(%esp)
0xb7f78c3f <_CeFindAllFiles+214>: call 0xb7f71398 <***@plt>

If I compile librapi2 and pls on my system all is working fine, if I
use librapi2 (0.9.3) from Debian etch and I compile pls on my system,
when I run pls I have same issue.

An idea why size of is different between librapi2 and my application ?
I use gcc 4.1 but I have same behaviour with gcc-3.4.

Regards,
Laurent
---------------------- Laurent Vivier ----------------------
"Imagination is more important than knowledge."
Ian Abbott
2007-06-13 10:37:46 UTC
Permalink
Post by Laurent Vivier
Hi,
I'm trying to debug my application syncefs.
in my application, sizeof(CE_FIND_DATA) = 552 but in librapi2,
src/rapi/file_management.c
71: CE_FIND_DATA* array = calloc(count,
sizeof(CE_FIND_DATA));
0xb7f78c31 <_CeFindAllFiles+200>: mov 0xffffffec(%ebp),%eax
0xb7f78c34 <_CeFindAllFiles+203>: movl $0x230,0x4(%esp)
0xb7f78c3c <_CeFindAllFiles+211>: mov %eax,(%esp)
If I compile librapi2 and pls on my system all is working fine, if I use
librapi2 (0.9.3) from Debian etch and I compile pls on my system, when I
run pls I have same issue.
An idea why size of is different between librapi2 and my application ?
I use gcc 4.1 but I have same behaviour with gcc-3.4.
I think you're picking up an out-of-date <synce_types.h> from somewhere.
See
<http://www.mail-archive.com/synce-***@lists.sourceforge.net/msg00341.html>
for the patch that changed MAX_PATH from 256 to 260. This accounts for
the 8 byte difference in size that you are seeing in CE_FIND_DATA, and
also affects a few other types in <rapi.h>.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <***@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
Laurent Vivier
2007-06-13 11:34:57 UTC
Permalink
Post by Ian Abbott
Post by Laurent Vivier
Hi,
I'm trying to debug my application syncefs.
in my application, sizeof(CE_FIND_DATA) = 552 but in librapi2,
src/rapi/file_management.c
71: CE_FIND_DATA* array = calloc(count,
sizeof(CE_FIND_DATA));
0xb7f78c31 <_CeFindAllFiles+200>: mov 0xffffffec(%ebp),%eax
0xb7f78c34 <_CeFindAllFiles+203>: movl $0x230,0x4(%esp)
0xb7f78c3c <_CeFindAllFiles+211>: mov %eax,(%esp)
If I compile librapi2 and pls on my system all is working fine, if I use
librapi2 (0.9.3) from Debian etch and I compile pls on my system, when I
run pls I have same issue.
An idea why size of is different between librapi2 and my application ?
I use gcc 4.1 but I have same behaviour with gcc-3.4.
I think you're picking up an out-of-date <synce_types.h> from somewhere.
See
for the patch that changed MAX_PATH from 256 to 260. This accounts for
the 8 byte difference in size that you are seeing in CE_FIND_DATA, and
also affects a few other types in <rapi.h>.
Thank you.

It should be the good answer, so there is a problem with debian packages :

# grep MAX_PATH /usr/include/synce_types.h
#define MAX_PATH 256

# dpkg -S /usr/include/synce_types.h
libsynce0-dev: /usr/include/synce_types.h

# apt-cache show libsynce0-dev
Package: libsynce0-dev
Priority: optional
Section: libdevel
Installed-Size: 140
Maintainer: Volker Christian <***@debian.org>
Architecture: i386
Source: libsynce
Version: 0.9.3-1
Depends: libsynce0 (= 0.9.3-1)
Suggests: librapi2-dev
Filename: pool/main/libs/libsynce/libsynce0-dev_0.9.3-1_i386.deb
Size: 25258
MD5sum: 5f22c4fdc6805766d192fb7451bfec8a
SHA1: 54141639382ae4ccedf4df81b8c237bb346d10f4
SHA256: e3142e6a31a1ef262f116a3e30d60bd6ddd961ddf6d54ed470b9ed9ca829252c
Description: A helper library for synce, a tool to sync WinCE devices
This package contains the development files
Tag: devel::library, role::devel-lib

# objdump -D /usr/lib/librapi.so.2.0.0
00006cbb <_CeFindAllFiles2>:
...
6daa: 0f 84 0c 03 00 00 je 70bc <_CeFindAllFiles2+0x401>
6db0: 8b 45 ec mov 0xffffffec(%ebp),%eax
6db3: c7 44 24 04 30 02 00 movl $0x230,0x4(%esp)
6dba: 00
6dbb: 89 04 24 mov %eax,(%esp)
6dbe: e8 d5 c5 ff ff call 3398 <***@plt>

# dpkg -S /usr/lib/librapi.so.2.0.0
librapi2: /usr/lib/librapi.so.2.0.0

# apt-cache show librapi2
Package: librapi2
Priority: optional
Section: libs
Installed-Size: 116
Maintainer: Volker Christian <***@debian.org>
Architecture: i386
Version: 0.9.3-3
Depends: libc6 (>= 2.3.6-6), libsynce0
Suggests: synce-dccm, librra0, librapi2-tools
Filename: pool/main/libr/librapi2/librapi2_0.9.3-3_i386.deb
Size: 24916
MD5sum: 194fe16320d801a46e822b380428cf9b
SHA1: b23f29b17f60b02ab11cab7e75ebaf258047cfae
SHA256: e526dd5edd8a1def0027122fb1d7e259f5200ba84b25d7480bc7b1d151291bdf
Description: Make RAPI calls to a WinCE device, runtime libraries
This library is equivalent to rapi.dll on a Windows machine. It allows you
to make remote calls to your WinCE device.
Tag: role::shared-lib

I guess the build environment of this package is corrupted.

Regards,
Laurent
Jonny Lamb
2007-06-20 18:08:50 UTC
Permalink
Post by Laurent Vivier
# grep MAX_PATH /usr/include/synce_types.h
#define MAX_PATH 256
<snip>
Post by Laurent Vivier
I guess the build environment of this package is corrupted.
Err, no. This was committed to svn[0] _after_ the last Debian package
was released. The Debian changelog[1] for this package shows it was
released two days before the patch was committed.

I'm currently in the process of getting 0.10.0 packages into Debian. You
can find these packages at http://jonnylamb.com/debian/

I have the 0.10.0 packages installed here, and:

$ grep MAX_PATH /usr/include/synce_types.h
#define MAX_PATH 260

[0] http://synce.svn.sourceforge.net/viewvc/synce?view=rev&revision=2582
[1] http://changelog.debian.net/libsynce
--
Jonny Lamb, UK ***@jonnylamb.com
http://jonnylamb.com GPG: 0x2E039402
Laurent Vivier
2007-06-20 18:25:15 UTC
Permalink
Post by Jonny Lamb
Post by Laurent Vivier
# grep MAX_PATH /usr/include/synce_types.h
#define MAX_PATH 256
<snip>
Post by Laurent Vivier
I guess the build environment of this package is corrupted.
Err, no. This was committed to svn[0] _after_ the last Debian package
was released. The Debian changelog[1] for this package shows it was
released two days before the patch was committed.
I'm currently in the process of getting 0.10.0 packages into
Debian. You
can find these packages at http://jonnylamb.com/debian/
$ grep MAX_PATH /usr/include/synce_types.h
#define MAX_PATH 260
[0] http://synce.svn.sourceforge.net/viewvc/synce?
view=rev&revision=2582
[1] http://changelog.debian.net/libsynce
But it was posted on the mailing list 9 days before the release of
the package.

What I suppose is the patch was applied/installed on the build
system, and, then, binaries were built using this (system wide) value
BUT header put in the package was one from the package itself: this
should explain why binaries in the package use 260 and headers in the
dev package define 252.

Regards,
Laurent
---------------------- Laurent Vivier ----------------------
"Imagination is more important than knowledge."
Jonny Lamb
2007-06-20 18:27:40 UTC
Permalink
But it was posted on the mailing list 9 days before the release of the
package.
What I suppose is the patch was applied/installed on the build system,
and, then, binaries were built using this (system wide) value BUT
header put in the package was one from the package itself: this should
explain why binaries in the package use 260 and headers in the dev
package define 252.
Although the SVN logs do not lie :)

I think the reason why doesn't really matter anymore. The new packages
have the updated, correct, value! I just hope these can be distributed
soon.

Regards,
--
Jonny Lamb, UK ***@jonnylamb.com
http://jonnylamb.com GPG: 0x2E039402
Ian Abbott
2007-06-21 10:22:39 UTC
Permalink
Post by Laurent Vivier
Post by Ian Abbott
Post by Laurent Vivier
Hi,
I'm trying to debug my application syncefs.
in my application, sizeof(CE_FIND_DATA) = 552 but in librapi2,
src/rapi/file_management.c
71: CE_FIND_DATA* array = calloc(count,
sizeof(CE_FIND_DATA));
0xb7f78c31 <_CeFindAllFiles+200>: mov 0xffffffec(%ebp),%eax
0xb7f78c34 <_CeFindAllFiles+203>: movl $0x230,0x4(%esp)
0xb7f78c3c <_CeFindAllFiles+211>: mov %eax,(%esp)
If I compile librapi2 and pls on my system all is working fine, if I use
librapi2 (0.9.3) from Debian etch and I compile pls on my system, when I
run pls I have same issue.
An idea why size of is different between librapi2 and my application ?
I use gcc 4.1 but I have same behaviour with gcc-3.4.
I think you're picking up an out-of-date <synce_types.h> from somewhere.
See
for the patch that changed MAX_PATH from 256 to 260. This accounts for
the 8 byte difference in size that you are seeing in CE_FIND_DATA, and
also affects a few other types in <rapi.h>.
Thank you.
# grep MAX_PATH /usr/include/synce_types.h
#define MAX_PATH 256
# dpkg -S /usr/include/synce_types.h
libsynce0-dev: /usr/include/synce_types.h
# apt-cache show libsynce0-dev
Package: libsynce0-dev
Priority: optional
Section: libdevel
Installed-Size: 140
Architecture: i386
Source: libsynce
Version: 0.9.3-1
Depends: libsynce0 (= 0.9.3-1)
Suggests: librapi2-dev
Filename: pool/main/libs/libsynce/libsynce0-dev_0.9.3-1_i386.deb
Size: 25258
MD5sum: 5f22c4fdc6805766d192fb7451bfec8a
SHA1: 54141639382ae4ccedf4df81b8c237bb346d10f4
SHA256: e3142e6a31a1ef262f116a3e30d60bd6ddd961ddf6d54ed470b9ed9ca829252c
Description: A helper library for synce, a tool to sync WinCE devices
This package contains the development files
Tag: devel::library, role::devel-lib
# objdump -D /usr/lib/librapi.so.2.0.0
...
6daa: 0f 84 0c 03 00 00 je 70bc <_CeFindAllFiles2+0x401>
6db0: 8b 45 ec mov 0xffffffec(%ebp),%eax
6db3: c7 44 24 04 30 02 00 movl $0x230,0x4(%esp)
6dba: 00
6dbb: 89 04 24 mov %eax,(%esp)
# dpkg -S /usr/lib/librapi.so.2.0.0
librapi2: /usr/lib/librapi.so.2.0.0
# apt-cache show librapi2
Package: librapi2
Priority: optional
Section: libs
Installed-Size: 116
Architecture: i386
Version: 0.9.3-3
Depends: libc6 (>= 2.3.6-6), libsynce0
Suggests: synce-dccm, librra0, librapi2-tools
Filename: pool/main/libr/librapi2/librapi2_0.9.3-3_i386.deb
Size: 24916
MD5sum: 194fe16320d801a46e822b380428cf9b
SHA1: b23f29b17f60b02ab11cab7e75ebaf258047cfae
SHA256: e526dd5edd8a1def0027122fb1d7e259f5200ba84b25d7480bc7b1d151291bdf
Description: Make RAPI calls to a WinCE device, runtime libraries
This library is equivalent to rapi.dll on a Windows machine. It allows you
to make remote calls to your WinCE device.
Tag: role::shared-lib
I guess the build environment of this package is corrupted.
You could use an ugly workaround in your application by adding this
before any other #includes that include <synce_types.h> directly or
indirectly:

#include <synce_types.h>
#undef MAX_PATH
#define MAX_PATH 260

It would be better if Debian's libsynce0-dev package was patched though.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <***@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
Loading...