Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffi `:variadic? true` generated function do not use all arguments supplied #449

Open
mpenet opened this issue Nov 15, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@mpenet
Copy link
Contributor

commented Nov 15, 2015

I get unexpected results when using it.

As an example here is what it outputs from "printf" (defined in stdlib as (def printf (ffi-fn libc "printf" [CCharP] CInt :variadic? true))):

user => (printf "a" "b" "c")
a

It seems everything after the 1st argument is ignored.

@heyLu

This comment has been minimized.

Copy link
Member

commented Nov 15, 2015

Yes, #420 was about the same problem. As I said there, I'm not sure if our FFI can handle the full signature of printf. It seems to support multiple arguments to printf and passes them, but I don't know what happens after that.

I went looking in pixie/vm/libs/ffi.py, and looked for variadic? there. I think it doesn't actually convert the additional arguments to printf, even though it allocates space for them, it does not convert the additional arguments. (The problem seems to be that _arg_types is used to convert the arguments, but that's just the [CCharP] from the signature, and doesn't include the (unknown) types for the optional arguments.)

@mpenet

This comment has been minimized.

Copy link
Contributor Author

commented Nov 15, 2015

There is a missing piece yes. I tried briefly to follow what's happening in ffi.py as well but that's still a bit vague to me. I guess that's something @halgari could look into when he gets some time.

@thomasmulvaney thomasmulvaney added the bug label Dec 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.