[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-08-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16115386#comment-16115386
 ] 

ASF GitHub Bot commented on THRIFT-4266:


Github user asfgit closed the pull request at:

https://github.com/apache/thrift/pull/1316


> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>Assignee: David Hull
> Fix For: 0.11.0
>
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-08-04 Thread Anthony Molinaro (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16114809#comment-16114809
 ] 

Anthony Molinaro commented on THRIFT-4266:
--

This should be good to merge and it would be great if it could make it into the 
0.11.0 release.

> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-08-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16114807#comment-16114807
 ] 

ASF GitHub Bot commented on THRIFT-4266:


Github user djnym commented on the issue:

https://github.com/apache/thrift/pull/1316
  
@Jens-G just following up here, this is good to merge, and it would be 
great if it could make it with @dhull other fixes in the 0.11.0 release.


> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104033#comment-16104033
 ] 

ASF GitHub Bot commented on THRIFT-4266:


Github user dhull commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1316#discussion_r129976272
  
--- Diff: lib/erl/test/test_omit.erl ---
@@ -0,0 +1,82 @@
+-module(test_omit).
+
+-include("gen-erl/thrift_omit_with_types.hrl").
+
+-ifdef(TEST).
+-include_lib("eunit/include/eunit.hrl").
+
+omit_struct1_test() ->
+  %% In this test, the field that is deleted is a basic type (an i32).
+  A = #test1{one = 1, three = 3},
+  B = #test1{one = 1, two = 2, three = 3},
+  {ok, Transport} = thrift_membuffer_transport:new(),
+  {ok, P0} = thrift_binary_protocol:new(Transport),
+
+  {P1, ok} = thrift_protocol:write(P0, {{struct, {thrift_omit_with_types, 
element(1, A)}}, A}),
+  {P2, {ok, O0}} = thrift_protocol:read(P1, {struct, 
{thrift_omit_without_types, element(1, A)}}),
+  ?assertEqual(element(1, A), element(1, O0)),
+  ?assertEqual(element(2, A), element(2, O0)),
+  ?assertEqual(element(4, A), element(3, O0)),
+
+  {P3, ok} = thrift_protocol:write(P2, {{struct, {thrift_omit_with_types, 
element(1, B)}}, B}),
+  {_P4, {ok, O1}} = thrift_protocol:read(P3, {struct, 
{thrift_omit_without_types, element(1, A)}}),
+  %% io:format(user, "~p ~p\n", [ A, O1 ]),
--- End diff --

OK, will do.


> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104028#comment-16104028
 ] 

ASF GitHub Bot commented on THRIFT-4266:


Github user djnym commented on the issue:

https://github.com/apache/thrift/pull/1316
  
@Jens-G I gave it a quick review and it looks to do what it claims.  I'm 
not sure the current process for approval, so just added the comments.  If I 
need to approve some other way let me know.



> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104022#comment-16104022
 ] 

ASF GitHub Bot commented on THRIFT-4266:


Github user djnym commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1316#discussion_r129973811
  
--- Diff: lib/erl/test/test_omit.erl ---
@@ -0,0 +1,82 @@
+-module(test_omit).
+
+-include("gen-erl/thrift_omit_with_types.hrl").
+
+-ifdef(TEST).
+-include_lib("eunit/include/eunit.hrl").
+
+omit_struct1_test() ->
+  %% In this test, the field that is deleted is a basic type (an i32).
+  A = #test1{one = 1, three = 3},
+  B = #test1{one = 1, two = 2, three = 3},
+  {ok, Transport} = thrift_membuffer_transport:new(),
+  {ok, P0} = thrift_binary_protocol:new(Transport),
+
+  {P1, ok} = thrift_protocol:write(P0, {{struct, {thrift_omit_with_types, 
element(1, A)}}, A}),
+  {P2, {ok, O0}} = thrift_protocol:read(P1, {struct, 
{thrift_omit_without_types, element(1, A)}}),
+  ?assertEqual(element(1, A), element(1, O0)),
+  ?assertEqual(element(2, A), element(2, O0)),
+  ?assertEqual(element(4, A), element(3, O0)),
+
+  {P3, ok} = thrift_protocol:write(P2, {{struct, {thrift_omit_with_types, 
element(1, B)}}, B}),
+  {_P4, {ok, O1}} = thrift_protocol:read(P3, {struct, 
{thrift_omit_without_types, element(1, A)}}),
+  %% io:format(user, "~p ~p\n", [ A, O1 ]),
--- End diff --

And there are about 3-4 other commented out lines which can probably be 
removed.


> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104023#comment-16104023
 ] 

ASF GitHub Bot commented on THRIFT-4266:


Github user djnym commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1316#discussion_r129973689
  
--- Diff: lib/erl/test/test_omit.erl ---
@@ -0,0 +1,82 @@
+-module(test_omit).
+
+-include("gen-erl/thrift_omit_with_types.hrl").
+
+-ifdef(TEST).
+-include_lib("eunit/include/eunit.hrl").
+
+omit_struct1_test() ->
+  %% In this test, the field that is deleted is a basic type (an i32).
+  A = #test1{one = 1, three = 3},
+  B = #test1{one = 1, two = 2, three = 3},
+  {ok, Transport} = thrift_membuffer_transport:new(),
+  {ok, P0} = thrift_binary_protocol:new(Transport),
+
+  {P1, ok} = thrift_protocol:write(P0, {{struct, {thrift_omit_with_types, 
element(1, A)}}, A}),
+  {P2, {ok, O0}} = thrift_protocol:read(P1, {struct, 
{thrift_omit_without_types, element(1, A)}}),
+  ?assertEqual(element(1, A), element(1, O0)),
+  ?assertEqual(element(2, A), element(2, O0)),
+  ?assertEqual(element(4, A), element(3, O0)),
+
+  {P3, ok} = thrift_protocol:write(P2, {{struct, {thrift_omit_with_types, 
element(1, B)}}, B}),
+  {_P4, {ok, O1}} = thrift_protocol:read(P3, {struct, 
{thrift_omit_without_types, element(1, A)}}),
+  %% io:format(user, "~p ~p\n", [ A, O1 ]),
--- End diff --

Probably don't need this commented out line.


> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16103915#comment-16103915
 ] 

ASF GitHub Bot commented on THRIFT-4266:


Github user Jens-G commented on the issue:

https://github.com/apache/thrift/pull/1316
  
Anyone amongst the fluently Erlang speaking people who wants to review this?


> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4266) Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16103562#comment-16103562
 ] 

ASF GitHub Bot commented on THRIFT-4266:


GitHub user dhull opened a pull request:

https://github.com/apache/thrift/pull/1316

THRIFT-4266: Erlang skip fix

The Erlang library has a bug that causes it to crash when attempting to 
skip over a struct that it receives that does not exist in its thrift 
definition. This will happen when the client and server are using different 
versions of the thrift definition where one of the versions adds a struct field 
to an existing struct.

This pull request has two commits. The first commit adds a test that fails 
with the existing Erlang library. The second commit fixes the bug.

The bug was that the `erlang_protocol:skip` function expects an atom as its 
second (Type) argument, but the calls in `skip_struct_loop`, `skip_map_loop`, 
`skip_set_loop`, and `skip_list_loop` did not convert from the integer type 
decoded from the buffer to the corresponding atom.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/dhull/thrift thrift-4266-erlang-skip-fix

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1316.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1316


commit 79874dbe079fbabba663568e5ed31ffab540329a
Author: David Hull 
Date:   2017-07-26T21:27:02Z

THRIFT-4266: Fix skipping of unknown fields in Erlang client.

commit 8fd55cc7685ea2ea22016296936789572dd83c56
Author: David Hull 
Date:   2017-07-27T00:15:00Z

THRIFT-4266: Add Erlang deleted field test.




> Erlang library throws during skipping fields of composite type (maps, lists, 
> structs, sets)
> ---
>
> Key: THRIFT-4266
> URL: https://issues.apache.org/jira/browse/THRIFT-4266
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library
>Affects Versions: 0.10.0
>Reporter: David Hull
>
> I am creating this issue because I am unable to reopen THRIFT-1191.
> The Erlang thrift library throws an error when it attempts skip over an 
> unknown field when decoding a message.
> The issue is that the second argument of the `thrift_protocol:skip` function 
> must be an atom, but the calls to the `skip` function in `skip_struct_loop`, 
> skip_map_loop`, skip_set_loop`, and `skip_list_loop` do not convert the type 
> of the received field header from the integer form to the atom form.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)