XDR fails on array inside recursive types

Hans Ole Rafaelsen
2022-09-27T06:29:25Z

Hi,

When updating some code from an old version of Ocamlnet to the latest, I ran into a problem where it seems like it no longer works with arrays of recursive types.

It fails with following exception: Fatal error: exception Failure("Netxdr.validate_xdr_type: Array elements must not have length 0")

The following definition:

struct bar {
   bar vbar<>;
};

program B {
  version B {
    int f(bar) = 1;
  } = 1;
} = 1;

Fails for this program: Netxdr.validate_xdr_type Test1_aux.xdrt_B'B'f'arg netstring (version: 4.1.9)

Same problem if the recursive type is an union.

Changing Netxdr to Xdr, the program works with old version of Ocamlnet netstring (version: 3.4.1)

Is this a bug in the new version?

Regards,

Hans Ole Rafaelsen

test_xdr.tgz