[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wrong guile-bytestructures description for gnunet progress-info stru
Taylan Ulrich Bayırlı/Kammer
Re: Wrong guile-bytestructures description for gnunet progress-info struct with unions
Sun, 07 Jan 2018 19:39:13 +0100
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)
Amirouche Boubekki <address@hidden> writes:
> I triple checked the %fs-progress-info definition, it's correct,
> but I still get incorrect value for status field, see download.scm
> line 13.
Wow, GNUNET_FS_ProgressInfo is hell of a struct. :-)
I also checked the bytestructure definition just in case but yes it
Here are some possibilities I can think of, wildly speculatively.
- %time-relative is defined wrong (I couldn't find the corresponding
GNUNET_TIME_Relative definition to compare)
- %crypto-ecdsa-public-key is defined wrong (I couldn't find the
corresponding GNUNET_CRYPTO_EcdsaPublicKey definition to compare)
If both of those are correct, further possibilities would be:
- Some or all of the structs in the C code are "packed".
- There's a bug in bytestructures.
To rule out these two, you can use a simple test case: write a tiny C
lib with a function that allocates a GNUNET_FS_ProgressInfo struct,
writes to its status field, and returns a pointer to it. Load the lib
from Scheme, call the function through FFI... you know the rest; see if
you get the correct value when you read the status field from Scheme.
If you get the correct result, further possibilities:
- The wrong pointer is being passed to pointer->bytestructure for
- The status field is being read at the wrong time for whatever reason.
(Be extra careful if the code is multi-threaded.)
- The struct is being deallocated before Scheme code is done with it.
Hope that helps,