ystero-dev / hampi

Rust ASN.1 Toolkit
Other
44 stars 17 forks source link

thread 'main' panicked #116

Closed Its-Just-Nans closed 4 months ago

Its-Just-Nans commented 5 months ago

hello,

I tried running hampi against this freshly exported x2ap specification:

https://github.com/tramex/types_lte_3gpp/blob/main/asn/36.423_spec_X2AP.asn

You can test by using this command this the repo

cargo run -- --codec uper --module code.re -- 36.423_spec_X2AP.asn

but I ended up having this error

thread 'main' panicked at asn-compiler/src/resolver/asn/values.rs:28:66:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Is that normal ?

Its-Just-Nans commented 5 months ago

Also with https://github.com/tramex/types_lte_3gpp/blob/main/asn/36.413_spec_S1AP.asn

Error: Custom { kind: InvalidInput, error: "Compilation Error: Resolve: Referenced Type for 'CSGMembershipStatus' Not resolved yet!" }
gabhijit commented 5 months ago

hello,

I tried running hampi against this freshly exported x2ap specification:

https://github.com/tramex/types_lte_3gpp/blob/main/asn/36.423_spec_X2AP.asn

You can test by using this command this the repo

cargo run -- --codec uper --module code.re -- 36.423_spec_X2AP.asn

but I ended up having this error

thread 'main' panicked at asn-compiler/src/resolver/asn/values.rs:28:66:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Is that normal ?

This is very likely a bug in the compiler - some unhandled construct. Will take a look at this.

gabhijit commented 5 months ago

Also with https://github.com/tramex/types_lte_3gpp/blob/main/asn/36.413_spec_S1AP.asn

Error: Custom { kind: InvalidInput, error: "Compilation Error: Resolve: Referenced Type for 'CSGMembershipStatus' Not resolved yet!" }

This looks like symbol resolution issue most likely due to the dependency not being compiled. For any protocol, you will generally have to use ALL files that are dependent on each other for those to be compiled successfully. For S1AP we have been able to successfully compile this. Please take a look here for how it is done.

This is not related to the issue above most likely.

gabhijit commented 5 months ago

hello, I tried running hampi against this freshly exported x2ap specification: https://github.com/tramex/types_lte_3gpp/blob/main/asn/36.423_spec_X2AP.asn You can test by using this command this the repo

cargo run -- --codec uper --module code.re -- 36.423_spec_X2AP.asn

but I ended up having this error

thread 'main' panicked at asn-compiler/src/resolver/asn/values.rs:28:66:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Is that normal ?

This is very likely a bug in the compiler - some unhandled construct. Will take a look at this.

I am trying to reproduce this, but I am not able to reproduce it. Following is my command line -

cargo run --bin hampi-rs-asn1c -- --codec uper --module code.re -- x2ap.asn

I keep getting one of the two errors. I believe this problem is due to both id-CSGMembershipStatus and CSGMembershipStatus not being there in the IMPORTS section of the ASN.1 Spec file.

That is the likely cause.

Its-Just-Nans commented 4 months ago

Hi thanks for your answer

Looks like some defiinitions have been renamed but not all

I needed to manual patch some asn file : https://github.com/tramex/types_lte_3gpp/blob/ddee7577a293211aabb0e3f6b6eb078b550c2b3f/build.py#L40

I have now a compiled s1ap. Now working on x2ap

I've made #119 to have a clearer error

Will update the thread when I have a working x2ap

Its-Just-Nans commented 4 months ago

Turns out the patch is the same for x2ap

I've made a second PR #120 to add some error handling :)

gabhijit commented 4 months ago

Both #119 and #120 are merged. You may want to close this issue if you think nothing needs to be addressed.

Its-Just-Nans commented 4 months ago

Thanks for the help and merges!

Closing this issue