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

ERL-594: asn1ct_check fails on external ptypespec #3200

Open
OTP-Maintainer opened this issue Mar 27, 2018 · 7 comments
Open

ERL-594: asn1ct_check fails on external ptypespec #3200

OTP-Maintainer opened this issue Mar 27, 2018 · 7 comments
Labels
bug Issue is reported as a bug priority:low team:VM Assigned to OTP team VM

Comments

@OTP-Maintainer
Copy link

Original reporter: roadrunnr71
Affected versions: OTP-20.2.1, OTP-20.3
Component: asn1
Migrated from: https://bugs.erlang.org/browse/ERL-594


When trying to compile the ASN.1 from 3GPP TS 32.298 (attached as tgz), the asn1ct_check failes with:

{code}
Internal error: error:{badrecord,typedef}
[{asn1ct_check,check_type,3,[{file,"asn1ct_check.erl"},{line,2549}]},
 {asn1ct_check,do_checkt,3,[{file,"asn1ct_check.erl"},{line,287}]},
 {asn1ct_check,check_fold,3,[{file,"asn1ct_check.erl"},{line,6074}]},
 {asn1ct_check,checkt,2,[{file,"asn1ct_check.erl"},{line,281}]},
 {asn1ct_check,check,2,[{file,"asn1ct_check.erl"},{line,92}]},
 {asn1ct,check_pass,1,[{file,"asn1ct.erl"},{line,202}]},
 {asn1ct,run_passes_1,2,[{file,"asn1ct.erl"},{line,285}]},
 {asn1ct,process,2,[{file,"asn1ct.erl"},{line,2399}]}]
{code}

It turns out that at https://github.com/erlang/otp/blob/master/lib/asn1/src/asn1ct_check.erl#L2549 the RefTypeDef is:

{code}
{ptypedef,false,522,'DestinationRoutingAddress',
                [{{type,[],
                      {'Externaltypereference',522,'CAP-classes',
                          'PARAMETERS-BOUND'},
                      [],[],no},
                  {'Externalvaluereference',522,'CAP-datatypes',bound}}],
                {type,[],
                    {'SEQUENCE OF',
                        {type,[],
                            {pt,{'Externaltypereference',523,'CAP-datatypes',
                                    'CalledPartyNumber'},
                                [{'Externalvaluereference',523,
                                     'CAP-datatypes',bound}]},
                            [],[],no}},
                    [{element_set,
                         {'SizeConstraint',
                             {element_set,{'SingleValue',1},none}},
                         none}]
{code}
@OTP-Maintainer
Copy link
Author

kenneth said:

Which file are you compiling and with what options when the error above occurs?
Among the .asn1 modules you have sent there is imports from other ASN1 modules that you have not provided, like
for example CAP-classes imported from CAP-datatypes. So there is no chance that CAP-databases will be successfully compiled anyhow.


@OTP-Maintainer
Copy link
Author

roadrunnr71 said:

I've attached a minimum project with all the ASN.1 files. There are multiple `Internal error: error:badarg` failures when trying to compile this.

@OTP-Maintainer
Copy link
Author

roadrunnr71 said:

I managed to extract two minimal test cases. There might be more....

@OTP-Maintainer
Copy link
Author

roadrunnr71 said:

I have found a fix for one of the problems (https://github.com/RoadRunnr/otp/commit/045418c604a8afcea3d718fbe9292e8eed7cbc19).

A small test ASN.1 is included, but I don't know (and don't have the time to investigate) how to hook it into the test suite.

@OTP-Maintainer
Copy link
Author

kenneth said:

Just for my understanding. Your fix is fixing compilation of Test2.asn1 or ChoiceDefault.asn1?
What .asn1 file is now causing the remaining fault?

What parameters are you using towards the asn1 compiler?


@OTP-Maintainer
Copy link
Author

roadrunnr71 said:

It is fixing the ChoiceDefault.asn1. Test2.asn1 still breaks.

No extra arguments, i'm just doing a ```asn1ct:compile("Test2.asn1").```

The remaining asn1 files still don't work. I'll try to extract a few more failing cases into simplified constructs.

@OTP-Maintainer
Copy link
Author

roadrunnr71 said:

I've extracted a minimal test case for another failure from the full set of ASN.1 files.

This time asn1ct_constructed_per failes with ```Internal error: error:badarg```

https://github.com/RoadRunnr/otp/commit/420d9fe71bad58978a560480b36774644d2b775b

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:PS Assigned to OTP team PS priority:low labels Feb 10, 2021
@IngelaAndin IngelaAndin added team:VM Assigned to OTP team VM and removed team:PS Assigned to OTP team PS labels Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:low team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants