Re: [VOTE]: migrate the proton repo to use git

2014-11-04 Thread Darryl L. Pierce
On Thu, Oct 30, 2014 at 06:59:54AM -0400, Rafael Schloming wrote:
 Hi Everyone,
 
 I'm planning on updating the release script for 0.9 to automate the last
 few details of the release process and to do proper branching. Given that
 the release script must make use of the canonical repo to work properly, it
 occurs to me that if we're going to switch over to git then now would be a
 good time so that I only need to update the release script once. I'd
 therefore like to call for a formal vote to approve the switch.
 
 [ X ] Yes, migrate the proton repo over to git.
 [   ] No, keep it in svn.

A little late to the vote.

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/



pgpY2KOJuSJIn.pgp
Description: PGP signature


[jira] [Created] (PROTON-736) ruby: unable to send binary data?

2014-11-04 Thread Dominic Evans (JIRA)
Dominic Evans created PROTON-736:


 Summary: ruby: unable to send binary data?
 Key: PROTON-736
 URL: https://issues.apache.org/jira/browse/PROTON-736
 Project: Qpid Proton
  Issue Type: Bug
  Components: ruby-binding
Affects Versions: 0.8
Reporter: Dominic Evans


As discussed on irc with [~mcpierce]

I've not been able to determine how I can correctly send binary data using the 
ruby gem.

From proton-c I can do this by (e.g.,)
{{
char* msgdata = Buffer::Data(buffer);
size_t msglen = Buffer::Length(buffer);
pn_message_set_format(msg-message, PN_DATA);
pn_message_load_data(msg-message, msgdata, msglen);
}}

and I assumed I might be able to do similar from Ruby by (e.g.,)
{{
data = File.binread(filename)
msg.format = Qpid::Proton::MessageFormat::DATA
msg.content = data
}}

But Ruby is reading the data into a string and the SWIG binding is still 
expecting a byte* array here.

After our discussions on IRC I also investigated doing:
{{
filedata = File.binread(filename)
data = Qpid::Proton::Data.new
data.binary = filedata
msg.body = data
}}

but didn't have any luck with this approach either.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (PROTON-737) [PATCH] ruby: StateError not included in exceptions

2014-11-04 Thread Dominic Evans (JIRA)
Dominic Evans created PROTON-737:


 Summary: [PATCH] ruby: StateError not included in exceptions
 Key: PROTON-737
 URL: https://issues.apache.org/jira/browse/PROTON-737
 Project: Qpid Proton
  Issue Type: Bug
  Components: ruby-binding
Affects Versions: 0.8
Reporter: Dominic Evans


Patch attached. I'm guessing this is just out of sync with proton-c



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Assigned] (PROTON-736) ruby: unable to send binary data?

2014-11-04 Thread Darryl L. Pierce (JIRA)

 [ 
https://issues.apache.org/jira/browse/PROTON-736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Darryl L. Pierce reassigned PROTON-736:
---

Assignee: Darryl L. Pierce

 ruby: unable to send binary data?
 -

 Key: PROTON-736
 URL: https://issues.apache.org/jira/browse/PROTON-736
 Project: Qpid Proton
  Issue Type: Bug
  Components: ruby-binding
Affects Versions: 0.8
Reporter: Dominic Evans
Assignee: Darryl L. Pierce

 As discussed on irc with [~mcpierce]
 I've not been able to determine how I can correctly send binary data using 
 the ruby gem.
 From proton-c I can do this by (e.g.,)
 {{
 char* msgdata = Buffer::Data(buffer);
 size_t msglen = Buffer::Length(buffer);
 pn_message_set_format(msg-message, PN_DATA);
 pn_message_load_data(msg-message, msgdata, msglen);
 }}
 and I assumed I might be able to do similar from Ruby by (e.g.,)
 {{
 data = File.binread(filename)
 msg.format = Qpid::Proton::MessageFormat::DATA
 msg.content = data
 }}
 But Ruby is reading the data into a string and the SWIG binding is still 
 expecting a byte* array here.
 After our discussions on IRC I also investigated doing:
 {{
 filedata = File.binread(filename)
 data = Qpid::Proton::Data.new
 data.binary = filedata
 msg.body = data
 }}
 but didn't have any luck with this approach either.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PROTON-737) [PATCH] ruby: StateError not included in exceptions

2014-11-04 Thread Dominic Evans (JIRA)

 [ 
https://issues.apache.org/jira/browse/PROTON-737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dominic Evans updated PROTON-737:
-
Attachment: 42_add_missing_exception_to_ruby_bindings.patch

 [PATCH] ruby: StateError not included in exceptions
 ---

 Key: PROTON-737
 URL: https://issues.apache.org/jira/browse/PROTON-737
 Project: Qpid Proton
  Issue Type: Bug
  Components: ruby-binding
Affects Versions: 0.8
Reporter: Dominic Evans
 Attachments: 42_add_missing_exception_to_ruby_bindings.patch


 Patch attached. I'm guessing this is just out of sync with proton-c



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PROTON-736) ruby: unable to send binary data?

2014-11-04 Thread Darryl L. Pierce (JIRA)

 [ 
https://issues.apache.org/jira/browse/PROTON-736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Darryl L. Pierce updated PROTON-736:

Attachment: 0001-PROTON-736-Ruby-Message-does-not-return-all-content.patch

This patch follows the Python pattern and grows the size of the content 
accordingly.

 ruby: unable to send binary data?
 -

 Key: PROTON-736
 URL: https://issues.apache.org/jira/browse/PROTON-736
 Project: Qpid Proton
  Issue Type: Bug
  Components: ruby-binding
Affects Versions: 0.8
Reporter: Dominic Evans
Assignee: Darryl L. Pierce
 Attachments: 
 0001-PROTON-736-Ruby-Message-does-not-return-all-content.patch


 As discussed on irc with [~mcpierce]
 I've not been able to determine how I can correctly send binary data using 
 the ruby gem.
 From proton-c I can do this by (e.g.,)
 {{
 char* msgdata = Buffer::Data(buffer);
 size_t msglen = Buffer::Length(buffer);
 pn_message_set_format(msg-message, PN_DATA);
 pn_message_load_data(msg-message, msgdata, msglen);
 }}
 and I assumed I might be able to do similar from Ruby by (e.g.,)
 {{
 data = File.binread(filename)
 msg.format = Qpid::Proton::MessageFormat::DATA
 msg.content = data
 }}
 But Ruby is reading the data into a string and the SWIG binding is still 
 expecting a byte* array here.
 After our discussions on IRC I also investigated doing:
 {{
 filedata = File.binread(filename)
 data = Qpid::Proton::Data.new
 data.binary = filedata
 msg.body = data
 }}
 but didn't have any luck with this approach either.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PROTON-736) ruby: unable to send binary data?

2014-11-04 Thread Dominic Evans (JIRA)

[ 
https://issues.apache.org/jira/browse/PROTON-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14196358#comment-14196358
 ] 

Dominic Evans commented on PROTON-736:
--

[~mcpierce] as discussed on IRC

The problem here is that ruby doesn't really differentiate between Binary data 
and (utf-8) String data. The IO.binread [1] method just reads that data into a 
string primitive and marks it as rb:ASCII-8BIT to prevent any encoding/decoding 
or line-ending changes from taking place on it. This can be seen in the 
mapping.rb code by the fact that the AMQP Binary type has klasses=nil for Ruby.

As such, if you use the message.body= setter and give it a String, you will 
always end up with the message body being encoded as an AmqpValue containing a 
String type. However, this is actually a spec-incompliant behaviour, because 
the spec states that a String type will only contain UTF-8 encoded data. Hence, 
if you try to receive that message using either a proton-j or python client the 
String will fail to decode.

Its not obvious what the correct fix here would be, but I'd suggest something 
along the lines of:
1) raise an exception in msg.body= if you pass a string primitive that doesn't 
contain valid UTF-8 
2) add the ability in message.rb to set your own arbitary Qpid::Proton::Data 
object as the message body and map to and from that rather than ruby primitives 
if it has been used




-- 
[1] http://ruby-doc.org/core-1.9.2/IO.html#method-c-binread

 ruby: unable to send binary data?
 -

 Key: PROTON-736
 URL: https://issues.apache.org/jira/browse/PROTON-736
 Project: Qpid Proton
  Issue Type: Bug
  Components: ruby-binding
Affects Versions: 0.8
Reporter: Dominic Evans
Assignee: Darryl L. Pierce
 Attachments: 
 0001-PROTON-736-Ruby-Message-does-not-return-all-content.patch


 As discussed on irc with [~mcpierce]
 I've not been able to determine how I can correctly send binary data using 
 the ruby gem.
 From proton-c I can do this by (e.g.,)
 {{
 char* msgdata = Buffer::Data(buffer);
 size_t msglen = Buffer::Length(buffer);
 pn_message_set_format(msg-message, PN_DATA);
 pn_message_load_data(msg-message, msgdata, msglen);
 }}
 and I assumed I might be able to do similar from Ruby by (e.g.,)
 {{
 data = File.binread(filename)
 msg.format = Qpid::Proton::MessageFormat::DATA
 msg.content = data
 }}
 But Ruby is reading the data into a string and the SWIG binding is still 
 expecting a byte* array here.
 After our discussions on IRC I also investigated doing:
 {{
 filedata = File.binread(filename)
 data = Qpid::Proton::Data.new
 data.binary = filedata
 msg.body = data
 }}
 but didn't have any luck with this approach either.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


Re: clang-format for proton-c ?

2014-11-04 Thread Dominic Evans
Rafael Schloming-3 wrote
 I like the gradual migration concept. I do use git-blame / git-annotate
 enough for a wholesale changeover to be problematic.
 
 Is there an easy way to see what the actual diffs are so we have an idea
 of
 what the various format policies actually mean?

well installing clang-format-3.5 is probably the best way to browse them
locally
clang-format-3.5 -style=chromium messenger.c  git diff | $EDITOR
git reset --hard messenger.c
# repeat

alternatively I've posted the full set (for messenger.c):
--style=chromium http://apaste.info/tXd
--style=google http://apaste.info/k0a
--style=llvm http://apaste.info/hVq
--style=mozilla http://apaste.info/Glb
--style=webkit http://apaste.info/3jx
--style=file http://apaste.info/iCd







--
View this message in context: 
http://qpid.2158936.n2.nabble.com/clang-format-for-proton-c-tp7616014p7616090.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.