tags 557023 = pending thanks Hmm... Looking more closely to your submitted patches: The second part makes sense (using an empty string when a nil is presented), although its correctness might be stylistic (i.e. some authors prefer to raise an exception on an anomalous condition, which you can catch outside their module).
However, I fail to understand the first patch: Code128's «extra=» function currently implements a simple validation to see whether the supplied extra is valid; your first patch (libbarby-ruby-0.3.2.patch) ends up being a minor optimization (as, right, CODEA+CODEB+CODEC are known to be present at the beginning of the string), but do not really solve the problem. As for the second patch (libbarby-ruby-0.3-better.patch), you put it in the «data=» function. I think it would be better to locate the fix in the «characters» function, without modifying any data structure in the process: diff --git a/lib/barby/barcode/code_128.rb b/lib/barby/barcode/code_128.rb index 1525369..46ff894 100644 --- a/lib/barby/barcode/code_128.rb +++ b/lib/barby/barcode/code_128.rb @@ -236,7 +236,7 @@ module Barby #characters like FNC1 will be present. Characters from extras are not #present. def characters - chars = data.split(//n) + chars = (data||'').split(//n) if type == 'C' result = [] This patch fixes the first case in your example code, but not the second one - As I told you, I am unsure whether the author implemented the exception raising on purpose — Clearly an empty string will not result in a valid barcode! I am removing the "pending" tag from this bug - I'd like to get your input on my reasoning, as well as the author's, before applying any of the preceding solutions. -- Gunnar Wolf • gw...@gwolf.org • (+52-55)5623-0154 / 1451-2244
signature.asc
Description: Digital signature